This page looks plain and unstyled because you're using a non-standard compliant browser. To see it in its best form, please upgrade to a browser that supports web standards. It's free and painless.

Blog About Dedicated Servers

« | »

HOW-TO: Apache + (phpsuexec, not required) + php4 (mod_php4 or cgi) + php5 (cgi)

Luigi Ramone | 30 November, 2005 21:18

HOW-TO updated to reflect 5.0.4 update to 5.0.5

Finally I have confirmed that this setup works!

I'm using Apache 1.3.33 (1.3.34 out, but it will not broke anything) + phpsuexec coming with cPanel + custom php 4.3.11 compiled as cgi (actually you may use the Apache Update via WHM to compile working php4 in cgi mode/phpsuexec) + custom php 5.0.5 compiled as cgi (it is easy to do as well, I will explain)

php5 works the same as php4 and it saves the permissions and etc. E.g. no problems with nobody as well.



1. Make sure you has Apache installed and workind with php4. It doesn't matter if you run mod_php4 or php4/phpsuexec, but I recommend to have phpsuexec based install (Warning: if you are running mod_php4 and would like to switch to phpsuexec, read the threads in this forum or you may end up with numerous broken scripts!);

2. You would need to compile php 5. To do this use the SSH sessing logged as root.
Then execute preparation commands (based on cPanel for better compatibility):
---------------------------

/scripts/checkccompiler
rm -rf /home/cpphpbuild
mkdir /home/cpphpbuild
cd /home/cpphpbuild
wget http://layer1.cpanel.net/buildapache/1/php-5.0.5.tar.gz
tar xfzv php-5.0.5.tar.gz
cd php-5.0.5

---------------------------

Make sure that we do enabled Sendmail support:

---------------------------

echo "#define HAVE_SENDMAIL 1" >> /home/cpphpbuild/php-5.0.5/main/php_config.h

---------------------------

It is recommended to apply the mail-header patch which allows to track the script which sent an email. You may skip this step.

---------------------------

wget http://choon.net/opensource/php/php-5.0.5-mail-header.patch
patch -p1 < /home/cpphpbuild/php-5.0.5/php-5.0.5-mail-header.patch

---------------------------

Then one of the most important steps. It is the configuring of the php. It would be better if you undestand these options. You may use the configure from your existing php. To get them type the following:

---------------------------

php -i | grep configure | sed "s/'//g"

---------------------------

You will get the almost clean configure you are currently using. The several important hints on this.
a) REMOVE the "--with-apxs=/usr/local/apache/bin/apxs" from the line. We are going to compile CGI version and it WILL broke the Apache!

b) Make sure you have the following prefixes and suffixes to install to the proper directories - otherwise currently installed php could be broken:
--prefix=/usr/local/php5 --exec-prefix=/usr/local/php5 --program-suffix=5

c) Add the necessary options for proper CGI redirects from Apache:
--enable-force-cgi-redirect --enable-discard-path

The result line will looks like this (please, do not use it - it has no CURL and PostgreSQL support - you better to follow steps above):

---------------------------

./configure --prefix=/usr/local/php5 --exec-prefix=/usr/local/php5 --program-suffix=5 --with-xml --enable-bcmath --enable-calendar --enable-ftp --with-gd --enable-exif --with-jpeg-dir=/usr --with-png-dir=/usr --with-xpm-dir=/usr/X11R6 --with-imap --with-imap-ssl --with-kerberos --enable-mbstring --with-mbstring=all --enable-mbstr-enc-trans --with-mcrypt --with-mhash --enable-magic-quotes --with-mysql=/usr --with-openssl --enable-discard-path --with-pear --enable-sockets --enable-track-vars --with-ttf --with-freetype-dir=/usr --enable-versioning --with-zlib --with-pspell --with-gettext --enable-inline-optimization --disable-debug --enable-force-cgi-redirect --enable-discard-path

---------------------------

So, we are ready to start the compiling. Execute "make install" and it starts...
If the process fails for any reason, carefully read the errors - usually they are self-explaining. In MOST cases errors are because of the inproper configure params.

Then run the cPanel script to complete:
/scripts/findphpversion

The compiled version of php should be copied to the cPanel cgi-sys:

---------------------------

cp -f /usr/local/php5/bin/php5 /usr/local/cpanel/cgi-sys/php5
chown root:wheel /usr/local/cpanel/cgi-sys/php5

---------------------------

Our installation has no php.ini file yet. On MOST systems Zend Optimizer installed. In this case you may just create the symlink:

