PHP错误在cronjob,工作正常提示 [英] PHP Errors on a cronjob, works fine at prompt

查看:130
本文介绍了PHP错误在cronjob,工作正常提示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在cronjob上运行以下脚本...

I am running the following script on a cronjob...

cd /etc/parselog/
php run_all.php >/dev/null

,并得到以下错误:

[05-May-2009 20:30:12] PHP Warning:  PHP Startup: Unable to load dynamic library './pdo.so' - ./pdo.so: cannot open shared object file: No such file or directory in Unknown on line 0
[05-May-2009 20:30:12] PHP Warning:  PHP Startup: Unable to load dynamic library './mysql.so' - ./mysql.so: cannot open shared object file: No such file or directory in Unknown on line 0
[05-May-2009 20:30:12] PHP Warning:  PHP Startup: Unable to load dynamic library './mysql.so' - ./mysql.so: cannot open shared object file: No such file or directory in Unknown on line 0
[05-May-2009 20:30:12] PHP Warning:  PHP Startup: Unable to load dynamic library './mysqli.so' - ./mysqli.so: cannot open shared object file: No such file or directory in Unknown on line 0
[05-May-2009 20:30:12] PHP Warning:  PHP Startup: Unable to load dynamic library './odbc.so' - ./odbc.so: cannot open shared object file: No such file or directory in Unknown on line 0
[05-May-2009 20:30:12] PHP Warning:  PHP Startup: Unable to load dynamic library './pdo.so' - ./pdo.so: cannot open shared object file: No such file or directory in Unknown on line 0
[05-May-2009 20:30:12] PHP Warning:  PHP Startup: Unable to load dynamic library './pdo_mysql.so' - ./pdo_mysql.so: cannot open shared object file: No such file or directory in Unknown on line 0
[05-May-2009 20:30:12] PHP Warning:  PHP Startup: Unable to load dynamic library './pdo_odbc.so' - ./pdo_odbc.so: cannot open shared object file: No such file or directory in Unknown on line 0
[05-May-2009 20:30:12] PHP Warning:  PHP Startup: Unable to load dynamic library './pdo_sqlite.so' - ./pdo_sqlite.so: cannot open shared object file: No such file or directory in Unknown on line 0
[05-May-2009 20:30:12] PHP Fatal error:  Call to undefined function mysql_connect() in /etc/parselog/stats_downloads.php on line 5

这是我的$ PATH字符串在提示符:

This is my $PATH string at the prompt:

$PATH = /usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin


$ b b

有任何想法或建议吗?我确定当运行cronjob,它没有lib路径或包括任何东西。我甚至尝试添加确切的路径

Any ideas or suggestions? I am certain when running the cronjob, it does not have a lib path or something included. I even tried adding the exact path

推荐答案

提示1:确保您在cron作业中具有完全相同的$ PATH: p>

Tip 1: Ensure you have exactly the same $PATH in the cron job:

cd /etc/parselog/
export PATH=/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin
php run_all.php >/dev/null

提示2:确保所有其他环境变量匹配。使用命令 env 转储环境,并将相应的导出添加到cron作业。

Tip 2: Make sure all other environment variables match as well. Dump the environment with the command env, and add the corresponding exports to your cron job.

这篇关于PHP错误在cronjob,工作正常提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