php 运行时 is not writable、open_basedir restriction in effect
来源:互联网 发布:南通大学网络教学平台 编辑:程序博客网 时间:2024/05/29 10:30
在命令行运行php时,如果命令中有文件操作,经常会出现如下错误。
PHP Warning: realpath(): open_basedir restriction in effect. File(/a/apps/linuxdef/composer) is not within the allowed path(s): (/tmp/) in - on line 626PHP Warning: is_writeable(): open_basedir restriction in effect. File(/a/apps/linuxdef/composer) is not within the allowed path(s): (/tmp/) in - on line 628The installation directory "/a/apps/linuxdef/composer" is not writable
这是因为php.ini中open_basedir可将用户访问文件的活动范围限制在指定的区域。
可用符号”.”来代表当前目录。注意用open_basedir指定的限制实际上是前缀,而不是目录名 。
举例来说: 若”open_basedir = /dir/user”, 那么目录 “/dir/user” 和 “/dir/user1”都是
可以访问的。所以如果要将访问限制在仅为指定的目录,请用斜线结束路径名。例如设置成:
“open_basedir = /dir/user/”
open_basedir也可以同时设置多个目录, 在Windows中用分号分隔目录,在任何其它系统中用
冒号分隔目录 。当其作用于Apache模块时,父目录中的open_basedir路径自动被继承。
有三种方法可以在Apache中为指定的用户做独立的设置:
(a) 在Apache的httpd.conf中Directory的相应设置方法:
php_admin_value open_basedir /usr/local/apache/htdocs/
设置多个目录可以参考如下:
php_admin_value open_basedir /usr/local/apache/htdocs/:/tmp/
(b) 在Apache的httpd.conf中VirtualHost的相应设置方法:
php_admin_value open_basedir /usr/local/apache/htdocs/
设置多个目录可以参考如下:
php_admin_value open_basedir /var/www/html/:/var/tmp/
最能解决一切问题的是 加一个/
阅读全文
0 0
- php 运行时 is not writable、open_basedir restriction in effect
- open_basedir restriction in effect
- linux 下搭建Nginx+php报错open_basedir restriction in effect. File(/var/www/html/index.php) is not within
- phpnow:open_basedir restriction in effect;file is not within the allowed path的解决办法
- open_basedir restriction in effect. File() is not within the allowed path(s)
- 解决 php 报错 open_basedir restriction in effect
- php错误提示 open_basedir restriction in effect 解决
- php错误提示 open_basedir restriction in effect 解决
- Warning: session_start() [function.session-start]: open_basedir restriction in effect. File(F:/Windows/TEMP/) is not within the
- open_basedir restriction in effect错误的解决办法
- linux 下出现:open_basedir restriction in effect
- require(): open_basedir restriction in effect. File
- Warning: require(): open_basedir restriction in effect.
- Warning: require(): open_basedir restriction in effect.
- open_basedir restriction in effect错误解决方法
- 使用APMServ配置zend framework时出现open_basedir restriction in effect问题
- open_basedir restriction in effect的错误及其解决办法
- Warning: file_exists(): open_basedir restriction in effect. File 错误的解决办法
- [技巧]标准IO重定向
- 使用反射在 ArrayList<Integer> 集合中添加一个字符串数据;
- UVa 1451 Average——斜率优化
- JAVA概述
- [技巧]Programming experience
- php 运行时 is not writable、open_basedir restriction in effect
- 桌面网站与手机网站
- Java操作redis,对redis进行增删查改等操作
- #715 – 在Canvas中使用Thumb控件实现拖动目标的功能(Using the Thumb Control to Drag Objects on a Canvas)
- [开发]Linux平台下的C++开发(搭建环境)
- SENSOR------驱动简介:
- python机器学习实战6:利用adaBoost元算法提高分类性能
- 原码、补码、反码
- 2017上海金马五校程序设计竞赛 E:Find Palindrome