Mysql and apache have been installed successfully on ubuntu, but apache does not support php yet, this time, we are going to install php on ubuntu and integrate it with apache. 1. for ubuntu to install php, we need to install libxml2 first and execute the following command sudoapt-getinstalll.
Mysql and apache have been successfully installed on ubuntu, but apache does not support php. this time, we are going to install php on ubuntu and integrate it with apache.
1. for ubuntu to install php, you need to install libxml2 first.
Run the following command first
Sudo apt-get install libxml2
Sudo apt-get install libxml2-dev
2.decompress the PHP tar.gz package
3. compile php
Enter the php extract directory and enter. /configure -- prefix =/usr/local/php -- with-apxs2 =/home/cry/apache/bin/apxs -- with-mysql =/usr/local/mysql -- with-config- file-path =/usr/local/php -- enable-mbstring
The above -- with-config-file-path =/usr/local/php can also not, look at the actual situation to get the line, the with-apxs2 configuration is apache bin directory under the apxs
After compiling php, you should see the following interface:
4. generate an executable file
Just use the make command like installing other software.
This process may take several minutes. during this time, you can have a cup of tea.
5. install php
6. copy the php. ini-development in the compilation directory to the php installation directory.
If the with-config-file-path is not configured, copy the file to the lib folder in the php installation directory.
7. modify httpd. conf of apache
Add AddType application/x-httpd-php. php to the bottom of LoadModule.
8. write a php test environment in apache htdocs to check whether the environment is successfully set up.
Normally, you should see such a page