When using PHP as an Apache module, not cgi and cli version, 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)
PHP constants do not exist outside of PHP. For example, in httpd.conf do 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 |
Title: PHP 4.x Apache Directives Notes Contributor: Randall Goguen (aka Ranman) Last Update: Tuesday July 18 19:55 EDT 2000 URL: http://www.linuxguruz.org/documents/php_directives.html Syntax ====== php_value name value -- This sets the value of the specified variable. php_flag name on|off -- This is used to set a Boolean configuration option. php_admin_value name value -- This sets the value of the specified variable. "Admin" configuration settings can only be set from within the main Apache configuration files, and not from .htaccess files. php_admin_flag name on|off -- This is used to set a Boolean configuration option. Samples ======== <IfModule mod_php4.c> php_value include_path ".:/usr/local/lib/php" php_admin_flag safe_mode on </IfModule> <IfModule mod_php3.c> php3_include_path ".:/usr/local/lib/php" php3_safe_mode on </IfModule> Favorite ========= php_flag expose_php Off php_flag register_globals Off #variables_order EGPCS auto_prepend_file string auto_append_file string default_charset string include_path # For .htaccess <Directory /home/htdocs> php_flag log_errors on php_flag short_open_tag on php_value max_execution_time 180 php_value upload_tmp_dir /home/htdocs/tmp php_value include_path /home/htdocs/include php_value memory_limit 8388608 php_value error_reporting 15 php_flag display_errors on php_flag track_errors off php_value error_log /usr/local/httpd-php/logs/php3_error.log php_flag magic_quotes_gpc on php_flag track_vars on php_value auto_prepend_file /usr/local/httpd-php/php/prepend.php3 php_value auto_append_file /usr/local/httpd-php/php/append.php3 </Directory> # For httpd.conf <Directory /home/htdocs> php_admin_flag engine on php_admin_flag log_errors on php_admin_value max_execution_time 180 php_admin_value upload_tmp_dir /home/htdocs/tmp php_admin_value include_path /home/htdocs/include php_admin_flag short_open_tag on php_admin_value memory_limit 8388608 php_admin_value error_reporting 15 php_admin_flag display_errors on php_admin_flag track_errors off php_admin_value error_log /usr/local/httpd-php/logs/php3_error.log php_admin_flag magic_quotes_gpc on php_admin_flag track_vars on php_admin_value auto_prepend_file /usr/local/httpd-php/php/prepend.php3 php_admin_value auto_append_file /usr/local/httpd-php/php/append.php3 php_admin_value include_path /home/htdocs/include </Directory> # This document is Copyright (c) 1999, 2000 by LinuxGuruz
Copyright © 2006 WorldHello 开放文档之源 计划 |