PHP Cron问题-使用plesk:动态库,open_basedir


PHP Cron Problems - using plesk: dynamic library, open_basedir

我通过plesk(控制面板)crontab输入了以下命令,以每小时运行一次php文件:

php httpdocs/cron/script.php

我收到以下2条错误消息(每小时一次,发送到我的电子邮件):

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/http.so' -
/usr/lib/php/modules/http.so: cannot open shared object file: No such file or directory in
Unknown on line 0
PHP Warning:  require_once(): open_basedir restriction in effect.
File(../include/functions.php) is not within the allowed path(s):
(/var/www/vhosts/basedomain.com:/tmp) in /var/www/vhosts/example.com/httpdocs/cron/script.php
on line 2
PHP Warning:  require_once(../include/functions.php): failed to open stream: Operation not
permitted in /var/www/vhosts/example.com/httpdocs/cron/script.php on line 2
PHP Fatal error:  require_once(): Failed opening required '../include/functions.php'
(include_path='.:') in /var/www/vhosts/example.com/httpdocs/cron/script.php on line 2

注:2号线有require_once(../include/functions.php);

我意识到这是两个不同的问题。我试着分别解决每一个问题,但他们仍然和我在一起。任何帮助都将不胜感激。感谢

当你像这样运行PHP时,在Plesk特定和Apache特定的地方(如vhost.conf)设置的配置不适用。

既然您的脚本已经在httpdocs中,为什么不使用wget/ccurl通过HTTP调用脚本呢?类似/usr/bin/curl http://yoursite.com/cron/script.php 2>&1的东西。可能需要考虑一些额外的验证(IP限制,htpasswd auth),以确保随机访问者(脚本儿童)不能运行它。

请查看下面的内容,也许它会对您有所帮助
http://www.geeklog.net/forum/viewtopic.php?showtopic=28107