This article mainly introduces the Ubuntu server to build PHP operating environment method, simple analysis of the Ubuntu operating system environment to build Apache, PHP and MySQL module related steps, commands and operating skills, the need for friends can refer to the next
This paper describes the way to build PHP running environment under Ubuntu Server. Share to everyone for your reference, as follows:
Install Apache2:
sudo apt-get install apache2
To install the PHP module:
sudo apt-get install php5
Install MySQL
sudo apt-get installmysql-server
Other module installation:
sudo apt-get install Libapache2-mod-php5sudo apt-get installlibapache2-mod-auth-mysqlsudo apt-get Installphp5-mysqlsudo Apt-get Install PHP5-GD
The first two are easy to understand, in order for Apache to parse PHP, you need to use these two modules to find PHP engine. The third is used in PHP to operate the MySQL database, most people have experience in database programming, so this is not much to explain. A fourth GD library.
1.apache root directory
After installing apache2, the root directory under/VAR/WWW, you can test it by http://localhost/ . Of course, you can also create a new file in this directory test.html to try http://localhost/test.html.
2. Change the default directory of Apache2 to the current development directory
The default directory for APACHE2 is configured in the /etc/apache2/sites-enabled/00default file.
Locate the DocumentRoot entry in the file, and change the/var/www to your development directory for OK.
Of course, there is another way to do this is not to change the default directory, but to create a link to your directory under Var/www. For example, your directory is in /home/username/phptest, so you just
sudo ln-s/home/username/phptest/var/www/phptest
This way you can access your working directory through Http://localhost/phptest .
3. Common commands in configuration
Restart Apache
Sudo/etc/init.d/apache2 restart