How to Alter PHP Apache Module Configuration Settings

When you are making use of PHP as a module for Apache, you could make use of the directives in files used for configuring Apache, to change the settings used for configuring it. Some examples are the files htaccess and httpd.conf. In order to do this, you will be needing the two privileges: The "AllowOverride All" and "AllowOverride Options".

Also, there are a set of directives of Apache which would give you room to change the configurations for PHP from inside the files used in configuring Apache. You can do this with the files below:

The php_value name value:

This is used to set the selected directive value and you can utilize it only with directives of the PHP_INI_ALL and PHP_INI_PERDIRtype. To be able to delete a value which you set earlier, in the b=value space, put none. You should also take great care to avoid putting  php_value  when you configure the values for Boolean, you should  make use of the php_flag as shown below:

The php_flag name on|off:

You can utilize this when you wish to set a configuration directive for Boolean. Note that you can only utilize this with the directives of PHP_INI_ALL and PHP_INI_PERDIR type that you can use it.

The php_admin_value name value:

This is used to set the specified directive value. Note that you cannot make use of this in any files of .htaccess and either ini set () or .htaccess can’t override any type of directive which has been set using php_admin_value. Also, in order to delete a value which has been set previously, insert the new value as “none”.

The php_admin_flag name on|off:

This is made use of when you wish to wish to set a configuration directive for Boolean. You should take care to note that you cannot use this in any file of ".htaccess". Also, ini set () or .htaccess can’t override any type of directive which has been set using php_admin_flag.

An Illustration to Show You How to Configure Apache

<IfModule mod_php5.c>
php_valueinclude_path".:/usr/local/lib/php"
php_admin_flag engine on
</IfModule>
<IfModule mod_php4.c>
php_valueinclude_path".:/usr/local/lib/php"
php_admin_flag engine on
</IfModule>

Be Cautious of the Following:

Note that you cannot find any PHP constants outside PHP. An example is when you can’t use the PHP constants like the"E_ALL or E_NOTICE " when setting the directive used for reporting errors in httpd.conf due to the fact that they won’t make any sense and will produce a “0” evaluation. Instead, make use of values associated to bitmask. You can only utilize it in php.ini.

How To Alter PHP Configuration Utilizing Windows Registry

The Windows Registry can be used when in modifying the values used in configurations on a per-directory pattern when PHP is run on the Windows platform. It is in the registry key, "HKLMSOFTWAREPHPPer Directory Values" that the values used in configurations are stored and then, in those sub-keys which correspond to the names of the path.

An illustration of this is when you are storing the values used in configuring the directory, "c:inetpubwwwroot ", they will go to the key

"HKLMSOFTWAREPHPPer Directory Valuescinetpubwwwroot".

Thus, it will cause the directory settings in being active for whichever script that runs from any of its subdirectory or directory. Those values that are under the key is mandated to make use of both the configuration directive’s name for the PHP and the name of the string value.

There is also no parsing of the constants of the PHP that are in the values. Hence, it is only the values used in configurations that are changeable in PHP_INI_USER that have this setting, the values of PHP_INI_PERDIRcan have this setting.

Other Interfaces To PHP

Through using ini set(), despite how PHP is run, there are some particular values that you can make changes to at your script’s runtime. If you wish to get on your device, a comprehensive settings list for configurations and those of their values currently updated, make use of the function “ phpinfo()” and ensure the page which appears is reviewed. Also, you can use the “get cfgvar"or the "ini get()”to gain access to the individual directives’ values, used in configurations at runtime

Conclusion

This article provided you with tips on how you can configure PHP in Apache and how you can alter PHP module in Window registry. You should be able to replicate these steps if you followed the steps and tips strictly. Still having issues, don’t be disheartened. We are here to answer all the questions you may have and see that your problem is properly handled.

Check out these top 3 Windows hosting services:

Was this article helpful?