1 installation apache2sudoapt-getinstallapache2 installation is complete, run the following command restart: sudo/etc/init. d/apache2restart: Enter http: // localhost or http: // 127.0.0.1 in the browser. If you see "Itworks! & Ldquo;, it indicates that Apache is successfully installed. The default installation of Apache 1 is apache2.
Sudo apt-get install apache2
After the installation is complete, run the following command to restart:
Sudo/etc/init. d/apache2 restart
Enter
Http: // localhost or http: // 127.0.0.1
If you see "It works! ", It means that Apache is successfully installed. By default, Apache will create a directory named www under/var. This is
The Web directory. All Web files that can be accessed through a browser must be put in this directory.
2. install php
Sudo apt-get install libapache2-mod-php5 php5
We recommend that you install the PDO extension:
(1) For mySQL database installation extension:Sudo apt-get install php5-gd php5-mysql
(2) For PostgreSQL database installation extension:Sudo apt-get install php5-gd php5-pgsql
(Note: The PDO extension defines a lightweight and consistent interface for PHP to access the database. It provides a data access abstraction layer, so that no matter what database is used, you can use consistent functions to query and obtain data)
After installation, restart Apache to load the PHP module:
Sudo/etc/init. d/apache2 restart
Next, create a PHP file under the Web directory to test whether PHP can run normally. type the following command:
Sudo gedit/var/www/phpinfo. php
Then enter:
Phpinfo ();
?>
Save the file and enter http: // 127.0.0.1/phpinfo. php In the browser. If a page displays the PHP running parameters, it indicates that PHP is running properly.
If you want to check whether the PDO extension of the corresponding database is successfully installed, go to the http: // 127.0.0.1/phpinfo. php page and find "pdo" if it is shown as follows:
The PDO of PostgreSQL is successfully installed! If PDO drivers has mysq, it indicates that mySQL's PDO is successfully installed!