PHP Installation Manual for Centos

Source: Internet
Author: User
Tags php software
1. environment check: php installation depends on apache and mysql. therefore, to install php, you must first check the installation of apache and mysql. Command for checking the version:/apache/bin/apachectl-v/mysql-uroot-p & #39; & #39;-e & quot; selectversion (); & quot; php will call some function libraries such as gd during development, so you need to confirm the following LI

1. environment check

Php installation depends on apache and mysql. therefore, to install php, you must first check the installation of apache and mysql.

Run the following command to check the version:

/Apache/bin/apachectl-v

/Mysql-uroot-p'-e "selectversion ();"

Some function libraries such as gd are called during php Development. Therefore, you need to check whether the following LIB Library has been installed. These lib libraries must be checked. first, php installation is required, and some php functions can be used. If not, we can also use yum for direct installation.

Rpm-qa zlib libxml lib1_freetype libpng gd curl libiconv zlib-devel libxml2-devel libjpeg-devel freetype-devel libpng-develgd-devel curl-devely

In the check structure, if devel is found, the installation is successful. If not, use yum install.


2. install the libiconv Library

This library is not available by default. you need to install it manually.

Wgethttp: // ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz

Tar zxf libiconv-1.14.tar.gz

Cd libiconv-1.14

./Configure -- prefix =/usr/local/libiconv

Make

Make install

Cd ../


3. start installing PHP software

1) obtain the php software package

Wget http://hk2.php.net/distributions/php-5.3.27.tar.gz

Http://hk2.php.net/distributions/php-5.2.17.tar.gz

2) compile and install

./Configure \

-- Prefix =/usr/local/php-5.2.17 \

-- With-apxs2 =/usr/local/apache/bin/apxs \

-- With-config-file-path =/usr/local/php/etc \

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

-- With-xmlrpc \

-- With-openssl \

-- With-zlib \

-- With-freetype-dir \

-- With-gd \

-- With-jpeg-dir \

-- With-png-dir \

-- With-iconv =/usr/local/libiconv \

-- Enable-short-tags \

-- Enable-sockets \

-- Enable-zend-multibyte \

-- Enable-soap \

-- Enable-mbstring \

-- Enable-static \

-- Enable-gd-native-ttf \

-- With-curl \

-- With-xsl \

-- Enable-ftp \

-- With-libxml-dir \

-- Enable-sigchild \

-- Enable-pcntl \

-- Enable-bcmath

Make

Make install

Ln-s/application/php-5.2.17/application/php


The specific meanings of compilation parameters can be viewed through man. these are the configuration parameters that can be normally used in the production environment of people on the network. whether the actual production environment is so well-known is not the case. [Note that the path in the compilation parameters must be correct. Will not prompt an error .]


4. configure apache to support php

Edit the http. conf configuration file and add the following two lines to the end of line 311:

AddType application/x-httpd-php. php. php3

AddType application/x-httpd-php-source. phps

In row 3, add index. php to DirectoryIndexindex. php index.html.

If the apxs parameter is specified during compilation, php will add a module loading configuration in httpd. conf during compilation.

LoadModule php5_module modules/libphp5.so

In this way, save the configuration file. Then, create a file index. php in the home directory of the site. the content is as follows:

Phpinfo ();

?>

If the php information appears, it indicates that the installation is successful.

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.