Home  >  Article  >  Backend Development  >  How to install php5.5

How to install php5.5

coldplay.xixi
coldplay.xixiOriginal
2020-08-20 10:58:361870browse

How to install php5.5: First compile and download it to the install directory, and install the dependencies of the PHP software; then install the libiconv software, and download and decompress the PHP software; then create a soft link to the PHP software program. And configure the php parsing file; finally start the [php-fpm] program.

How to install php5.5

[Related learning recommendations: php programming (video)]

php5.5 Installation method:

1. Compile and download to the /install/ directory

# Upload to the /install/ directory

-rw-r--r--  1 root  root   17773092 Apr  1 10:19 php-5.5.32.tar.gz

2. Install PHP software dependencies

Command: (check) yum install -y zlib-devel libxml2-devel libjpeg-devel libjpeg-turbo-devel libiconv-devel freetype-devel libpng-devel gd-devel libcurl-devel libxslt-devel

Command: (check) rpm -qa zlib-devel libxml2-devel libjpeg-devel libjpeg-turbo-devel libiconv-devel freetype-devel libpng-devel gd -devel libcurl-devel libxslt-devel

3, libiconv software installation---Character set conversion library (you can not install it by default)

Command: (switch ) cd /install/

command: (download) wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz

command: (unzip )tar zxf libiconv-1.14.tar.gz

Command: (switch) cd /install/libiconv-1.14

Command: (continue) /install/libiconv-1.14/configure --prefix =/opt/libiconv

Command: (Translate) make

Command: (Compile and install) make install

Command: (Switch) cd /install/

Command: (Download)

wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

Command: (Download) yum install libmcrypt-devel mhash mcrypt -y

Command: (Check) rpm -qa libmcrypt-devel mhash mcrypt

4. Download and decompress PHP software

Command: (switch) cd /opt/

Command: (decompress) tar xf php-5.5.32 .tar.gz

Command: (switch) cd /opt/php-5.5.32

Command: (configure)

./configure \
--prefix=/opt/php-5.5.32 \
--with-mysql=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-iconv-dir=/opt/libiconv \
--with-freetype-dir \
--with-jpeg-dir \
--with-png-dir \
--with-zlib \
--with-libxml-dir=/usr \
--enable-xml \
--disable-rpath \
--enable-bcmath \
--enable-shmop \
--enable-sysvsem \
--enable-inline-optimization \
--with-curl \
--enable-mbregex \
--enable-fpm \
--enable-mbstring \
--with-mcrypt \
--with-gd \   
--enable-gd-native-ttf \
--with-openssl \
--with-mhash \
--enable-pcntl \
--enable-sockets \
--with-xmlrpc \
--enable-soap \
--enable-short-tags \
--enable-static \
--with-xsl \
--with-fpm-user=nginx \
--with-fpm-group=nginx \
--enable-ftp \
--enable-opcache=no
./configure --prefix=/opt/php-5.5.32 --with-mysql=mysqlnd --with-pdo-mysql=mysqlnd --with-iconv-dir=/opt/libiconv --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-fpm --enable-mbstring --with-mcrypt --with-gd    --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-soap --enable-short-tags --enable-static --with-xsl --with-fpm-user=nginx --with-fpm-group=nginx --enable-ftp --enable-opcache=no

======= ================================================== ====================

Note: Note: When deploying LNMP architecture, if the mysql service and web service are not on the same host, the php configuration parameters Need to be adjusted

--with-mysql=/application/mysql/ => --with-mysql=mysqlnd

PHP extension parameters: (If there is no problem with the configuration, you can omit the following configuration parameters, The following parameters are related to PHP optimization)

--with-curlwrappers \
--enable-zip \
--enable-zend-multibyte \

5, fear of making mistakes (error prevention) (the following information does not need to be configured)

Command: (Create soft connection) ln -s /application/mysql/lib/libmysqlclient.so.18 /usr/lib64/

Command: (Create file) touch ext/phar/phar.phar

Command: (Proceed Translate php) make

command: (compile and install php) make install

6, PHP software program to create a soft link

command: (create Soft link) ln -s /opt/php-5.5.32/ /opt/php

7, configure php parsing file/configure php-fpm configuration file

Command: (switch) cd /opt/php-5.5.32

Command: (view) ll php.ini*

-rw-r--r--. 1 1001 1001 69236 2016-02-02 21:33 php.ini-development
-rw-r--r--. 1 1001 1001 69266 2016-02-02 21:33 php.ini-production

(php.ini-developments is a configuration file for developer debugging , php.ini-production is a common configuration file for production)

Command: (copy) cp php.ini-production /opt/php/lib/php.ini

php.ini- Comparison of the difference between production and php.ini-development files

Extension: File comparison command diff zdiff vimdiff File comparison on windows

Command: (switch) cd /application/php/etc/

Command: (switch) cp php-fpm.conf.default php-fpm.conf

(The following content depends on the situation)

# When compiling and installing PHP, if the configuration is not Correctly specify the PHP process user information, you can modify the PHP file to adjust

sed -i 's#user = www#user = nginx#g;s#group = www#group = nginx#g' /application/ php-5.5.32/etc/php-fpm.conf

8, start php-fpm program

Command: (start)/application/php/sbin/ php-fpm

Command: (Check the port) lsof -i :9000 <--- Confirm whether the php 9000 port is started correctly

Command: (Check the program) ps -ef| grep php-fpm

Related recommendations:Programming video course

The above is the detailed content of How to install php5.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
Previous article:Usage of php substringNext article:Usage of php substring