Home >Backend Development >PHP Problem >How to install and configure Linux PHP 5.5

How to install and configure Linux PHP 5.5

藏色散人
藏色散人Original
2020-08-28 09:05:372916browse

Linux php5.5 installation and configuration method: first download and install php5.5; then modify the configuration information; finally start through the command "/usr/local/php-5.5.0/sbin/php-fpm" php-fpm".

How to install and configure Linux PHP 5.5

Recommended: "PHP Video Tutorial"

Installation and configuration of php5.5 under Linux

Install php5.5 under Linux environment (specifically centos 6.6)

First, we need to download and install php5.5

cd /usr/local/src/
wget http://www.php.net/get/php-5.5.0.tar.bz2/from/jp1.php.net/mirror

If the above PHP does not exist Yes, you can go directly to the official download.

Make sure you have installed gd, png, curl, xml and other lib development libraries before installation. If you are not sure, execute the following command:

yum install gcc make gd-devel libjpeg-devel libpng-devel libxml2-devel bzip2-devel libcurl-devel -y

The following parameters are supported, ftp, picture function, pdo, etc. are supported. Because the mysqlnd that comes with PHP is used, there is no need to install additional mysql lib library. If you If it is a 64-bit system, add –with-libdir=lib64 after the parameter. If not, you can skip it.

tar -xjf php-5.5.0.tar.bz2
cd php-5.5.0
./configure --prefix=/usr/local/php-5.5.0 --with-config-file-path=/usr/local/php-5.5.0/etc --with-bz2 --with-curl --enable-ftp --enable-sockets --disable-ipv6 --with-gd --with-jpeg-dir=/usr/local --with-png-dir=/usr/local --with-freetype-dir=/usr/local --enable-gd-native-ttf --with-iconv-dir=/usr/local --enable-mbstring --enable-calendar --with-gettext --with-libxml-dir=/usr/local --with-zlib --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --with-mysql=mysqlnd --enable-dom --enable-xml --enable-fpm
make
make install

Note: If PHP does not need curl and ftp support, you can remove the above –with-curl –enable-ftp. If you are a professional Linux practitioner, you can choose by looking at the help Your installation parameters, if you are not, I suggest you copy and paste my configuration parameters directly. This will save you some detours.

PHP has been installed, let’s start configuring PHP

cp php.ini-production /usr/local/php-5.5.0/etc/php.ini
cp /usr/local/php-5.5.0/etc/php-fpm.conf.default /usr/local/php-5.5.0/etc/php-fpm.conf

In fact, we just use a configuration it provides us by default. Of course, you can also modify the configuration information according to your own needs, and then start php-fpm

/usr/local/php-5.5.0/sbin/php-fpm

Execute the above command, if no error is reported, it is normal In this case, it means that the startup is normal. If you are not sure, you can also judge whether PHP is started through the port

netstat -lnt | grep 9000
tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN

or:

ps -ef | grep php-fpm
root      3321     1  0 14:33 ?        00:00:00 php-fpm: master process (/usr/local/php-5.5.0/etc/php-fpm.conf)
nobody    3322  3321  0 14:33 ?        00:00:00 php-fpm: pool www
nobody    3323  3321  0 14:33 ?        00:00:00 php-fpm: pool www
root      3325  3059  0 14:33 pts/0    00:00:00 grep php-fpm

If a result similar to this appears, it means that our PHP is installed.

The above is the detailed content of How to install and configure Linux PHP 5.5. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn