суббота, 21 августа 2010 г.

Installing custom php5 as cgi module

I often need modules that are not enabled by default at my hosting @pair.com. Solution is to install a custom php.cgi module.

1. Download latest php source from php.net
2. unzip to phpdir (call it whatever you want)

'./configure' '--with-config-file-path=phpdir' '--enable-magic-quotes' '--enable-bcmath' '--with-zlib-dir=/usr/local' '--with-gd' '--with-freetype-dir' '--without-msql' '--with-mysql=/usr/local' '--with-mysqli' '--with-pdo-mysql' '--with-iodbc' '--enable-inline-optimization' '--without-gdbm' '--with-ndbm' '--without-db2' '--without-dbm' '--with-gettext' '--without-readline' '--without-recode' '--with-openssl=/usr/local/ssl' '--with-mcrypt' '--without-db3' '--enable-dba' '--with-curl' '--with-png-dir=/usr/local/lib' '--with-jpeg-dir=/usr/local/lib' '--enable-calendar' '--with-mhash' '--with-xsl' '--enable-mbstring=all' '--enable-mbregex' '--with-bz2' '--enable-exif' '--with-gmp' '--with-iconv' '--with-pspell' '--with-libxml-dir' '--enable-ftp' '--prefix=phpdir' '--exec-prefix=phpdir' '--program-suffix=5' '--enable-force-cgi-redirect' '--enable-discard-path'

3. nice make
4. make install

after these commands you will get php.cgi file in phpdir/bin folder.

5. copy it to some cgi-bin direcotry and make executable

6. add .htaccess file with the following instructions:

#PHP with security wrap provided by Pair
Action application/x-pair-sphpx /cgi-sys/php-cgiwrap/_Your_username_here/php5.cgi
AddType application/x-pair-sphpx .php .php3 .phtml .php4

Congratulations. It works!

Комментариев нет: