Linux under Compilation installation configuration php5.6.30 process

Source: Internet
Author: User

After the first compilation of the installation php5.6.30 failed, reference to some of the contents of Http://www.phpworld.cn/system/php/11.html, the second compilation installation is successful, hereby record the process.

First, compile and install php5.6.30

Installation Environment:

# cat/etc/redhat-release CentOS Release 6.8 (Final)
#/application/nginx/sbin/nginx-vnginx version:nginx/1.6.3

Download php5.6.30 installation package

wget http://cn2.php.net/distributions/php-5.6.30.tar.bz2

Extract

TAR-XJF php-5.6.30.tar.bz2

Install the required dependency packages

# Rpm-qa Zlib-devel libxm12-devel libjpeg-devel libjpeg-turbo-devel libiconv-devel freetype-devel libpng-devel Libpng-devel gd-devel libcurl-devel libxslt-devel# yum install zlib-devel libxm12-devel libjpeg-devel Libjpeg-turbo-devel libiconv-devel freetype-devel libpng-devel libpng-devel gd-devel libcurl-devel libxslt-devel-y

Installing the Libiconv Library

Wget tar zxf libiconv-1.14.tar.gz cd libiconv-1.14./configure--prefix=/usr/local/libiconvmakemake install

Start installing PHP

[[Email protected] php-5.6.30]#./configure --prefix=/application/php5.6.30 --with-mysql= Mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-iconv-dir=/usr/local/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-zip --enable-soap  --enable-short-tags --enable-static --with-xsl --with-fpm-user=nginx -- with-fpm-group=nginx --enable-ftp --without-pear --disable-phar# because this machine does not have pear package, So choose temporarily Skip (--without-pear --disable-phar), and so on after the installation of PHP and then patch Go-pear

650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M01/8E/F1/wKiom1jPe6XTvL_PAAC_OlMXg4o910.jpg-wh_500x0-wm_ 3-wmp_4-s_1986251777.jpg "title=" compiled successfully "alt=" Wkiom1jpe6xtvl_paac_olmxg4o910.jpg-wh_50 "/>

Make compilation

[email protected] php-5.6.30]# make .... Build complete. Don ' t forget to run ' make test '. [[email protected] php-5.6.30]# make test

The result of make test reported some problems, I ignored, continue to install the

650) this.width=650; "src=" https://s5.51cto.com/wyfs02/M00/8E/F0/wKioL1jPgDSyelcaAABZGVxzbBM744.jpg "title=" 2.jpg "alt=" Wkiol1jpgdsyelcaaabzgvxzbbm744.jpg "/>

Execute make Install

[[email protected] php-5.6.30]# make installinstalling shared extensions:      /application/php5.6.30/lib/php/extensions/no-debug-non-zts-20131226/Installing  Php cli binary:        /application/php5.6.30/bin/installing  php cli man page:      /application/php5.6.30/php/man/man1/ installing php fpm binary:        /application/ php5.6.30/sbin/installing php fpm config:        / application/php5.6.30/etc/installing php fpm man page:       /application/php5.6.30/php/man/man8/installing php fpm status page:   / application/php5.6.30/php/php/fpm/installing php cgi binary:         /application/php5.6.30/bin/installing php cgi man page:      /application/ php5.6.30/php/man/man1/installing build environment:     /application/ php5.6.30/lib/php/build/installing header files:            /application/php5.6.30/include/php/Installing helper programs:        /application/php5.6.30/bin/  program: phpize  program:  php-configinstalling man pages:              /application/php5.6.30/php/man/man1/  page: phpize.1  page:  php-config.1installing pdo headers:            /application/php5.6.30/include/php/ext/pdo/


Second, configure PHP

CP Php.ini-production/usr/local/php/etc/php.ini #复制php配置文件到安装目录 Rm-rf/etc/php.ini #删除系统自带配置文件

Ln-s/usr/local/php/etc/php.ini/etc/php.ini #添加软链接到/etc Directory

cp/usr/local/php/etc/php-fpm.conf.default/usr/local/php/etc/php-fpm.conf #拷贝模板文件为php-fpm configuration file

Ln-s/usr/local/php/etc/php-fpm.conf/etc/php-fpm.conf #添加软连接到/etc Directory

Modify Php-fpm.conf

PID = Run/php-fpm.pid #取消前面的分号

Modify Php-ini.conf

Find to: Disable_functions =

Modified to:

disable_functions = passthru,exec,system,chroot,scandir,chgrp, Chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink, Popepassthru,stream_socket_server,escapeshellcmd,dll,popen,disk_free_space,checkdnsrr,checkdnsrr,getservbyname , Getservbyport,disk_total_space,posix_ctermid,posix_get_last_error,posix_getcwd, posix_getegid,posix_ Geteuid,posix_getgid, posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_ Getpgrp,posix_getpid, posix_getppid,posix_getpwnam,posix_getpwuid, posix_getrlimit, posix_ getsid,posix_getuid,posix_isatty, posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,  Posix_setpgid,posix_setsid,posix_setuid,posix_strerror,posix_times,posix_ttyname,posix_uname 

#列出PHP可以禁用的函数, if some programs need to use this function, you can delete, cancel disable.

Found:;d Ate.timezone =

Modified to:

Date.timezone = PRC #设置时区

Found: expose_php = On

Modified to:

expose_php = Off #禁止显示php版本的信息

Found: Short_open_tag = Off

Modified to:

Short_open_tag = on #支持php短标签

Note: The Short_open_tag must be turned on. You can use the segment label for PHP after you open it: (). At the same time, only open this can use <?= to replace < Echo. Some open source systems will use short tags, if not open will be an error.

Find Opcache.enable=0

Revision changed to

Opcache.enable=1 #php支持opcode缓存

Found in:; Opcache.enable_cli=1 #php支持opcode缓存

Modified to:

Opcache.enable_cli=0

On the last line add:

Zend_extension=opcache.so #开启opcode缓存功能

: Wq #保存退出

Configure nginx.conf

Location ~ \.php$ {root Html/bbs;    #你网页根目录 Fastcgi_pass 127.0.0.1:9000;    Fastcgi_index index.php;    Fastcgi_param script_filename $document _root$fastcgi_script_name; Include Fastcgi_params;}

To create a test file:

[email protected] bbs]# cat index.php <?php phpinfo ();? >[[email protected] bbs]# cat index.html Bbs.html[[email PR Otected] bbs]# Pwd/application/nginx/html/bbs

Start php-fpm, restart Nginx, and test the results

/application/php/sbin/php-fpm-c/application/php/etc/php.ini-y/application/php/etc/php-fpm.conf
/application/nginx/sbin/nginx-s Reload

650) this.width=650; "src=" https://s4.51cto.com/wyfs02/M01/8E/F2/wKiom1jPigzxmni4AAD17TewVcs871.jpg "style=" float : none; "title=" 3.jpg "alt=" Wkiom1jpigzxmni4aad17tewvcs871.jpg "/>

650) this.width=650; "src=" https://s4.51cto.com/wyfs02/M00/8E/F2/wKiom1jPig2D_LsFAAApJKIWHn4034.jpg "style=" float : none; "title=" 4.jpg "alt=" Wkiom1jpig2d_lsfaaapjkiwhn4034.jpg "/>


Linux under Compilation installation configuration php5.6.30 process

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.