Compile and install php

Source: Internet
Author: User
Compile and install php, decompress php-to/usr/local/src, and enter this directory for compilation.

Cd/usr/local/src/php-5.2.9

#. /Configure -- prefix =/usr/local/php -- with-apxs2 =/usr/local/apache2/bin/apxs -- with-mysql =/usr/local/mysql -- with-config- file-path =/usr/local/php

Note: -- with-apxs2 =/usr/local/apache2/bin/apxs: use apache's apxs tool to compile php into a module of apache

-- With-mysql =/usr/local/mysql: combined with mysql

Make & make install

Cp php. ini-dist/usr/local/php. ini

If everything goes well, apache2/modules should have a libphp5.so file.

Add php support for apache

Edit the/usr/local/apache2/conf/httpd. conf file

In AddType application/x-compress. Z
AddType application/x-gzip. gz. tgz

Add a line later

AddType application/x-httpd-php. php (note that there must be spaces in this area)

At the end of the DirectoryIndex command, add index. php

Test Apache and php support

The apache control file is under/usr/local/apache2/bin.

Apachectl stop apache service

Apachectl start apache service

Complete a php test page 1.php with one line:

, Put it in/usr/local/apache2/htdocs

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.