I have a single PHP script on a single site that requires me to set the upload size maximum fairly high. I would prefer not to do this globally.

According to the PHP docs, I can not set the values for some variable such as post_max_size , max_file_uploads or upload_max_filesize using ini_set. I've seen a number of solutions here running PHP on a UNIX box or on Windows running Apache, but none that are clear to me using IIS.

My understanding is that there is a way for me to have a custom php.ini file to override specific php.ini value.

Ideally, I would love to have a php.ini file in the folder with that one script that looks something like this:

post_max_size = 200M
max_file_uploads = 5
upload_max_filesize = 200M

How can I accomplish this without setting the values globally on my server?



It's certainly possible to use different PHP settings for a specific website or to even use a different version of PHP per website. An article titled Using FastCGI to Host PHP Applications on IIS 7 by Ruslan Yakushev on IIS.net explains how to set it up. It also contains other useful tips on how to set it up securely.

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.