dongxing2030 2019-02-16 07:55
浏览 82
已采纳

用于现在工作的PHP上传表单突然不会没有对文件进行更改

After I built this code I ran into issues completely unrelated and moved to a new server. Using the same code and same systems (I installed LAMP onto Fedora 29 after issues with Ubuntu 18.04).

There may be more issues than I know since I never managed to test everything, but, the parts that used to work no longer do.

Running PHP 7.2.15 on my fedora 29 server.

When uploading a file through my website it acted like it was completing the upload. After finding thie error log it pointed to this:

Error was: [16-Feb-2019 07:05:10 UTC] PHP Warning:
move_uploaded_file(../uploads/Photos/2.jpg): failed to open stream: Permission denied in /var/www/html/scripts/upload2.5.php on line 99

Error Log:

[16-Feb-2019 06:20:22 UTC] PHP Notice:  Undefined index: fileToUpload in 
/var/www/html/scripts/upload2.5.php on line 12
[16-Feb-2019 06:20:22 UTC] PHP Notice:  Undefined index: fileToUpload in 
/var/www/html/scripts/upload2.5.php on line 20
[16-Feb-2019 06:20:22 UTC] PHP Notice:  Undefined index: fileToUpload in 
/var/www/html/scripts/upload2.5.php on line 31
[16-Feb-2019 06:21:36 UTC] PHP Warning:  
move_uploaded_file(../uploads/Unsortedmixin_implementation_report.txt): 
failed to open stream: Permission denied in 
/var/www/html/scripts/upload2.5.php on line 132
[16-Feb-2019 06:21:36 UTC] PHP Warning:  move_uploaded_file(): Unable to 
move '/tmp/phpQQrBlj' to 
'../uploads/Unsortedmixin_implementation_report.txt' in 
/var/www/html/scripts/upload2.5.php on line 132
[16-Feb-2019 06:23:14 UTC] PHP Warning:  POST Content-Length of 22843605 
bytes exceeds the limit of 8388608 bytes in Unknown on line 0
[16-Feb-2019 06:23:14 UTC] PHP Notice:  Undefined index: fileToUpload in 
/var/www/html/scripts/upload2.5.php on line 12
[16-Feb-2019 06:23:14 UTC] PHP Notice:  Undefined index: fileToUpload in 
/var/www/html/scripts/upload2.5.php on line 20
[16-Feb-2019 06:23:14 UTC] PHP Notice:  Undefined index: fileToUpload in 
/var/www/html/scripts/upload2.5.php on line 31
[16-Feb-2019 06:26:13 UTC] PHP Warning:  
move_uploaded_file(../uploads/Photos/2.jpg): failed to open stream: 
Permission denied in /var/www/html/scripts/upload2.5.php on line 99
[16-Feb-2019 06:26:13 UTC] PHP Warning:  move_uploaded_file(): Unable to 
move '/tmp/phpwHHrHu' to '../uploads/Photos/2.jpg' in 
/var/www/html/scripts/upload2.5.php on line 99
[16-Feb-2019 06:27:31 UTC] PHP Warning:  
move_uploaded_file(../uploads/Photos/2.jpg): failed to open stream: 
Permission denied in /var/www/html/scripts/upload2.5.php on line 99
[16-Feb-2019 06:27:31 UTC] PHP Warning:  move_uploaded_file(): Unable to 
move '/tmp/phpI4mr5w' to '../uploads/Photos/2.jpg' in 
/var/www/html/scripts/upload2.5.php on line 99
[16-Feb-2019 06:36:09 UTC] PHP Warning:  
move_uploaded_file(../uploads/Photos/2.jpg): failed to open stream: 
Permission denied in /var/www/html/scripts/upload2.5.php on line 99
[16-Feb-2019 06:36:09 UTC] PHP Warning:  move_uploaded_file(): Unable to 
move '/tmp/phpw5vyRB' to '../uploads/Photos/2.jpg' in 
/var/www/html/scripts/upload2.5.php on line 99
[16-Feb-2019 06:53:22 UTC] PHP Warning:  
move_uploaded_file(../uploads/Photos/2.jpg): failed to open stream: 
Permission denied in /var/www/html/scripts/upload2.5.php on line 99
[16-Feb-2019 06:53:22 UTC] PHP Warning:  move_uploaded_file(): Unable to 
move '/tmp/phpXQIpKm' to '../uploads/Photos/2.jpg' in 
/var/www/html/scripts/upload2.5.php on line 99
[16-Feb-2019 07:05:10 UTC] PHP Warning:  
move_uploaded_file(../uploads/Photos/2.jpg): failed to open stream: 
Permission denied in /var/www/html/scripts/upload2.5.php on line 99
[16-Feb-2019 07:05:10 UTC] PHP Warning:  move_uploaded_file(): Unable to 
move '/tmp/phpUS5Izg' to '../uploads/Photos/2.jpg' in 
/var/www/html/scripts/upload2.5.php on line 99
[16-Feb-2019 07:07:33 UTC] PHP Warning:  
move_uploaded_file(../uploads/Photos/2.jpg): failed to open stream: 
Permission denied in /var/www/html/scripts/upload2.5.php on line 99
[16-Feb-2019 07:07:33 UTC] PHP Warning:  move_uploaded_file(): Unable to 
move '/tmp/phpNEl1wC' to '../uploads/Photos/2.jpg' in 
/var/www/html/scripts/upload2.5.php on line 99
[16-Feb-2019 07:08:12 UTC] PHP Warning:  POST Content-Length of 22843605 
bytes exceeds the limit of 8388608 bytes in Unknown on line 0
[16-Feb-2019 07:08:12 UTC] PHP Notice:  Undefined index: fileToUpload in 
/var/www/html/scripts/upload2.5.php on line 12
[16-Feb-2019 07:08:12 UTC] PHP Notice:  Undefined index: fileToUpload in 
/var/www/html/scripts/upload2.5.php on line 20
[16-Feb-2019 07:08:12 UTC] PHP Notice:  Undefined index: fileToUpload in 
/var/www/html/scripts/upload2.5.php on line 31
[16-Feb-2019 07:29:36 UTC] PHP Warning:  POST Content-Length of 22843605 
bytes exceeds the limit of 1024 bytes in Unknown on line 0
[16-Feb-2019 07:29:36 UTC] PHP Notice:  Undefined index: fileToUpload in 
/var/www/html/scripts/upload2.5.php on line 12
[16-Feb-2019 07:29:36 UTC] PHP Notice:  Undefined index: fileToUpload in 
/var/www/html/scripts/upload2.5.php on line 20
[16-Feb-2019 07:29:36 UTC] PHP Notice:  Undefined index: fileToUpload in 
/var/www/html/scripts/upload2.5.php on line 31
[16-Feb-2019 07:42:16 UTC] PHP Warning:  POST Content-Length of 478786 bytes 
exceeds the limit of 1024 bytes in Unknown on line 0
[16-Feb-2019 07:42:16 UTC] PHP Notice:  Undefined index: fileToUpload in 
/var/www/html/scripts/upload2.5.php on line 12
[16-Feb-2019 07:42:16 UTC] PHP Notice:  Undefined index: fileToUpload in 
/var/www/html/scripts/upload2.5.php on line 20
  • 写回答

1条回答 默认 最新

  • drjtua5953 2019-02-16 09:23
    关注

    I found the solution: move_uploaded_file gives "failed to open stream: Permission denied " error after all configurations I did

    Apache didn't have permissions to the folder so I changed it from root to them and it worked out for that issue.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler
  • ¥15 oracle集群安装出bug
  • ¥15 关于#python#的问题:自动化测试
  • ¥20 问题请教!vue项目关于Nginx配置nonce安全策略的问题