我正在尝试使用 crontab 运行脚本,但即使从命令行也无法使其工作。该脚本在浏览器中运行良好,并reports/
在apache
. 脚本文件归我所有:john
.
当我尝试从命令行运行脚本时,我收到以下警告,并且不会创建 excel 文件。我已经尝试过完整的路径,但我得到了相同的结果。
这是我尝试从命令行运行脚本后得到的
public_html]$ php include/tests/mailme.php
PHP Warning: fopen(reports/4-March.xls): failed to open stream: Permission denied in /home/john/public_html/PHPExcel/Shared/OLE/PPS/Root.php on line 90
Warning: fopen(reports/4-March.xls): failed to open stream: Permission denied in /home/john/public_html/PHPExcel/Shared/OLE/PPS/Root.php on line 90
PHP Fatal error: Uncaught exception 'Exception' with message 'Can't open reports/4-March.xls. It may be in use or protected.' in /home/john/public_html/PHPExcel/Shared/OLE/PPS/Root.php:93
Stack trace:
#0 /home/john/public_html/PHPExcel/Writer/Excel5.php(233): PHPExcel_Shared_OLE_PPS_Root->save('reports/...')
#1 /home/john/public_html/include/generate_daily_excel.inc(401): PHPExcel_Writer_Excel5->save('reports/...')
#2 /home/john/public_html/include/tests/mailme.php(41): generateDailyExcel('04-02-2013')
#3 {main}
thrown in /home/john/public_html/PHPExcel/Shared/OLE/PPS/Root.php on line 93
Fatal error: Uncaught exception 'Exception' with message 'Can't open reports/4-March.xls. It may be in use or protected.' in /home/john/public_html/PHPExcel/Shared/OLE/PPS/Root.php:93
Stack trace:
#0 /home/john/public_html/PHPExcel/Writer/Excel5.php(233): PHPExcel_Shared_OLE_PPS_Root->save('reports/...')
#1 /home/john/public_html/include/generate_daily_excel.inc(401): PHPExcel_Writer_Excel5->save('reports/...')
#2 /home/john/public_html/include/tests/mailme.php(41): generateDailyExcel('04-02-2013')
#3 {main}
thrown in /home/john/public_html/PHPExcel/Shared/OLE/PPS/Root.php on line 93
我假设如果我更改 的所有者reports
,将不允许保存浏览器版本。我是 linux 和权利的新手。