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 ...
随机推荐
- Solr auto commit 配置
为了解决写索引时频繁提交带来的效率问题,考虑使用自动提交. 在solrconfig.xml中增加以下代码: <updateHandler class="solr.DirectUpdat ...
- C# 使用Trace记录程序日志
在程序开发中,我们通常需要记录程序运行的状态,在程序部署后,发生的异常可以记录在日志中,便于发现程序潜在的问题.在.NET平台,有很多优秀的日志类库,例如Log4Net.如果程序很小,我们可以自己通过 ...
- C语言判断文件是否存在(转)
int access(const char *filename, int amode); amode参数为0时表示检查文件的存在性,如果文件存在,返回0,不存在,返回-1. 这个函 ...
- Win 10 开发中Adaptive磁贴模板的XML文档结构,Win10 应用开发中自适应Toast通知的XML文档结构
分享两篇Win 10应用开发的XML文档结构:Win 10 开发中Adaptive磁贴模板的XML文档结构,Win10 应用开发中自适应Toast通知的XML文档结构. Win 10 开发中Adapt ...
- 长按事件jquery mobile
chat_enlarge.addEventListener('touchend', function(event) { if(fingers == 1){ event.preventDefault() ...
- app分享时判断手机是否已安装微信或QQ客户端
/** * 判断 用户是否安装微信客户端 */ public static boolean isWeixinAvilible(Context context) { final PackageManag ...
- 【MySQL 忘记密码】MySQL忘记密码怎么解决 mysql5.5 windows7
---恢复内容开始--- 如果MySQL 长久不使用,忘记密码,怎么解决??? 1.首先,需要在任务管理器关闭mysql相关的服务进程 2.cmd,进入DOS窗口,进入到mysql的安装路径的bin目 ...
- select 框option添加属性 js计算价格 保持两位小数
<select name="" id=""> <volist name="v['childList']" id=" ...
- POJ 2750 Potted Flower (线段树区间合并)
开始懵逼找不到解法,看了网上大牛们的题解才发现是区间合并... 给你n个数形成一个数列环,然后每次进行一个点的修改,并输出这个数列的最大区间和(注意是环,并且区间最大只有n-1个数) 其实只需要维护 ...
- SpringMyBatis解析3-MapperFactoryBean
在使用mybatis的时候,我们获取dao的方式一般是这样: SqlSession session=sessionFactory.openSession(); PersonDao personDao= ...