---------------------------

ln -s /usr/local/Zend/etc/php.ini /usr/local/php5/lib/php.ini

---------------------------

Otherwise copy the default php.ini and edit it if needed:

---------------------------

cp -p /home/cpphpbuild/php-5.0.5/php.ini-recommended /usr/local/php5/lib/php.ini
chown root.root /usr/local/php5/lib/php.ini
chmod 644 /usr/local/php5/lib/php.ini

---------------------------

It is recommended to add the following line to the php.ini at the bottom (it is a MUST if you compile php4 instead php5!):

---------------------------

cgi.fix_pathinfo = 1 ; needed for CGI/FastCGI mode

---------------------------

We are almost done. Now we need to add several lines to Apache.

Run editor (you may use "vi" or "pico -w"):
pico -w /usr/local/apache/conf/httpd.conf

Scroll down (better use the built-in search) to the "<IfModule mod_dir.c>"
There we should to add index.php5 after index.jp, but before index.php4. Result would looks like this:

---------------------------

<IfModule mod_dir.c>
DirectoryIndex index.html index.wml index.cgi index.shtml index.jsp index.js index.jp index.php5 iindex.php4 index.php3 index.php index.phtml ndex.htm default.htm default.html home.htm
</IfModule>

---------------------------

This to allow index.php5 as index file.

Continue editing. Find the "AddType application/x-httpd-php .phtml" and after it add this:

---------------------------

Action application/x-httpd-php5 "/cgi-sys/php5"
AddType application/x-httpd-php5 .php5

---------------------------

This is the directives for Apache to use own php5 for files with extensions .php5

Check if we could find this line "ScriptAlias /cgi-sys/ /usr/local/cpanel/cgi-sys/"
If not - add it or our directive will not work. By default cPanel add this line. Just to warn you.

Save the file and quit.

Verify that you not broke the Apache config by running:

---------------------------

service httpd configtest

---------------------------

You SHOULD to get "Syntax OK" at the end and possible some minor warnings about "NameVirtualHost directive" - it is OK.
Warning: if you get ERROR - DO NOT RESTART APACHE AND LOCATE THE ISSUE. Otherwise Apache will not start at all!

When you make sure it is OK restart the Apache:

---------------------------

service httpd stop
service httpd startssl

---------------------------

Check that Apache come ok:

---------------------------

lynx --dump http://localhost/whm-server-status;

---------------------------

It will show you the Apache status.

Well, I should congratulate you - you have done it!

To test php5 upload the simple php file with the following content to any of your sites and name this file phpinfo.php AND ANOTHER COPY phpinfo.php5:

---------------------------

<?php
phpinfo();
?>

---------------------------

Then launch browser and point to phpinfo.php file first to see that php4 still OK, then open phpinfo.php5 to see that php5 is OK.

DONE!

ADDON:
If you need to use php5 for applications hardcoded with .php extensions you could to add the magic line to the VirtualHost directive of this account:
AddHandler application/x-httpd-php5 .php .php4 .php3 .phtml
(.php5 already using php5, but you may add it if you wish)

This will redirect all php, php3, php4 and php5 (as it set default globally) to the php5.

If you need to leave the option of running php4 on .php4 files do this:
AddHandler application/x-httpd-php5 .php .php3 .phtml .php5

But for those lazy folks there are an option to have these AddHandlers in the .htaccess files!
Just add the respective line (example, with no quotes: "AddHandler application/x-httpd-php5 .php .php4 .php3 .phtml") to the .htaccess and this directory and all its subdirectories would be able to use the php5 for chosen files!

This is awesome when you need to test some scripts. In this way create two directories:
/public_html/directory1
/public_html/directory2
And in the directory2 place .htaccess with:
AddHandler application/x-httpd-php5 .php .php4 .php3 .phtml

As a result you run php4 on .php in the directory1 and run php5 on .php in the directory2!

So it is very flexible and it all depends on how you would like to process php.

Credits: ISProHosting.com

レーシック [Reply]

レーシック焼酎インプラントキャッシングレンタルサーバー美容整形不動産株式年金サプリメントビジネスマナー占い結婚FXアクセスカウンターアクセスカウンターアクセスカウンター

レーシック | 08/10/2008, 02:19

SEO [Reply]

SEOレーシック焼酎インプラントキャッシングレンタルサーバー美容整形不動産株式年金サプリメントビジネスマナー占い結婚FXアクセスカウンターアクセスカウンターアクセスカウンターサイト売買オークションネイルエステバイク買取家庭教師バイオジェルスクールネイルスクール自動車保険生命保険

