开发者

php upload settings in a portable web application

I'm building a web app dealing with online file storage/access. In my local environment I used .htaccess to set

php_value upload_max_filesize 100M
php_value post_max_size 101M

After testing the app on a variety of servers I found that not all setups allow you to use the .htaccess method of modifying the ini settings. The solution I'm thinking of is to check for that permission during the install script and depending on what is allowed use either .htaccess, user directory php.ini, or ini_set(); for that particular installation.

ini_set() apparently doesn't work for post_max_upload. For some reason even though my php.ini has user_ini.filename = ".user.ini" it won't read the 2 directives in that file. Neither will it read the same information in the application directory named php.ini And the .htaccess directives stated above result in a 500 Sever Misconfiguration Error. There's has to be a way to change the post_max_upload and upload_max_filesize o开发者_StackOverflow社区n the fly.

The problem is that i don't know how to check for what is and isn't allowed on a particular server. Can someone help with that?


Your max execution time may be cutting the upload process short..

This is what I use in my admin area .htaccess -- maybe you can try these settings.

Don't use these settings globally, only set them for the .htaccess that has your upload or admin scripts isolated from the rest of your site, or else you might encounter problems with such a high amount of execution time.

php_value upload_max_filesize 30M
php_value post_max_size 30M
php_value max_execution_time 600
php_value max_input_time 200

If you can't get anything working perhaps your host has disabled .htaccess and ini setting changes...


One possible issue here is that I was trying to add the 2 lines in the original post to a php.ini file by themselves. Perhaps this is basic for some, but apparently you can't do that? It seems that you need to redeclare all of the rest of the php.ini settings into a directory-specific php.ini, and then just change the applicable lines.

This seems kind of a funky way to do things, though, so maybe I'm wrong... Can anyone tell me with more confidence that indeed this is the case, or that I'm mistaken?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