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 ...
随机推荐
- 5-06使用Sql 语句为表添加约束
约束名的命名规则推荐采用:约束类型_约束列. 为用户表添加约束 ALTER TABLE UserInfo ADD CONSTRALNT PK_UserId PRIMATY REY(UserId) CO ...
- PMP 第十三章 项目干系人管理
1.识别干系人是干什么?早期就识别干系人的原因是什么?识别干系人的输入和工具有哪些?干系人分析的几种模型是哪些?干系人登记册的内容有哪些?bbs.mypm.net 2.干系人参与程度的分类是怎样的?干 ...
- office excel 装Visual Studio后报错解决方案
安装完vs后,vs会向office安装COM加载项,但是在启动Excel时会发生弹出此加载项安装出错的消息,如下图. 名称: 从: file:///D:/Program Files (x86)/Mic ...
- 通过jquery-qrcode在线生成二维码
随着移动互联网的发展,二维码现在应用得越来越广泛了,随手扫扫就可以浏览网站.加个好友什么的,比起手工输入真的是方便太多了. 前期做了一个综合测评系统,考虑逐步实现移动化,一长串的IP地址用户输入也不方 ...
- 在Salesforce中对某一个Object添加 Validation Rule
在Salesforce中可以对某一个Object添加相应的 Validation Rule 来进行一个全局的条件判断,比如满足什么样的条件的修改允许提交,不满足的要提示相应的错误信息. 要创建一个Va ...
- linux下epoll如何实现高效处理百万句柄的
linux下epoll如何实现高效处理百万句柄的 分类: linux 技术分享 2012-01-06 10:29 4447人阅读 评论(5) 收藏 举报 linuxsocketcachestructl ...
- loadrunner通过C语言实现字符的替换(只能替换单个字符,慎用)
如果按照普通的定义字符串就会出现以下错误: 解决方法如下: 将双引号改成单引号: lr_searchReplace(abc,"test",' ','+'); Action也可以这些 ...
- Liferay 6.2 改造系列之四:重新整理Application添加页面默认提供的Portlet清单
经过2.3两步后,剩余Portlet已经不多,添加Application页面如下: 将用不到的Portlet隐藏起来:11 Portal目录 (Portal Directory) 将内嵌Protl ...
- Linux使用du和df查看磁盘和文件夹占用空间
df df可以查看一级文件夹大小.使用比例.档案系统及其挂入点,但对文件却无能为力. df -lh 参数 -h 表示使用「Human-readable」输出,也就是使用 GB.MB 等易读的格式. $ ...
- FFmpeg与libx264 x264接口源代码简单分析
源代码位于“libavcodec/libx264.c”中.正是有了这部分代码,使得FFmpeg可以调用libx264编码H.264视频. 从图中可以看出,libx264对应的AVCodec结构体ff ...