4

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.

Passerby
  • 9,715
  • 2
  • 33
  • 50
Highly Flammable
  • 45
  • 1
  • 1
  • 4
  • 3
    Why do you think the problem has anything to do with those settings? What does the error log on the server say? – Barmar Jul 16 '13 at 06:45
  • can you get the error message from apache error log? – bansi Jul 16 '13 at 06:45
  • 1
    because i can upload small photos <100kb and not larger. – Highly Flammable Jul 16 '13 at 06:46
  • the error message "Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, webmaster@xxxxxxxx.gr and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log." – Highly Flammable Jul 16 '13 at 06:46
  • this error you already posted. can you get the message from web server error log? – bansi Jul 16 '13 at 06:48
  • i have access to the web server but dont know how to get it... – Highly Flammable Jul 16 '13 at 06:52
  • if your OS is linux it is typically at /var/log/httpd/error_log. You can run command `tail -f /var/log/httpd/error_log` then press couple of enters and then load your page. You can see the error emssages scroll up. Press Ctrl+C to exit tail. – bansi Jul 16 '13 at 06:54
  • my OS is windows server standard and i am running linux server via hyper-v manager – Highly Flammable Jul 16 '13 at 07:00
  • you can get the error log file location from the `ErrorLog` Directive in the apache error log. Also do a test of running a simple page with `phpinfo()` to test if PHP is working. – bansi Jul 16 '13 at 07:04
  • cant find the error log.its not in the windows server,i guess its in the vhd and dont know how to access it.php is working properly,i tested it with info.php – Highly Flammable Jul 16 '13 at 07:24
  • [Tue Jul 16 02:24:47 2013] [warn] [client 46.246.211.24] mod_fcgid: HTTP request length 132524 (so far) exceeds MaxRequestLen (131072), this is the error causing the problem – Highly Flammable Jul 16 '13 at 07:42

4 Answers4

5

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.

bansi
  • 55,591
  • 6
  • 41
  • 52
  • you are right! i added this "FcgidMaxRequestLen 2000000" in the apache directory and it works. thanks! – Highly Flammable Jul 17 '13 at 06:53
  • 1
    what if FastCGI is disabled on the server? I don't have FastCGI enabled and still getting Internal Server Error – Assad Nazar Feb 01 '17 at 12:36
  • Yes! I'm increased `upload_max_filesize = 20M`, `post_max_size = 80M`, `memory_limit = 512M` but still not working for upload a file size 10.9MB. My `FcgidMaxRequestLen` was `8131072` which is around 8 MB. Increase this value and everything Works!! Thank you. – vee Nov 12 '20 at 17:28
1

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

sudip
  • 2,781
  • 1
  • 29
  • 41
0

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

cssyphus
  • 37,875
  • 18
  • 96
  • 111
0

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

George
  • 11
  • 1