Lnmp PHP reboot does not load the correct php.ini file

Source: Internet
Author: User
Tags php compiler zend

Content reference: http://www.cnblogs.com/argb/p/3604340.html


In the morning to modify the PHP configuration file, php-fpm.conf, restart NGINX,PHP-FPM after the discovery of the site does not come. The Nginx error log is:

2015/09/18 10:11:30 [error] 15081#0: *1073 fastcgi sent in stderr:   "Php message: php warning:  require_once (zend/application.php):  failed  to open stream: no such file or directory in /web/www. Xxx.com/wwwroot/public/index.php on line 18php message: php fatal error:   require_once (): failed opening required  ' zend/application.php '   (include_ Path= '/web/www. xxx.com/wwwroot/library:.:/ Usr/local/lib/php ')  in /web/www. Xxx.com/wwwroot/public/index.php on line 18 " while reading response header  from upstream, client: xxx.19.116.133, server: www. xxx.com, request:  "get / http/1.1", upstream:  "Fastcgi://unix:/usr/local/php/var /run/www. XXX.com.socket: ", host: " www. XXX.com "

Through a good long analysis, it is php.ini inside the Zend configuration is not in effect, so it is possible that the php.ini file is not loaded.

First check the PHP compiler parameters

[[Email protected] ~]$ /usr/local/php/bin/php -i|grep configureconfigure command  =>   './configure '    '--prefix=/usr/local/php '   '--with-config-file-path=/usr/ Local/php/etc '   '--with-mysql=/usr/local/mysql '   '--with-mysqli=/usr/local/mysql/bin/mysql_config '   '--with-mysql-sock=/tmp/mysql.sock '   '--with-pdo-mysql=/usr/local/mysql '   '--with-gd '   '-- Enable-libxml '   '--enable-xml '   '--enable-bcmath '   '--enable-shmop '   '--enable-sysvsem '   ' --enable-inline-optimization '   '--with-curlwrappers '   '--enable-mbregex '   '--enable-fpm '   '-- Enable-mbstring '   '--enable-ftp '   '--enable-gd-native-ttf '   '--with-openssl '   '--enable-pcntl '   '--enable-sockets '   '--with-xmlrpc '   '--enable-zip '   '--enable-soap '   '--without-pear '   '--with-gettext '   '--enable-session '   '--with-mcrypt '   '--with-curl '   '--enable-ctype '   '--with-freetype-dir ' 

The--with-freetype-dir parameter is a parameter that is later recompiled, which means that PHP has been compiled twice.

View PHP's php.ini file default path:

[Email protected] ~]$/usr/local/php/bin/php-i|grep php.iniconfiguration File (php.ini) Path =/usr/local/php/ etcloaded Configuration File =/usr/local/lib/php.ini

As you can see, php default load of php.ini file exists path is:/usr/local/lib/php.ini

And my correct php.ini file exists path:/usr/local/php/etc/php.ini

After checking,/usr/local/lib/php.ini did not configure the Zend extension, so the Web site could not be started.

Cp/usr/local/php/etc/php.ini/usr/local/lib/php.ini

Overwrite php.ini file, restart PHP-FPM, website OK

or load the php.ini file directly with a command

[Email protected] etc]#/usr/local/php/sbin/php-fpm-c/usr/local/php/etc/php.ini

Solve the problem



Thinking: Php Files: php-fpm.conf php.ini two files,php-fpm.conf is a configuration file for PHP-FPM process services

PHP.ini is a PHP runtime core configuration file and a php extension configuration file, such as

Extension=memcache.soextension=yaf.soextension=redis.so

In php.ini, the content configuration will be expanded to take effect.

Therefore, in this case, the Zend extension does not take effect and you can find out if the php.ini file is in effect.




Lnmp PHP reboot does not load the correct php.ini file

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.