[CentOS] apache 2 and php 5.2

Wed Feb 16 15:08:49 UTC 2011
Paul A <razor at meganet.net>

Keith/guys thanks for the suggestions, here is what I have found. It shows
loaded config file is /etc/php.ini but if I remove that file and restart
apache it still works. I also did as Keith suggested I removed a comment ';'
and I got no errors apache started and it loaded the /etc/php.ini file. It's
just completely ignoring that file, if its there or if its not there.



PHP Version 5.2.17

System 	Linux testip5.meganet.net 2.6.18-194.26.1.el5PAE #1 SMP Tue Nov 9
13:34:42 EST 2010 i686
Build Date 	Jan 7 2011 08:50:02
Configure Command 	'./configure' '--build=i686-redhat-linux-gnu'
'--host=i686-redhat-linux-gnu' '--target=i386-redhat-linux-gnu'
'--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin'
'--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share'
'--includedir=/usr/include' '--libdir=/usr/lib' '--libexecdir=/usr/libexec'
'--localstatedir=/var' '--sharedstatedir=/usr/com' '--mandir=/usr/share/man'
'--infodir=/usr/share/info' '--cache-file=../config.cache'
'--with-libdir=lib' '--with-config-file-path=/etc'
'--with-config-file-scan-dir=/etc/php.d' '--disable-debug' '--with-pic'
'--disable-rpath' '--without-pear' '--with-bz2' '--with-exec-dir=/usr/bin'
'--with-freetype-dir=/usr' '--with-png-dir=/usr' '--with-xpm-dir=/usr'
'--enable-gd-native-ttf' '--with-t1lib=/usr' '--without-gdbm'
'--with-gettext' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr'
'--with-openssl' '--with-pcre-regex' '--with-zlib' '--with-layout=GNU'
'--enable-exif' '--enable-ftp' '--enable-magic-quotes' '--enable-sockets'
'--enable-sysvsem' '--enable-sysvshm' '--enable-sysvmsg' '--with-kerberos'
'--enable-ucd-snmp-hack' '--enable-shmop' '--enable-calendar'
'--without-mime-magic' '--without-sqlite' '--with-libxml-dir=/usr'
'--with-xml' '--with-system-tzdata' '--with-apxs2=/usr/sbin/apxs'
'--without-mysql' '--without-gd' '--disable-dom' '--disable-dba'
'--without-unixODBC' '--disable-pdo' '--disable-xmlreader'
'--disable-xmlwriter' '--disable-json' '--without-pspell' '--disable-wddx'
'--without-curl' '--disable-posix' '--disable-sysvmsg' '--disable-sysvshm'
'--disable-sysvsem'
Server API 	Apache 2.0 Handler
Virtual Directory Support 	disabled
Configuration File (php.ini) Path 	/etc
Loaded Configuration File 	/etc/php.ini
Scan this dir for additional .ini files 	/etc/php.d
additional .ini files parsed 	/etc/php.d/Fileinfo.ini,
/etc/php.d/curl.ini, /etc/php.d/dba.ini, /etc/php.d/dbase.ini,
/etc/php.d/dom.ini, /etc/php.d/gd.ini, /etc/php.d/imap.ini,
/etc/php.d/json.ini, /etc/php.d/ldap.ini, /etc/php.d/mbstring.ini,
/etc/php.d/mcrypt.ini, /etc/php.d/mysql.ini, /etc/php.d/mysqli.ini,
/etc/php.d/odbc.ini, /etc/php.d/pdo.ini, /etc/php.d/pdo_mysql.ini,
/etc/php.d/pdo_odbc.ini, /etc/php.d/pdo_pgsql.ini,
/etc/php.d/pdo_sqlite.ini, /etc/php.d/pgsql.ini, /etc/php.d/soap.ini,
/etc/php.d/wddx.ini, /etc/php.d/xmlreader.ini, /etc/php.d/xmlrpc.ini,
/etc/php.d/xmlwriter.ini, /etc/php.d/xsl.ini, /etc/php.d/zip.ini
PHP API 	20041225
PHP Extension 	20060613
Zend Extension 	220060519
Debug Build 	no
Thread Safety 	disabled
Zend Memory Manager 	enabled
IPv6 Support 	enabled
Registered PHP Streams 	https, ftps, compress.zlib, compress.bzip2, php,
file, data, http, ftp, zip
Registered Stream Socket Transports 	tcp, udp, unix, udg, ssl, sslv3,
sslv2, tls
Registered Stream Filters 	zlib.*, bzip2.*, convert.iconv.*,
string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*,
consumed

Zend logo This program makes use of the Zend Scripting Language Engine:
Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies


-----Original Message-----
From: centos-bounces at centos.org [mailto:centos-bounces at centos.org] On Behalf
Of Keith Roberts
Sent: Tuesday, February 15, 2011 6:01 PM
To: CentOS mailing list
Subject: Re: [CentOS] apache 2 and php 5.2

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]
-----------------------------------------------------------------
_______________________________________________
CentOS mailing list
CentOS at centos.org
http://lists.centos.org/mailman/listinfo/centos