简体   繁体   English

php上传和内部服务器错误

[英]php upload and internal server error

i am using an html form with php to upload data to mysql. 我正在使用带有php的html表单将数据上传到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 当我在我的笔记本电脑(wamp)上使用它时,表单工作正常但是当我在我的专用服务器(ispconfig)上传网站时出现此错误

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 我试着改变php.ini的值

post_max_size  64M
upload_max_filesize 64M
max_input_time 3000
max_execution_time 3000

and the ones in the apache also in 而apache中的那些也在

memory_limit 96M
post_max_size 64M
upload_max_filesize 64M

but i still cant upload. 但我仍然无法上传。

thank you for reading this. 谢谢您阅读此篇。

You need to increase FcgidMaxRequestLen in httpd.conf file 您需要在httpd.conf文件中增加FcgidMaxRequestLen

use something like 使用类似的东西

FcgidMaxRequestLen 67108864

From FcgidMaxRequestLen Directive 来自FcgidMaxRequestLen指令

Warning 警告

Before 2.3.6, this defaulted to 1GB. 在2.3.6之前,这个默认为1GB。 Most users of earlier versions should use this directive to set a more reasonable limit. 早期版本的大多数用户应使用此指令设置更合理的限制。

The accepted answer is correct. 接受的答案是正确的。 To be more specific, you need to add the code in httpd.conf file : 更具体地说,您需要在httpd.conf文件中添加代码:

# 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 你可以在这里查看完整的文章: http//pivica.me/blog/500-internal-server-error-while-uploading-files-bigger-then-100kb-modfcgid-problem

Note that a syntax error in a php/ajax processing script could report as an "internal server error". 请注意,php / ajax处理脚本中的语法错误可能会报告为“内部服务器错误”。

For example, I was using Ravishanker Kusuma's jQuery Upload File plugin and was getting this message. 例如,我正在使用Ravishanker Kusuma的jQuery上传文件插件 ,并收到此消息。

Turns out it was just a missing ) in an (unused) function inside my code in the PHP processor file specified by the AJAX script. 原来它只是一个缺失的)在我的代码中的一个(未使用的)函数中,由AJAX脚本指定的PHP处理器文件。 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 FWIW

None of the solutions above worked for me. 以上解决方案都不适合我。 For CentOS users with Plesk Pannel follow the next steps 对于使用Plesk Pannel的CentOS用户,请按照以下步骤操作

Change this value in the template 在模板中更改此值

# grep -ir FcgidMaxRequestLen /usr/local/psa/admin/conf/templates/default/domain/domainVirtualHost.php FcgidMaxRequestLen 16777216 #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 #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 #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 #/ 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://support.plesk.com/hc/en-us/articles/213955145-Unable-to-upload-large-files-via-PHP-HTTP-request-length-exceeds-MaxRequestLen

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM