An issue encountered by PHP calling PEAR.php in Nginx

Source: Internet
Author: User
Tags pear

The company has an old project, wrote for many years, is running on Apache, inadvertently, I want to let it run to nginx, the result encountered a pear.php problem, first installed pear

Basic Ann Rich is

wget Http://pear.php.net/go-pear.phar
PHP Go-pear.phar

I PHP version is 5.4, first disable Disable_functions this or the installation is unsuccessful

After the installation, the tune-up was reported as a mistake.

Phpinfo () Look at this file.
Loaded Configuration File/usr/local/php/etc/php.ini
The value of view php.ini is
-------------------------------------------------------------------------------
; Open_basedir, if set, limits all file operations to the defined directory
;  and below. This directive makes more sense if used in a per-directory
; or per-virtualhost Web server configuration file. This directive is
; *not* affected by whether Safe Mode was turned on or Off.
; Http://php.net/open-basedi
Open_basedir = "./:/usr/local/php/lib/php/" #这个是我自己设置的
---------------------------------------------------------------------------------------------
[Email protected] ~]# ll/usr/local/php/lib/php/
Total 84
Drwxr-xr-x 2 root root 14:41 Archive
Drwxr-xr-x 2 root root 4096 June 16:22 build
Drwxr-xr-x 2 root root 14:41 Console
Drwxr-xr-x 5 root root 15:16 data
Drwxr-xr-x 9 root root 124 15:16 doc
Drwxr-xr-x 3 root root the June 16:29 extensions
Drwxr-xr-x 2 root root 6 14:34 htdocs
Drwxr-xr-x 3 root root 15:16 HTTP
Drwxr-xr-x 2 root root 15:16 Net
Drwxr-xr-x 2 root root 14:41 OS
Drwxr-xr-x root root 4096 14:41 PEAR
-rw-r--r--1 root root 15188 14:41 pearcmd.php
-rw-r--r--1 root root 34864 14:41 pear.php
-rw-r--r--1 root root 1033 14:41 peclcmd.php
Drwxr-xr-x 3 root root 15:16 Services
Drwxr-xr-x 3 root root 14:41 structures
-rw-r--r--1 root root 20292 14:41 system.php
Drwxr-xr-x 9 root root 139 15:16 test
Drwxr-xr-x 3 root root 15:16 Text
Drwxr-xr-x 2 root root 14:41 XML
---------------------------------------------------------------------------------------
The directory below is the one with this pear.php file.
-----------------------------------------------------------------------------------
But Nginx gave the following error
--------------------------------------------------------------------------------------
2015/08/13 09:51:38 [ERROR] 635#0: *17 FastCGI sent in stderr: "PHP message:php warning:require_once (): Open_basedir re Striction in effect. File (/usr/local/php/lib/php/pear.php) is not within the allowed path (s): (/home/wwwroot/editor.com:/tmp/:/proc/) in/ Home/wwwroot/editor.com/mail.php on line 46
PHP message:php warning:require_once (/usr/local/php/lib/php/pear.php): Failed to open stream:operation not permitted I N/home/wwwroot/editor.com/mail.php on line 46
PHP message:php Fatal error:require_once (): Failed opening required ' pear.php ' (include_path= '.:/ Usr/local/php/lib/php ') in/home/wwwroot/editor.com/mail.php on line [reading response header from upstream, Clie nt:127.0.0.1

------------------------------------------------

A variety of attempts or reports

2015/08/13 10:18:20 [ERROR] 4110#0: * FastCGI sent in stderr: "PHP message:php warning:require_once (): Open_basedir re Striction in effect. File (/usr/local/php/lib/php/pear.php) is not within the allowed path (s): (/home/wwwroot/editor.com:/tmp/:/proc/) in/ Home/wwwroot/editor.com/mail.php on line 46
PHP message:php warning:require_once (/usr/local/php/lib/php/pear.php): Failed to open stream:operation not permitted I N/home/wwwroot/editor.com/mail.php on line 46
PHP message:php Fatal error:require_once (): Failed opening required ' pear.php ' (include_path= '.:/ php/includes:/usr/local/php/lib/php/') in/home/wwwroot/editor.com/mail.php on line, "while reading response header From upstream, client:127.0.0.1, server:editor.com, Request: "Post/appbaseinfosaver.php http/1.1", Upstream: "FastCGI: Unix:/tmp/php-cgi.sock: ", Host:" Editor.com ", referrer:" http://editor.com/appBaseInfo.php?t=new&tplt= Capricorn "

==============================================================================

At last, it was a trick.

Fastcgi_param php_value open_basedir= "open_basedir= $document _root:/usr/local/php/lib/php/:/tmp/:/home/wwwroot/";

The whole world is quiet again.

An issue encountered by PHP calling PEAR.php in Nginx

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.