php upload and internal server error

我们两清 提交于 2019-11-28 08:22:01

问题


i am using an html form with php to upload data to mysql.

the form is working properly when i am using it on my laptop (wamp) but when i uploaded the site on my dedicated server (ispconfig) get this error

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

i tried changing the values of the php.ini in

post_max_size  64M
upload_max_filesize 64M
max_input_time 3000
max_execution_time 3000

and the ones in the apache also in

memory_limit 96M
post_max_size 64M
upload_max_filesize 64M

but i still cant upload.

thank you for reading this.


回答1:


You need to increase FcgidMaxRequestLen in httpd.conf file

use something like

FcgidMaxRequestLen 67108864

From FcgidMaxRequestLen Directive

Warning

Before 2.3.6, this defaulted to 1GB. Most users of earlier versions should use this directive to set a more reasonable limit.




回答2:


The accepted answer is correct. To be more specific, you need to add the code in httpd.conf file :

# Work around annoying fcgid limitations
<IfModule mod_fcgid.c>
  # 20MB should be enough
  MaxRequestLen 20000000
</IfModule>

You may check the full article here : http://pivica.me/blog/500-internal-server-error-while-uploading-files-bigger-then-100kb-modfcgid-problem




回答3:


Note that a syntax error in a php/ajax processing script could report as an "internal server error".

For example, I was using Ravishanker Kusuma's jQuery Upload File plugin and was getting this message.

Turns out it was just a missing ) in an (unused) function inside my code in the PHP processor file specified by the AJAX script. When a file was uploaded, this script would be called, the script would break inside the unused function, and this is the error it would report.

FWIW




回答4:


None of the solutions above worked for me. For CentOS users with Plesk Pannel follow the next steps

Change this value in the template

# grep -ir FcgidMaxRequestLen /usr/local/psa/admin/conf/templates/default/domain/domainVirtualHost.php FcgidMaxRequestLen 16777216

# sed -i 's/FcgidMaxRequestLen 16777216/FcgidMaxRequestLen 1073741824/g' /usr/local/psa/admin/conf/templates/default/domain/domainVirtualHost.php

# grep -ir FcgidMaxRequestLen /usr/local/psa/admin/conf/templates/default/domain/domainVirtualHost.php FcgidMaxRequestLen 1073741824

Rebuild the virtualhost configurations.

# /usr/local/psa/admin/bin/httpdmng --reconfigure-all # /usr/local/psa/admin/bin/httpdmng --reconfigure-server

https://support.plesk.com/hc/en-us/articles/213955145-Unable-to-upload-large-files-via-PHP-HTTP-request-length-exceeds-MaxRequestLen



来源:https://stackoverflow.com/questions/17669712/php-upload-and-internal-server-error

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!