PHP Cron Problems - using plesk: dynamic library, open_basedir

萝らか妹 提交于 2019-12-12 02:29:01

问题


I entered the following command through plesk (control panel) crontab, to run a php file once an hour:

php httpdocs/cron/script.php

And I am getting the following 2 error messages (once an hour, to my email):

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

Note: Line 2 has require_once(../include/functions.php);

I realized these are 2 different issues. I tried solving each separately and they are both still with me. Any help would be appreciated. Thanks


回答1:


When you run PHP like this, configuration set in Plesk-specific and Apache-specific places like vhost.conf doesn't apply.

Since your script is already inside httpdocs, why don't you just use wget/curl to invoke the script through HTTP? Something like /usr/bin/curl http://yoursite.com/cron/script.php 2>&1. Might want to consider some additional validation (IP limiting, htpasswd auth) to make sure random visitors (script kiddies) can't run it.




回答2:


Please check below, maybe it will help you.
http://www.geeklog.net/forum/viewtopic.php?showtopic=28107



来源:https://stackoverflow.com/questions/9460614/php-cron-problems-using-plesk-dynamic-library-open-basedir

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!