Compile and install PHP5.2.8 in Ubuntu

Source: Internet
Author: User
Before you start to compile and install PHP under Ubuntu, first install the software package 1, flexsudoapt-getinstallflex2, apache2-threaded-devsudoapt-getinstallapache2-threaded-dev after installation, you can find the installation content at the following location, for example, apache2/usr/bin/apxs2, if it is apache1/usr/bin/apxs3,

Install the software package before compiling and installing PHP In Ubuntu.

1. flex
Sudo apt-get install flex
2. apache2-threaded-dev
Sudo apt-get install apache2-threaded-dev

After installation, you can find the installation content at the following location
For example, apache2
/Usr/bin/apxs2
For apache1
/Usr/bin/apxs

3. libxml2-dev
Sudo apt-get install libxml2-dev

After installing the above software, you need to modify httpd. conf.
Add fake content to httpd. conf.
For example:
# Dummy LoadModule directive to aid module installations
# LoadModule dummy_module/usr/lib/apache2/modules/mod_dummy.so
Because if the content of httpd. conf is empty
An error occurs when installing PHP.

Start compiling and installing PHP

1. Extract
$ Tar zxvf php-5.2.8.tar.gz

2. view available compilation Parameters
$./Configure-help

3. Now the Basic installation is available, except for apache2. If you encounter other problems during later use, modify the compilation parameters and process them one by one.
Where
-- Prefix is used to specify the installation directory
-- The with-apxs2 is used to specify the location of apxs2.
./Configure -- prefix =/usr/local/php -- with-apxs2 =/usr/bin/apxs2

2. Compile
Make
3. Compile and Test
Make test
3. Installation
Sudo make install

Modify httpd. conf
Add the following content
AddType application/x-httpd-php. php. phtml
AddType application/x-httpd-php-source. phps

Add index. php to/var/www /.
Echo phpinfo ();
?>

Restart apache
Sudo apache2ctl-k restart

Access 127.0.0.1/index. php in a browser

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.