Nginx 1.9+php5.6 Environment Construction

Source: Internet
Author: User
Tags install php install openssl mcrypt openssl library sapi

1PHP5.61Download the installation package #wget http://mirrors.sohu.com/php/php-5.6.2.tar.gz#tar-ZXF php-5.6.2?2Install PHP-dependent packages?? #yum Install gcc gcc-c++ libxml2 libxml2-devel libjpeg-devel libpng-devel freetype-devel openssl-devel libcurl-devel libmcrypt-devel3Installation (-prefix is the installation directory,-with-mysql is the MySQL installation directory, because I was installed with Yum, so do not need to write-with-mysql=****where this looks, the other parameters are self-Baidu. )#?./configure--prefix=/usr/local/php--with-config-file-path=/usr/local/php/etc--enable-fpm--enable-pcntl-- Enable-mysqlnd--enable-opcache--enable-sockets--enable-sysvmsg--enable-sysvsem--enable-sysvshm--enable-shmop-- Enable-zip--enable-ftp--enable-soap--enable-xml--enable-mbstring--disable-rpath--disable-debug-- Disable-fileinfo--with-mysql--with-mysqli--with-pdo-mysql--with-pcre-regex--with-iconv--with-zlib--with-mcrypt --WITH-GD--with-openssl--with-mhash--with-xmlrpc--with-curl--with-imap-SSL? #make #make Install If the previous steps are not error, the installation is successful, there is an error estimate is a little bit what, with Baidu check after Yum.? #cp php.ini-production/usr/local/php/etc/php.ini? When we use Nginx, we have to put PHP-fpm.conf put it in/usr/local/php/etc/.inside CP/usr/local/php/etc/php-fpm.conf.default/usr/local/php/etc/php-fpm.conf Next we may also need to add PHP-FPM as a server service? #cp SAPI/fpm/init.d.php-fpm/etc/init.d/php-FPM (/usr/local/src/php-5.6. 17 is the PHP installation folder)?? Set permissions, and add service #chmod+x/etc/init.d/php-Fpm#chkconfig--add php-FPM can then use the following command to manage PHP-fpm up #service php-fpm start#service php-fpm stop#service php-fpm restart#service php-fpm Reloadmake:[sapi/cli/php] Error1Workaround ext/iconv/.libs/iconv.o:in function ' Php_iconv_stream_filter_ctor':/USR/LOCAL/PHP/EXT/ICONV/ICONV.C:2491: Undefined reference to ' Libiconv_open'Collect2:ld returned1Exit Statusmake:[sapi/cli/php] Error1# VI Makefile in the installation of PHP into the system if it happens "undefined reference to Libiconv_open'"error message, which means that the"./configure"does not grasp some of the environmental variable values. The error occurred at the point of establishing the "-o sapi/cli/php" error, not giving the ICONV function library parameters to link. Solution 1: Edit makefile about 77 rows or so: Extra_libs= ...-lcrypt at the end add-liconv, for example: Extra_libs = ...-lcrypt-Liconv and then re-make again. Solution 2:make Zend_extra_libs='-liconv'LN-s/usr/local/lib/libiconv.so.2/usr/lib64/configure:error:mcrypt.h not found. Please reinstall Libmcrypt. Workaround wget http://124.205.69.134/files/817400000026d1df/soft.vpser.net/web/libmcrypt/libmcrypt-2.5.8.tar.gz./Configuremakemake Installdon't know how to define struct flock on the This system, set--enable-opcache=no solutionvim/etc/ld.so.conf.d/local.conf # Edit library file/usr/local/Lib # Add the line: Wq # Save Exit Ldconfig-v # make it effective2nginx:wget http://nginx.org/download/nginx-1.9.7.tar.gzTAR-ZXVF nginx-1.9.7. TAR.GZCD Nginx-1.9.7./configure--user=www--group=www--prefix=/usr/local/nginx-1.9.7--with-http_stub_status_module make;make INSTALLCD. VI/usr/local/nginx/conf/nginx.conf ... location~\.php$ {root html; Fastcgi_pass127.0.0.1:9000;            Fastcgi_index index.php;            Fastcgi_param script_filename $document _root$fastcgi_script_name;        Include Fastcgi_params; } Error prompt:./configure:error:the HTTP Rewrite module requires the PCRE library. Install PCRE-devel problem Solving yum-Y Install pcre-devel error prompt:./configure:error:the HTTP Cache module requires MD5 functions fromOpenSSL Library. You can either disable the module byusing--without-http-cache option, or install the OpenSSL library into the System,or build the OpenSSL library statically fromThe source with Nginx byusing--with-http_ssl_module--with-openssl=<path>options. Workaround: Yum-Y install OpenSSL openssl-devel3Environment Variables: Method One: Direct Run command export PATH= $PATH:/usr/local/webserver/php/bin and Export path= $PATH:/usr/local/webserver/mysql/Bin uses this method only to be valid for the current session, meaning that the PATH setting is invalidated whenever the system is logged out or logged off, but only temporarily. Method Two: Execute VI~/.bash_profile Modify the PATH line in the file, adding/usr/local/webserver/php/bin and/usr/local/webserver/mysql/bin to the path= $PATH: $HOME/after the bin line, this method only takes effect on the currently logged on user Method three: Modify/etc/The profile file makes it permanent and takes effect for all system users, with the following two lines of code at the end of the file path= $PATH:/usr/local/webserver/php/bin:/usr/local/webserver/mysql/binexport Path Last: Execute command sourceThe/etc/profile or execute Point command./profile make its modifications effective, and you can see if the add succeeds through the Echo $PATH command.

Nginx 1.9+php5.6 Environment Construction

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.