How can i check if server configuration allows me to set an option like:
ini_set('upload_max_filesize', '8M');
in a PHP script? Here is a list of php.ini directives but i can’t really figure out how to make a check before tring to change that value.
Check if I’m allowed to use
ini_setfor someoption, how?ini_setwill return the old value on success, andfalse* on failure. With this knowledge you can write a statement checking if your call went through, like the below.(*): Note the return value changed in PHP 5.3.0 from
''(an empty string) tofalse. So you need to check your current PHP version as well.Another method is to use
ini_get_allwhich will provide you with details regarding every option available, and it’s access level.I’d like to disable the use of
ini_setfor some option(s), how?There are a few methods of making options unchangeable runtime (in a way disabling
ini_set), among them are the following two which you can read more about at the provided link.Example (taken from this documentation)