Compile and install PHP5.X extension apache

Source: Internet
Author: User
Compile and install PHP5.X extension apache-Linux Enterprise Application-Linux server application information. The following is a detailed description. 1. Download Directory:/home/ben/PHP5.2.6.tar.gz
2. Enter the php decompression directory on cd.
3. sudo ../php-5.2.6/configure -- prefix =/opt/php
-- With-mysql =/opt/mysql
-- With-apxs2 =/opt/apache/bin/apxs
-- With-config-file-path =/opt/php/etc
-- Enable-track-vars
Note:

-- With-apxs2 [= FILE]

Compile and share the Apache 2.0 module. FILE is the path of the optional Apache apxs tool. It points to apxs by default.

-- With-config-file-path = PATH

Set the search path for php. ini (configuration file. The default value is PREFIX/lib.

-- Enable-track-vars

To enable the get/post tracing function of cookies

-- With-mysql =/usr/local/mysql

Specifies the location where the mysql Data Server is installed. (The -- prefix option specifies the installation directory. The -- with-mysql option specifies the directory where the supported MySQL services are located; the -- with-apxs2 option specifies the directory of the Apache application to be used by PHP; The -- with-config-file-path option specifies the directory of the PHP configuration file .)

After executing the command like this, you will see the following error:
Configure: error: xml2-config not found. Please check your libxml2 installation.
This is the same as compiling MySQL because the system lacks the library files required by PHP. Follow the prompts to perform the following operations:
Sudo apt-get install libxml2 (press the Tab key)
The following information is displayed:
Libxml2 libxml2-dev libxml2-headers libxml2-utils
Here you need to install the libxml2-dev software package (the software comes with Ubuntu-Server, you need to use the Ubuntu-Server disc installation), the operation is as follows:

Sudo apt-get install libxml2-dev

After the library file is installed, re-compile:

After compilation, you will see the words "Thank you for using PHP.", indicating that PHP has been configured successfully.

Next, compile and install PHP as follows:
4. sudo make
5. sudo make install

2. After installing PHP, You need to manually modify the Apache configuration to make Apache support PHP. The operations are as follows:
Cd/opt/apache/conf
Sudo vi httpd. conf
Find the "AddType application" section and add the following content to it:
AddType application/x-httpd-php. php
(If you want to add support for the default php index file name, find "DirectoryIndex index.html" and change it to "DirectoryIndex index.html. var index. php"). Save the modification and exit.
In addition, do not forget to install PHP. ini-recommended file copy to the PHP configuration file directory specified at compile time/opt/php/etc, in the PHP source package directory "php-5.2.6" operation is as follows:
Sudo cp php. ini-recommended/opt/php/etc/php. ini
After all the configurations are complete, do not forget to restart apache for the new configuration to take effect.
This completes the installation and configuration of Apache 2.2.9 + Mysql 5.0.67 + PHP 5.2.6 In the Ubuntu Server system environment. You can use PHP's own functions to confirm and create an index. PHP file in the root directory of the web. The content of the editing file is as follows:
Phpinfo ();
?>
After saving and exiting, enter "http: // IP/index. php ". If the configuration is correct, you can see the server information you Just configured, including the Apache, MySQL, and PHP versions, installation path, and configuration information. If you only see the word "phpinfo ();", it means that apache does not support PHP correctly (if AddType application/x-httpd-php. php is missing, it will appear .), Check whether the above configuration process has been completed correctly.
There are many related configurations in Apache, MySQL, and PHP. This article only describes some of the most basic configurations. If you need other configurations, you can configure them based on the actual situation, for specific configuration methods and procedures, refer to the relevant information. I will not go into details here (in fact, many of them still do not understand, haha ).
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.