gpt4 book ai didi

使用完整路径时出现 php-cli 错误

转载 作者:行者123 更新时间:2023-11-30 22:00:52 24 4
gpt4 key购买 nike

我在 ubuntu 上使用 php 5.6,但是当我运行命令 php/var/www/html/export-sftp-bg.php 时,我得到了

PHP Fatal error: Uncaught exception 'Exception' with message 'File doesn't exist' in /var/www/html/inc/vendor/faisalman/simple-excel-php/src/SimpleExcel/Parser/BaseParser.php:174 Stack trace:

0 /var/www/html/inc/vendor/faisalman/simple-excel-php/src/SimpleExcel/Parser/CSVParser.php(38): SimpleExcel\Parser\BaseParser->isFileReady(false)

1 /var/www/html/inc/functions.php(1448): SimpleExcel\Parser\CSVParser->loadFile(false)

2 /var/www/html/export-sftp-bg.php(10): export_existing_campaign('Yml=', Object(SimpleExcel\SimpleExcel), Object(NotORM), '/var/www/html/e...')

3 {main} thrown in /var/www/html/inc/vendor/faisalman/simple-excel-php/src/SimpleExcel/Parser/BaseParser.php on line 174

但我可以使用 cd/var/www/html 运行该文件然后 php export-sftp-bg.php

最佳答案

试试这个

sudo -u www-data php /var/www/html/export-sftp-bg.php

尝试从命令行在 ubuntu 中以 apache 用户身份运行 php。

更改您的文件权限您应该以 root 身份运行脚本(不推荐),或者更改文件权限:

  sudo chown ubuntu:www-data file
sudo chmod 664 file

你应该对目录做几乎相同的事情:

  sudo chown ubuntu:www-data -R dir
sudo chmod 775 -R dir

关于使用完整路径时出现 php-cli 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43415619/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com