linux-rhel6.4 Compiling and installing Php,nginx connection with PHP

Source: Internet
Author: User
Tags fpm recode sapi


Determine dependent package installation

GCC gcc-c++ libxml2 libxml2-devel bzip2 bzip2-devel libmcrypt libmcrypt-devel OpenSSL openssl-devel libcurl-devel libjpeg -devel libpng-devel freetype-devel readline readline-devel libxslt-devel perl perl-devel psmisc.x86_64 Recode Recode-devel Libtidy Libtidy-devel

If not installed, mount the system image, from the Packages folder to find the installation package installation, or have Yum source can be directly installed yum install.


You can create your own local Yum source using a mirror: http://kurol.blog.51cto.com/11433546/1927721


Get it from the website, compile and install

[[Email protected] ~]# wget http://de2.php.net/get/php-5.5.38.tar.gz/from/this/mirror  [[email protected] ~]# tar -zxvf php-5.5.38.tar.gz[[email protected]  php-5.5.38]# ./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 --with-libdir=lib64......creating main/internal_functions_cli.c+------------------------- -------------------------------------------+| License:                                                              | |  this software is subject to the php license, available in  this     | |  distribution in the file LICENSE.  By continuing this  installation | |  process, you are bound by the terms of this license  agreement.     | |  if you do not agree with the terms of this license,  you must abort | |  the installation process at this point.                             |+------------------------------------ --------------------------------+thank you for using php.config.status: creating  php5.specconfig.status: creating main/build-defs.hconfig.status: creating scripts/ phpizeconfig.status: creating scripts/man1/phpize.1config.status: creating scripts/ php-configconfig.status: creating scripts/man1/php-config.1config.status: creating sapi/ cli/php.1config.status: creating sapi/fpm/php-fpm.confconfig.status: creating sapi/fpm/ Init.d.php-fpmconfig.status: creating sapi/fpm/php-fpm.serviceconfig.status: creating sapi /fpm/php-fpm.8config.status: creating sapi/fpm/status.htmlconfig.status: creating sapi/cgi /php-cgi.1config.status: creAting ext/phar/phar.1config.status: creating ext/phar/phar.phar.1config.status: creating  main/php_config.hconfig.status: executing default commands[[email protected] ~] # make[[email protected] ~]# make install[[email protected] ~]# cd  php-5.5.38[[email protected] php-5.5.38]# cp php.ini-production /usr/local/ Php-5.5.0/etc/php.ini[[email protected] php-5.5.38]# cd /usr/local/php-5.5.0/etc/[[email  protected] etc]# cp php-fpm.conf.default php-fpm.conf[[email protected]  etc]# cd /usr/local/php-5.5.0/sbin[[email protected] sbin]# ./php-fpm


Nginx Connection to PHP

Points:

1:nginx Default Support fastcgi

2:php Compile the Open module:

--enable-fpm

Connection:

[[email protected] ~]# vim /usr/local/nginx/conf/nginx.conf      server {              listen        80;               server_name  localhost;               location / {                 root   html;                 index  index.html index.php;             }             .......             location ~ \.php$ {                root    html;                 fastcgi_pass   127.0.0.1:9000;                 fastcgi_param  SCRIPT_FILENAME   $document _root$ fastcgi_script_name;                 include   fastcgi_params;             }        }


Restart Nginx:

[Email protected] ~]# Cd/usr/local/nginx/sbin[[email protected] sbin]#./nginx-s Reload


To add a PHP test file:

[[email protected] ~]# Cd/usr/local/nginx/html[[email protected] ~]# touch Info.php[[email protected] ~]# vim info.php
<?phpphpinfo ();? >


Browser testing:

650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M02/96/4D/wKioL1kfGlWDkef3AAD-ahlCg6E388.png-wh_500x0-wm_ 3-wmp_4-s_3438299227.png "title=" 1495210337 (1). png "alt=" wkiol1kfglwdkef3aad-ahlcg6e388.png-wh_50 "/>

This article is from the "Shei" blog, make sure to keep this source http://kurol.blog.51cto.com/11433546/1927720

linux-rhel6.4 Compiling and installing Php,nginx connection with PHP

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.