[CentOS] apache 2 and php 5.2

Tue Feb 15 23:00:59 UTC 2011
Keith Roberts <keith at karsites.net>

On Wed, 16 Feb 2011, Eero Volotinen wrote:

*snip*

> how about running php --info from commandline?

Good point Eero.

Would that not just return the basic configuration settings 
for the CLI version of php?

What if the OP has used a different php configuration for 
the apache php module, by using php configuration directives 
in the httpd.conf file?

These php config settings would not show up when running the 
CLI version of php.

Eg.

/etc/php.ini

; open_basedir, if set, limits all file operations to the 
; defined directory and below.  This directive makes most 
; sense if used in a per-directory or per-virtualhost web server
; configuration file. This directive is *NOT* affected by
;  whether Safe Mode is turned On or Off.
;

; see also /etc/httpd.conf for overriding these settings for 
; the apache php module.

; for CLI PHP version only
open_basedir = "./:/tmp/:/loads/of/different/paths/here/:"
;open_basedir = ""


/etc/httpd/conf/httpd.conf

#==========================================================================
#            APACHE ACCESS TO FILESYSTEM & SERVER DOCUMENT 
TREE
#==========================================================================

<Directory />
   Options None
   AllowOverride None
   Order Deny,Allow
   Deny from all

   # These are the only directories which apache's PHP module
   # can have access to. This setting overrides the default
   # settings in the global php.ini file, which applies to
   # the CLI version of PHP.
   #
   php_admin_value open_basedir '/path/to/apache/doc_root:/another/path/to/linked/files/'
   php_admin_flag display_errors OFF

</Directory>

So using the httpd.conf php_admin_xxx directives, I can 
selectively turn on php errors for my development 
directories, only accessible by me (localhost). Any publicly 
accesible directories get php error reporting turned off.

I do my web development in a seperate protected development 
tree, and then push the live code into another 'accessible 
to all' branch.

Kind Regards,

Keith Roberts

-----------------------------------------------------------------
Websites:
http://www.karsites.net
http://www.php-debuggers.net
http://www.raised-from-the-dead.org.uk

All email addresses are challenge-response protected with
TMDA [http://tmda.net]
-----------------------------------------------------------------