Little brother machine above tune pear.php but when the access prompt no permission, this file/usr/local/php/lib/php/pear.php is exist, I use is nginx +php-fpm environment, Online has said in PHP.ini set
Open_basedir = "./:/usr/local/php/lib/php/"
This, it's still not working.
PHP Version 5.4.41
Here is an error,
2015/08/12 16:05:14 [ERROR] 4786#0: FastCGI sent in stderr: "PHP message:php warning:require_once (): Open_basedir Res Triction 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 in /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:1
Reply to discussion (solution)
You look at the value of Open_basedir.
When Open_basedir is not empty, PHP can only access directories specified by Open_basedir
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/" #这个是我自己设置的
---------------------------------------------------------------------------------------------
[Root@localhost ~]# 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 Res Triction 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 in /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,
--------------------------------------------------------------------------------------------------------------- ----------------
Version Master you look at this.
Do not set Open_basedir
; open_basedir = "./:/usr/local/php/lib/php/" #这个是我自己设置的
Pear's path is to be added to the include_path.
Follow the instructions of the moderator
---------------------------
; UNIX: "/path1:/path2"
include_path = ".:/ php/includes:/usr/local/php/lib/php/"
; open_basedir = "./:/usr/local/php/lib/php/" #我试了一下开启也不行
------------------------------------
Restarted the PHP-FPM and Nginx
And it turned out to be a mistake.
-----------------------------------------------
2015/08/13 10:18:20 [ERROR] 4110#0: * FastCGI sent in stderr: "PHP message:php warning:require_once (): Open_basedir Res Triction 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 in /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 "
Version Master Hello, I've solved the problem here.
And in the end, add this to the Nginx.
Fastcgi_param php_value open_basedir= "open_basedir= $document _root:/usr/local/php/lib/php/:/tmp/:/home/wwwroot/";