Centos installation PHP5

Source: Internet
Author: User
Tags fpm gettext soap mcrypt pear sqlite

Alas Ann has led long, finally good!!!!!! Kai Sen, at this time also ready to share to everyone, hope to help everyone Oh! ~ ~ ~!

began to install the PHP7 and installed PHP5, reported the following error, no one can solve, to the next day to install the sudden can, haha haha haha ...

Then I went to check if there was an installation package, the display was not found, and then I tried another installation method ... ^_^

1. Download PHP Source Package

# wget HTTP://CN2.PHP.NET/DISTRIBUTIONS/PHP-5.5.15.TAR.BZ2
# Tar XF php-5.5.15.tar.bz2-c/usr/local/src/

2. Add Epel Source

# RPM-UVH http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

3. Installation dependencies

# yum Install GCC bison bison-devel zlib-devel libmcrypt-devel mcrypt mhash-devel openssl-devel libxml2-devel libcurl-deve L Bzip2-devel readline-devel Libedit-devel

4. Create WWW user

# Groupadd www
# useradd-g Www-s/sbin/nologin-m www

5. Compiling the installation

# cd/usr/local/src/php-5.5.15/

#./configure \
--prefix=/usr/local/php \
--WITH-CONFIG-FILE-PATH=/ETC \
--enable-inline-optimization \
--disable-debug \
--disable-rpath \
--enable-shared \
--enable-opcache \
--ENABLE-FPM \
--WITH-FPM-USER=WWW \
--WITH-FPM-GROUP=WWW \
--WITH-MYSQL=MYSQLND \
--WITH-MYSQLI=MYSQLND \
--WITH-PDO-MYSQL=MYSQLND \
--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 \
--without-sqlite3 \
--without-pdo-sqlite \
--with-pear

For the parameter description of the compiled installation above

"" Installation path "" "
--prefix=/usr/local/php \
"" " php.ini configuration file path " ""
--with-config-file-path=/etc \
"" optimization option "" "
--enable-inline-optimization \
--disable-debug \
--disable-rpath \
--enable-shared \
"" " enable Opcache, default is zendoptimizer+ (Zendopcache) " ""
--enable-opcache \
"" " FPM " ""
--enable-fpm \
--with-fpm-user=www \
--with-fpm-group=www \
"" " MySQL " ""
--with-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
"" internationalization and character encoding support "" "
--with-gettext \
--enable-mbstring \
--with-iconv \
"" " Encryption Extension " ""
--with-mcrypt \
--with-mhash \
--with-openssl \
"" " Mathematical Extension " ""
--enable-bcmath \
"" " Web Service, soap dependency libxml " ""
--enable-soap \
--with-libxml-dir \
"" " process, signal and memory" ""
--enable-pcntl \
--enable-shmop \
--enable-sysvmsg \
--enable-sysvsem \
--ENABLE-SYSVSHM \
"" " Socket & Curl " ""
--enable-sockets \
--with-curl \
"" " Compress and Archive " ""
--with-zlib \
--enable-zip \
--with-bz2 \
"" " GNU Readline command line shortcut key binding " "
--with-readline \
"" disables SQLite support extension "" "
--without-sqlite3 \
--without-pdo-sqlite \
"" " more PHP extensions and Applications Library " "
--with-pear

6. If your Web Server is using Apache, add the similar:--with-apxs2=/usr/local/apache/bin/apxs parameter.

About MYSQLND Please see what is PHP's MySQL Native driver? or view MySQL official description: MySQL native driver for PHP, or installation on Unix.

For more compilation parameters, use the./configure--help to view.

First of all,,, anyway, I do not understand, as if to laugh at myself ...!!!! And then I directly use the following, useful can try to see

# Make-j4 (Don't panic, this step will be a long time!) I was so bored! ~ ~ ~)
# make Install

7. If you want to reinstall:

# Make Clean
# Make Clean all

#./configure ...
# MAKE-J4
# make Install

8. Configure the PHP configuration file:

# CP Php.ini-development/etc/php.ini

9.PHP-FPM Service When you overwrite, the letter must correspond YO!!! Otherwise, I will be in the following situation! If you want to delete it, you can't change it!!!

# 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

10. Start PHP-FPM

# service PHP-FPM Start

The command appears below the starting PHP-FPM done boot success!!!

PHP-FPM Available Parameters Start|stop|force-quit|restart|reload|status

11. Add PHP commands to environment variables

Edit command with # Vim ~/.bash_profile

Edit the ~/.bash_profile to:

Path= $PATH: $HOME/bin
Switch
Path= $PATH: $HOME/bin:/usr/local/php/bin

12. Make the PHP environment variable effective:

# . ~/.bash_profile

13. See PHP version

# php-v

HA haha!!! It's done!!! Feel PHP5 installation is simpler than PHP7 .... Let's see if you're successful???

Centos installation PHP5

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.