SEO | 29/10/2008, 02:54

エロ [Reply]

エロエロ動画エロ画像エロ本エロビデオオナニーオナニー方法オナニー仕方オナニー動画オナニー研究セックスセックスフレンドSEXアナルセックスカーセックスセフレセフレ募集セフレ探しセフレ紹介セックスフレンド童貞童貞卒業童貞フェチ童貞狩り童貞喪失素人素人画像素人動画素人女性素人ビデオSEXSEXフレンドSEXサークルSEX動画SEXライフエッチエッチ動画エッチ度即エッチエッチ画像スワッピングスワップ乱交夫婦交換スワッピング体験談出会い出会い系出会い系サイト出会いサイト無料出会い

エロ | 12/11/2008, 09:13

エロ [Reply]

エロい女が集まる出会い系サイトで楽しみましょう。エロ動画エロ画像もいっぱい見れます。エロ本エロビデオをお探しの方にもオススメのサイトです。オナニーを追求したことはありますか。オナニー方法は実に様々あり、オナニー仕方にも人によってそれぞれ違いがあります。オナニー動画を見て、一番気持ちの良いオナニー研究をしてみましょう。セックスがしたいならセックスフレンドがたくさん作れる出会い系サイトがオススメ。完全無料で出会えてSEXができるサイトはココだけ。アナルセックスカーセックスなど、アブノーマルなプレイをセックスフレンドと楽しもう!セフレを作るならセフレ募集ができる全国版出会い系サイトがおすすめです。地域検索でセフレ探しを完全サポート。あなたに合ったセフレ紹介をお手伝いします。近所のセックスフレンドを見つけて快適な性生活を送りましょう。童貞が今ブランド化しています。童貞卒業をするなら童貞フェチのお姉さんに童貞狩りをしてもらいましょう。あなたに高額な謝礼が支払われます。童貞喪失するなら童貞専門の出会い系サイトをご利用ください。素人とエッチしたいならこの出会い系サイトしかありません。素人画像素人動画が多数投稿されています。素人女性が出演している素人ビデオもたくさんあります。SEX好きなあなた、SEXフレンドを作るならSEXサークルが集まる当出会い系サイトで楽しみませんか。SEX動画公開中!あなたのSEXライフが大きく変わります。エッチな出会いを見つけましょう。エッチ動画コンテンツもあります。エッチ度をチェックして、相性の良い女の子と即エッチできるよ。女性のエッチ画像も公開中!スワッピングが楽しめるコミュニティサイトの紹介。スワップ経験が豊富な人でも、未経験の人でも楽しく乱交を楽しみましょう。夫婦交換をした人のスワッピング体験談もあります。日本最大級出会いの広場。会員数ナンバーワンの出会い系です。老舗出会い系サイトで素敵な相手を見つけましょう。出会いサイトを使うなら、無料出会いができるココのサイトが断然オススメ♪

エロ | 12/11/2008, 12:28

エロ [Reply]

エロエロ動画エロ画像エロ本エロビデオオナニーオナニー方法オナニー仕方オナニー動画オナニー研究セックスセックスフレンドSEXアナルセックスカーセックスセフレセフレ募集セフレ探しセフレ紹介セックスフレンド童貞童貞卒業童貞フェチ童貞狩り童貞喪失素人素人画像素人動画素人女性素人ビデオSEXSEXフレンドSEXサークルSEX動画SEXライフエッチエッチ動画エッチ度即エッチエッチ画像スワッピングスワップ乱交夫婦交換スワッピング体験談出会い出会い系出会い系サイト出会いサイト無料出会い

エロ | 02/12/2008, 08:47

エロ [Reply]

