Home >Backend Development >PHP Problem >How to install php5 under linux

How to install php5 under linux

藏色散人
藏色散人Original
2021-06-27 14:46:131813browse

How to install php5 under Linux: 1. Download the required version of the PHP source code package; 2. Execute "tar xzf php-5.6.14.tar.gz"; 3. Compile and install; 4. Configure PHP. Can.

How to install php5 under linux

The operating environment of this article: linux5.9.8 system, PHP version 5.6, DELL G3 computer

How to install php5 under linux?

Compile and install PHP 5.6 under Linux

If the system has used yum to install php, uninstall php first

# rpm -qa | grep php
php-mcrypt-5.3.3-3.el6.x86_64
php-pgsql-5.3.3-46.el6_6.x86_64
php-xmlrpc-5.3.3-46.el6_6.x86_64
...
# rpm -e php-mcrypt-5.3.3
....

Download the PHP source code package

1 . http://php.net/downloads.php, download the required version of the PHP source code package, and upload it to the linux server

2. tar xzf php-5.6.14.tar.gz

Installation dependencies

# yum -y install gcc bison bison-devel zlib-devel libmcrypt-devel mcrypt mhash-devel openssl-devel libxml2-devel libcurl-devel 
bzip2-devel readline-devel libedit-devel sqlite-devel

Compile and install

#  ./configure \
--enable-inline-optimization \
--disable-debug \
--disable-rpath \
--enable-shared \
--enable-opcache \
--enable-fpm \
--with-mysql \
--with-mysqli \
--with-pdo-mysql \
--with-gettext \
--enable-mbstring \
--with-iconv \
--with-mcrypt \
--with-mhash \
--with-openssl \
--enable-bcmath \
--enable-soap \
--with-libxml-dir \
--enable-pcntl \
--enable-shmop \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--enable-sockets \
--with-curl \
--with-zlib \
--enable-zip \
--with-bz2 \
--with-readline
# make
# make install

If you want to reinstall:

# make clean
# make clean all
# ./configure...
# make
# make install

Configure PHP

Configuration file:

# cp php.ini-development /usr/local/php56/etc/php.ini

php -fpm service

# cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
# cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
# chmod +x /etc/init.d/php-fpm

Start php-fpm

# service php-fpm start
Starting php-fpm  done

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of How to install php5 under linux. 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