LinuxHelps.com

A blog for Linux Lovers.

Archive for the ‘PHP’ Category

Posted by sibu on May 24, 2009

Disable php for a single domain.

To disable PHP for a particular user on a Linux server , Put the following code in a .htaaccess file for that user as :

php_flag engine off

Also you can add following code for that in tag of taht particular domain in server’s httpd.conf .

php_admin_flag engine off

Posted by sibu on March 10, 2009

Php compilation as an Apache Module.

Download the latest source from php.net

Requirements:
httpd
httpd-devel
gd
libjpeg-devel
libpng-devel
libc-client
libc-client-devel
libmcrypt-devel
libmhash-devel
freetype-devel.i386
mysql-devel
zlib-devel.i386
gettext-devel.i386
libxml2-devel.i386
aspell-devel.i386

Compile the source:
./configure –with-apxs2=/usr/sbin/apxs –prefix=/usr/local –with-xml –enable-bcmath –enable-calendar –with-curl –enable-ftp –with-gd –with-jpeg-dir=/usr/local –with-png-dir=/usr –with-xpm-dir=/usr/X11R6 –with-gettext –with-imap=/usr/local/imap-2004g –enable-mbstring –enable-mbstr-enc-trans –enable-mbregex –with-mcrypt –with-mhash –enable-magic-quotes –with-mysqli –with-mysql=/usr –with-openssl –enable-discard-path –with-pear –with-aspell –enable-sockets –enable-track-vars –with-ttf –with-freetype-dir=/usr –enable-gd-native-ttf –enable-versioning –with-xmlrpc –with-zlib –with-kerberos –with-imap-ssl

Make and Install the MakeFile
make
make install

Post Installation:
libtool –finish /usr/local/src/php-5.2.5/libs
cp /usr/local/bin/php /usr/local/bin/php
cp php.ini-dist /usr/local/lib/php.ini

Edit httpd.conf:
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-php-source .phps
For PHP 4:
LoadModule php4_module libexec/libphp4.so
AddModule mod_php4.c
For PHP 5:
LoadModule php5_module libexec/libphp5.so
AddModule mod_php5.c

Restart Services:
/etc/init.d/mysqld restart
/etc/init.d/httpd restart

Check Installation:
php -v –> To Check Version
php -m –> To Check Supported Modules