简体   繁体   中英

Php : 500 - Internal server error

I have a php script for multiple upload of files. I noticed that when the upload takes more than (about) two minutes I get the following error:

500 - Internal server error. There is a problem with the resource you are looking for, and it cannot be displayed.

Some info:

PHP Version: 5.4.23

System: Windows NT SDADMIN32263436 6.1 build 7601 (Windows Server 2008 R2 Standard Edition Service Pack 1) i586

Any tips?

Thank you

By default PHP only allows upload of files a couple of meg big. You could try changing the following directives in the php.ini file ....

memory_limit = 32M
upload_max_filesize = 24M
post_max_size = 32M

Obviously use values that are appropriate to you.

It could however not be linked to the upload size at all. As PHP is server side, the 500 error is incredibly generic. You can try looking at your PHP log files (you can do this on IIS through server 2008).

It might also help you to turn on some error catching in your application. For development, one way to do this is to put the following at the top of your PHP script

ini_set('display_startup_errors',1);
ini_set('display_errors',1);
error_reporting(-1);

This will mean PHP will show any errors it encounters in the browser. It is NOT a good idea to this in production though, as it can give sensitive information about your server and hosting out.

I refer to this question . This user seems to have the same problem of yours and in this answer he was suggested make some changes in the configuration file:

" max_execution_time " integer

This sets the maximum time in seconds a script is allowed to run before it is terminated by the parser. This helps prevent poorly written scripts from tying up the server. The default setting is 30. When running PHP from the command line the default setting is 0.

The maximum execution time is not affected by system calls, stream operations etc. Please see the " set_time_limit() " function for more details.

[...]

" max_input_time " integer

This sets the maximum time in seconds a script is allowed to parse input data, like POST, GET and file uploads .

[...]

Additionally here's some info on checking/setting CGI Timeout in IIS5 and 6 .

I also suggest you to check the PHP error logs in order to retrieve more information about the upload execution.

Finally in this question and this question they also talk about the IIS configuration in order to allow PHP to make bigger uploads.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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