エロい女が集まる出会い系サイトで楽しみましょう。エロ動画エロ画像もいっぱい見れます。エロ本エロビデオをお探しの方にもオススメのサイトです。オナニーを追求したことはありますか。オナニー方法は実に様々あり、オナニー仕方にも人によってそれぞれ違いがあります。オナニー動画を見て、一番気持ちの良いオナニー研究をしてみましょう。セックスがしたいならセックスフレンドがたくさん作れる出会い系サイトがオススメ。完全無料で出会えてSEXができるサイトはココだけ。アナルセックスカーセックスなど、アブノーマルなプレイをセックスフレンドと楽しもう!セフレを作るならセフレ募集ができる全国版出会い系サイトがおすすめです。地域検索でセフレ探しを完全サポート。あなたに合ったセフレ紹介をお手伝いします。近所のセックスフレンドを見つけて快適な性生活を送りましょう。童貞が今ブランド化しています。童貞卒業をするなら童貞フェチのお姉さんに童貞狩りをしてもらいましょう。あなたに高額な謝礼が支払われます。童貞喪失するなら童貞専門の出会い系サイトをご利用ください。素人とエッチしたいならこの出会い系サイトしかありません。素人画像素人動画が多数投稿されています。素人女性が出演している素人ビデオもたくさんあります。SEX好きなあなた、SEXフレンドを作るならSEXサークルが集まる当出会い系サイトで楽しみませんか。SEX動画公開中!あなたのSEXライフが大きく変わります。エッチな出会いを見つけましょう。エッチ動画コンテンツもあります。エッチ度をチェックして、相性の良い女の子と即エッチできるよ。女性のエッチ画像も公開中!スワッピングが楽しめるコミュニティサイトの紹介。スワップ経験が豊富な人でも、未経験の人でも楽しく乱交を楽しみましょう。夫婦交換をした人のスワッピング体験談もあります。日本最大級出会いの広場。会員数ナンバーワンの出会い系です。老舗出会い系サイトで素敵な相手を見つけましょう。出会いサイトを使うなら、無料出会いができるココのサイトが断然オススメ♪

エロ | 02/12/2008, 08:47

エロ [Reply]

エロエロ動画エロ画像エロ本エロビデオオナニーオナニー方法オナニー仕方オナニー動画オナニー研究セックスセックスフレンドSEXアナルセックスカーセックスセフレセフレ募集セフレ探しセフレ紹介セックスフレンド童貞童貞卒業童貞フェチ童貞狩り童貞喪失素人素人画像素人動画素人女性素人ビデオSEXSEXフレンドSEXサークルSEX動画SEXライフエッチエッチ動画エッチ度即エッチエッチ画像スワッピングスワップ乱交夫婦交換スワッピング体験談出会い出会い系出会い系サイト出会いサイト無料出会い

エロ | 29/12/2008, 11:35

エロ [Reply]

エロい女が集まる出会い系サイトで楽しみましょう。エロ動画エロ画像もいっぱい見れます。エロ本エロビデオをお探しの方にもオススメのサイトです。オナニーを追求したことはありますか。オナニー方法は実に様々あり、オナニー仕方にも人によってそれぞれ違いがあります。オナニー動画を見て、一番気持ちの良いオナニー研究をしてみましょう。セックスがしたいならセックスフレンドがたくさん作れる出会い系サイトがオススメ。完全無料で出会えてSEXができるサイトはココだけ。アナルセックスカーセックスなど、アブノーマルなプレイをセックスフレンドと楽しもう!セフレを作るならセフレ募集ができる全国版出会い系サイトがおすすめです。地域検索でセフレ探しを完全サポート。あなたに合ったセフレ紹介をお手伝いします。近所のセックスフレンドを見つけて快適な性生活を送りましょう。童貞が今ブランド化しています。童貞卒業をするなら童貞フェチのお姉さんに童貞狩りをしてもらいましょう。あなたに高額な謝礼が支払われます。童貞喪失するなら童貞専門の出会い系サイトをご利用ください。素人とエッチしたいならこの出会い系サイトしかありません。素人画像素人動画が多数投稿されています。素人女性が出演している素人ビデオもたくさんあります。SEX好きなあなた、SEXフレンドを作るならSEXサークルが集まる当出会い系サイトで楽しみませんか。SEX動画公開中!あなたのSEXライフが大きく変わります。エッチな出会いを見つけましょう。エッチ動画コンテンツもあります。エッチ度をチェックして、相性の良い女の子と即エッチできるよ。女性のエッチ画像も公開中!スワッピングが楽しめるコミュニティサイトの紹介。スワップ経験が豊富な人でも、未経験の人でも楽しく乱交を楽しみましょう。夫婦交換をした人のスワッピング体験談もあります。日本最大級出会いの広場。会員数ナンバーワンの出会い系です。老舗出会い系サイトで素敵な相手を見つけましょう。出会いサイトを使うなら、無料出会いができるココのサイトが断然オススメ♪

エロ | 29/12/2008, 11:36

Add comment

Topic

Text

Your name

Your email address (if any)

Your personal page (if any)


authimage




Powered by Boonic, Bloogo & pLog
This Blog does not have any affiliation nor relation with the mentioned companies. All the logotipos, trade names and images are property of the companies that registered them.