nginx 中 PHP 调用PEAR.php遇到的问题
公司有个老项目,写了很多年了,是在apache 上面跑的,无意间,我想让它跑到nginx上,结果遇到了PEAR.php的问题,先安装pear
基本安富有就是
wget http://pear.php.net/go-pear.phar
php go-pear.phar
我php版本是5.4的,先禁用disable_functions 这个要不然安装不成功
安装上了以后,就调报是报了这个错
phpinfo() 查看到是这个文件
Loaded Configuration File /usr/local/php/etc/php.ini
查看php.ini的值是
-------------------------------------------------------------------------------
; open_basedir, if set, limits all file operations to the defined directory
; and below. This directive makes most sense if used in a per-directory
; or per-virtualhost web server configuration file. This directive is
; *NOT* affected by whether Safe Mode is 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 20 Aug 12 14:41 Archive
drwxr-xr-x 2 root root 4096 Jun 12 16:22 build
drwxr-xr-x 2 root root 23 Aug 12 14:41 Console
drwxr-xr-x 5 root root 60 Aug 12 15:16 data
drwxr-xr-x 9 root root 124 Aug 12 15:16 doc
drwxr-xr-x 3 root root 38 Jun 12 16:29 extensions
drwxr-xr-x 2 root root 6 Aug 12 14:34 htdocs
drwxr-xr-x 3 root root 40 Aug 12 15:16 HTTP
drwxr-xr-x 2 root root 21 Aug 12 15:16 Net
drwxr-xr-x 2 root root 22 Aug 12 14:41 OS
drwxr-xr-x 11 root root 4096 Aug 12 14:41 PEAR
-rw-r--r-- 1 root root 15188 Aug 12 14:41 pearcmd.php
-rw-r--r-- 1 root root 34864 Aug 12 14:41 PEAR.php
-rw-r--r-- 1 root root 1033 Aug 12 14:41 peclcmd.php
drwxr-xr-x 3 root root 38 Aug 12 15:16 Services
drwxr-xr-x 3 root root 34 Aug 12 14:41 Structures
-rw-r--r-- 1 root root 20292 Aug 12 14:41 System.php
drwxr-xr-x 9 root root 139 Aug 12 15:16 test
drwxr-xr-x 3 root root 48 Aug 12 15:16 Text
drwxr-xr-x 2 root root 21 Aug 12 14:41 XML
---------------------------------------------------------------------------------------
目录下面是有这个PEAR.php这个文件的
-----------------------------------------------------------------------------------
但是Nginx 报错了以下的错
--------------------------------------------------------------------------------------
2015/08/13 09:51:38 [error] 635#0: *17 FastCGI sent in stderr: "PHP message: PHP Warning: require_once(): open_basedir restriction 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 46" while reading response header from upstream, client: 127.0.0.1
------------------------------------------------
各种尝试还是报
2015/08/13 10:18:20 [error] 4110#0: *1 FastCGI sent in stderr: "PHP message: PHP Warning: require_once(): open_basedir restriction 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 46" 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"
==============================================================================
最后用了这么一招
fastcgi_param PHP_VALUE open_basedir="open_basedir=$document_root:/usr/local/php/lib/php/:/tmp/:/home/wwwroot/";
整个世界又清静了.
nginx 中 PHP 调用PEAR.php遇到的问题的更多相关文章
- Nginx中FastCGI配置优化
FastCGI: FastCGI是从CGI发展改进而来的.传统CGI接口方式的主要缺点是性能很差,因为每次HTTP服务器遇到动态程序时都需要重新启动脚本解析器来执行解析,然后结果被返回给HTTP服务器 ...
- 【转】nginx中的ngx_cdecl
http://blog.csdn.net/midion9/article/details/50605337 看nginx的代码时,发现有些函数返回值之后,还有一个ngx_cdecl关键字,如: 1 ...
- CentOS6.4 安装OpenResty和Redis 并在Nginx中利用lua简单读取Redis数据
1.下载OpenResty和Redis OpenResty下载地址:wget http://openresty.org/download/ngx_openresty-1.4.3.6.tar.gz Re ...
- nginx中时间的管理
nginx出于性能考虑採用类似lib_event的方式,自己对时间进行了cache,用来降低对gettimeofday()的调用,由于一般来说server对时间的精度要求不是特别的高,只是假设须要比較 ...
- nginx中的502错误
遇到这种情况,首先看一下慢日志 [17-Aug-2015 13:13:43] WARNING: [pool www] child 27780, script '/data/s.com/index.ph ...
- nginx基本配置与参数说明以及Nginx中的upstream轮询机制介绍
转自:http://blog.csdn.net/happydream_c/article/details/54943802 一.nginx简介 Nginx (发音为[engine x])专为性能优化而 ...
- nginx中使用perl模块
转载自:http://www.netingcn.com/nginx-perl.html 如果对于一个绝大部分内容是静态的网站,只有极少数的地方需要动态显示,碰巧你又了解一点perl知识,那么nginx ...
- 14 nginx 中配置 expires缓存提升网站负载
一:nginx 中配置 expires缓存提升网站负载 对于网站的图片,尤其是新闻站, 图片一旦发布, 改动的可能是非常小的.我们希望 能否在用户访问一次后, 图片缓存在用户的浏览器端,且时间比较长的 ...
- Nginx中的惊群现象解决方法
*什么是惊群现象?Nginx中用了什么方法来避免这种问题的发生?本篇就解决这两个问题...→_→* 惊群现象的定义与危害 在Nginx中,每一个worker进程都是由master进程fork出来的.m ...
随机推荐
- Codeforces Round #363 LRU(概率 状压DP)
状压DP: 先不考虑数量k, dp[i]表示状态为i的概率,状态转移方程为dp[i | (1 << j)] += dp[i],最后考虑k, 状态表示中1的数量为k的表示可行解. #incl ...
- [译] EXTENDING JQUERY – 2.2 A simple plugin
2.2 一个简单的插件示例 jQuery 插件能做任何事情,这个已经由浩如烟海的各类第三方插件如证明.小到只影响一个元素,大到改变多个元素的外观和行为,jQuery 的各种功能等你来扩展. 2.2.1 ...
- PHP json数据格式化方法
php 的json_encode能把数组转换为json格式的字符串.字符串没有缩进,中文会转为unicode编码,例如\u975a\u4ed4.人阅读比较困难.现在这个方法在json_encode的基 ...
- java调用shell获取返回值
转自:http://blog.csdn.net/tengdazhang770960436/article/details/12014839 1.shell文件return.sh echo 1 echo ...
- 提高Axure设计效率的10条建议 (转)
Axure 是创建软件原型的快速有力的工具.上手很容易,但是,其中存在一个危险.这款软件是如此的直观以至于很多用户可以在没有接受过任何正式培训的情况下进行使用.他们可能不知道的是他们可能没有以恰当的方 ...
- codeforces724-B. Batch Sort
想着想着就忘了有什么问题没解决,坑啊 一开始读错题意了,而且一着急写了两大段差不多的代码,冗余度啊,不说了.. 显然的一点,给的数据是绝对离散的,每行都是1~m的排列 难点一.如何移动能使未排序的数组 ...
- 【SQL Sever】将SQL Sever中的一个数据表的数据导出为insert语句
例如:这SQL Sever中的一张数据表,想要将这张数据表中的数据 转化成一个一个的insert语句存储在txt的文档中,那么不论走到那里这个insert语句一执行,我们就能将这个数据表中的数据 ...
- 关于C/C++中数组元素的初始化
1.一维数组初始化 对于一维数组,其初始化有一个错误的观点是:一直以为 int a[256]={0};是把a的所有元素初始化为0,int a[256]={1};是把a所有的元素初始化为1. 数组可 ...
- PS切图的几种方式
方法一 点击图层右键-->导出为 导出需要的格式与大小 方法二 选择多个图层右键--->快速导出为PNG(导出的名字就是图层名字) 方法三
- css:删除:×的效果
常常要使用的显示删除效果: DEMO