tags:

views:

988

answers:

3

I have an app that is failing on the install. The vendor says I probably have ini_set() disabled. How can I check this?

A: 

You might want to take a look at the CHANGEABLE directives in php.ini: http://us3.php.net/manual/en/ini.php#ini.list

In regard to verify whether an ini_set function worked, you can check the return value to make certain that it worked: http://us3.php.net/manual/en/function.ini-set.php

The code would look something like this:

<?php
     if(ini_set('error_reporting', 'ALL') === false)
     {
         // Perform failure handling logic
     }
?>
Noah Goodrich
A: 

You could check the disable_functions setting in your php.ini file. That's pretty much the only thing I can think of. I doubt it would be set, though, unless you're running on shared hosting or something like that.

You might also want to check if the relevant setting is specified using php_admin_flag or php_admin_value in your Apache config, as those will effectively "lock" the setting and keep ini_set() from changing it.

+2  A: 

I did some research on this, and it turns out that sometimes ini_set will not return FALSE, but an empty string. This is mentioned in the URL pointed out by gabriel1836. The best way to check if it works is to first check the disable_functions flag in php.ini to see if it is disabled, and then (if it is not disabled), change a value with it, and echo phpinfo() immediately after. If the value is changed under the local column, then you know ini_set works.

hal10001