BowerStudios.com

  • My Lab
  • Family
  • Friends
  • Professional
  • About
Home

Running PHP as an Apache module

daniel —Thu, 02/15/2007 - 8:52pm

  • BSD

How to change configuration settings
Running PHP as an Apache module

When using PHP as an Apache module, you can also change the configuration settings using directives in Apache configuration files (e.g. httpd.conf) and .htaccess files. You will need "AllowOverride Options" or "AllowOverride All" privileges to do so.

With PHP 4 and PHP 5, there are several Apache directives that allow you to change the PHP configuration from within the Apache configuration files. For a listing of which directives are PHP_INI_ALL, PHP_INI_PERDIR, or PHP_INI_SYSTEM, have a look at the List of php.ini directives appendix.

Note: With PHP 3, there are Apache directives that correspond to each configuration setting in the php3.ini name, except the name is prefixed by "php3_".

php_value name value

Sets the value of the specified directive. Can be used only with PHP_INI_ALL and PHP_INI_PERDIR type directives. To clear a previously set value use none as the value.

Note: Don't use php_value to set boolean values. php_flag (see below) should be used instead.

php_flag name on|off

Used to set a boolean configuration directive. Can be used only with PHP_INI_ALL and PHP_INI_PERDIR type directives.
php_admin_value name value

Sets the value of the specified directive. This can not be used in .htaccess files. Any directive type set with php_admin_value can not be overridden by .htaccess or virtualhost directives. To clear a previously set value use none as the value.
php_admin_flag name on|off

Used to set a boolean configuration directive. This can not be used in .htaccess files. Any directive type set with php_admin_flag can not be overridden by .htaccess or virtualhost directives.

Example 9-2. Apache configuration example

php_value include_path ".:/usr/local/lib/php"
php_admin_flag safe_mode on

php_value include_path ".:/usr/local/lib/php"
php_admin_flag safe_mode on

php3_include_path ".:/usr/local/lib/php"
php3_safe_mode on

Caution

PHP constants do not exist outside of PHP. For example, in httpd.conf you can not use PHP constants such as E_ALL or E_NOTICE to set the error_reporting directive as they will have no meaning and will evaluate to 0. Use the associated bitmask values instead. These constants can be used in php.ini

  • Log in to post comments

Navigation

  • Search
  • Recent content
  • Contact Me
  • Mail
  • Pass Hasher
  • Bower Studios Admin

Quotes

daniel —Mon, 02/26/2007 - 12:29pm

One might think that the money value of an invention constitutes its reward to the man who loves his work. But... I continue to find my greatest pleasure, and so my reward, in the work that precedes what the world calls success.

—

Thomas A. Edison

  • Log in to post comments
  • daniel's quotes

Popular content

Last viewed:

  • Make a field read-only in Spring3 Web
  • Quotes 776
  • Postgresql UUIDs
  • Benjamin Franklin
  • Sound for Headphones in Ubuntu 10.04 on some Dell laptops

Copyright 2021 Daniel Bower
  • My Lab
  • Family
  • Friends
  • Professional
  • About