当通过cron运行时,php exec tar调用失败,通过shell运行
有人能解释为什么这一行在从shell调用时工作,但在通过crontab调用时失败吗当通过cron运行时,php exec tar调用失败,通过shell运行,php,exec,tar,Php,Exec,Tar,有人能解释为什么这一行在从shell调用时工作,但在通过crontab调用时失败吗 passthru("tar xvf $file $tarfile/application $tarfile/application_detail $tarfile/application_device_type $tarfile/genre_application"); } cron被删除后我收到的电子邮件错误 tar:itunes20100907/应用程序: 无法打开:没有这样的文件或目录 itunes201
passthru("tar xvf $file $tarfile/application $tarfile/application_detail $tarfile/application_device_type $tarfile/genre_application");
}
cron被删除后我收到的电子邮件错误
tar:itunes20100907/应用程序:
无法打开:没有这样的文件或目录
itunes20100907/应用程序详细信息
正如错误所说,您一定是在错误的目录中。您应该使用规范路径
注意:启用时,您只能在中执行文件。出于实际原因,目前不允许有。。可执行文件路径中的组件
您可以使用PHP中的
getcwd()
函数来找出脚本运行的路径。对于cron作业,它可能是cron用户的主文件夹。如果是/home/ubuntu/,那么路径itunes20100907/application将被解释为/home/ubuntu/itunes20100907/application