hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Hosting Security and Technology : Apache2 with php4 and php5
Reply

Forum Jump

Apache2 with php4 and php5

Reply Post New Thread In Hosting Security and Technology Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old 11-28-2009, 12:12 AM
minim minim is offline
Junior Guru Wannabe
 
Join Date: Jul 2009
Posts: 57

Apache2 with php4 and php5


Hello,


I am looking to work both php4 and php5 with Apache2 in plain server. I have tried most of the links but ended up with no luck
Can you guys tell me how to work on it.
Thanks in advance.



Sponsored Links
  #2  
Old 11-28-2009, 12:46 AM
UNIXy UNIXy is online now
Warp Speed!
 
Join Date: Feb 2008
Location: Houston, Texas, USA
Posts: 2,824
What have you done so far and what issues are you encountering?

Regards
Joe

__________________
|- UNIXY :: Fully Managed Servers and Clusters Since 2006
|- DC POP :: Houston, Los Angeles, Atlanta, & Rotterdam NL
|- Managed Magento Varnish Servers w/ ESI. < 250ms Page Load / TTFB
L- We LOVE helping our clients!

  #3  
Old 11-28-2009, 12:55 AM
david510 david510 is offline
Web Hosting Master
 
Join Date: Oct 2004
Location: Kerala, India
Posts: 4,708
How do you want each php running? As apache or CGI module?

__________________
David | www.cliffsupport.com
Affordable Server Management Solutions sales AT cliffsupport DOT com
CliffWebManager | Access WHM from iPhone and Android

Sponsored Links
  #4  
Old 11-28-2009, 01:00 AM
minim minim is offline
Junior Guru Wannabe
 
Join Date: Jul 2009
Posts: 57
Thanks for responding Joe
1. Compiled php4 and php5 in various locations with Apache2.
2. Need php4 server wide.
3. Need php5 for particular folder.
4. Add the following to httpd.conf
<Directory /home/user/public_html>
AddHandler php-script .php
Action php-script /cgi-bin/php5
</Directory>
5. cp /usr/local/php5/bin/php /home/user/public_html/
6. restart apache


After all these steps I am unable to work php5 in that particular folder.
Where I am going wrong ??
Thanks in advance.

  #5  
Old 11-28-2009, 01:02 AM
minim minim is offline
Junior Guru Wannabe
 
Join Date: Jul 2009
Posts: 57
Quote:
Originally Posted by david510 View Post
How do you want each php running? As apache or CGI module?
Thanks for responding

I need to run php5 as cgi and php4 as apache.

  #6  
Old 11-28-2009, 01:57 AM
minim minim is offline
Junior Guru Wannabe
 
Join Date: Jul 2009
Posts: 57
Quote:
Originally Posted by UNIXy View Post
What have you done so far and what issues are you encountering?

Regards
Joe
Thanks for responding Joe
1. Compiled php4 and php5 in various locations with Apache2.
2. Need php4 server wide.
3. Need php5 for particular folder.
4. Add the following to httpd.conf
<Directory /home/user/public_html>
AddHandler php-script .php
Action php-script /cgi-bin/php5
</Directory>
5. cp /usr/local/php5/bin/php /home/user/public_html/
6. restart apache


After all these steps I am unable to work php5 in that particular folder.
Where I am going wrong ??
Thanks in advance.

  #7  
Old 11-28-2009, 02:12 AM
david510 david510 is offline
Web Hosting Master
 
Join Date: Oct 2004
Location: Kerala, India
Posts: 4,708
Add this to the httpd.conf file.
Code:
<Directory /home/user/public_html>
Action application/x-httpd-php5 "php"
AddHandler application/x-httpd-php5 .php5
</Directory>
Make a file named test.php5 in the webroot and check.

__________________
David | www.cliffsupport.com
Affordable Server Management Solutions sales AT cliffsupport DOT com
CliffWebManager | Access WHM from iPhone and Android

  #8  
Old 11-28-2009, 02:24 AM
minim minim is offline
Junior Guru Wannabe
 
Join Date: Jul 2009
Posts: 57
Quote:
Originally Posted by david510 View Post
Add this to the httpd.conf file.
Code:
<Directory /home/user/public_html>
Action application/x-httpd-php5 "php"
AddHandler application/x-httpd-php5 .php5
</Directory>
Make a file named test.php5 in the webroot and check.
Thanks David
My info.php show php version4 and info.php5 show "Your browser sent a request that this server could not understand" - error log "Invalid URI in request GET /info.php5 HTTP/1.1"

Where I am going wrong ??
Thanks in advance.

  #9  
Old 11-28-2009, 03:57 AM
david510 david510 is offline
Web Hosting Master
 
Join Date: Oct 2004
Location: Kerala, India
Posts: 4,708
Add the following line too along with the previous lines.

AddType application/x-httpd-php5 .php5

Restart apache after that.

__________________
David | www.cliffsupport.com
Affordable Server Management Solutions sales AT cliffsupport DOT com
CliffWebManager | Access WHM from iPhone and Android

  #10  
Old 11-28-2009, 04:33 AM
minim minim is offline
Junior Guru Wannabe
 
Join Date: Jul 2009
Posts: 57
Quote:
Originally Posted by david510 View Post
Add the following line too along with the previous lines.

AddType application/x-httpd-php5 .php5

Restart apache after that.
Thanks David.
info.php is showing php version 4 and info.php5 shows "<? phpinfo(); ?>".
I am trying to run appli under /usr/local/apache2/htdocs/demo as php5 and php4 as server wide.
Please Help.

  #11  
Old 11-30-2009, 07:35 AM
minim minim is offline
Junior Guru Wannabe
 
Join Date: Jul 2009
Posts: 57
Hello,

I am still not getting an clear idea how to make it work.
"Php4 as Apache mod and Php5 as CGI" / "php4 as server wide and php5 for particular directory". can any one post me the clean steps how to make it work in plain server.

Thanks in advance.

  #12  
Old 11-30-2009, 01:50 PM
david510 david510 is offline
Web Hosting Master
 
Join Date: Oct 2004
Location: Kerala, India
Posts: 4,708
Quote:
Originally Posted by minim View Post
Thanks David.
info.php is showing php version 4 and info.php5 shows "<? phpinfo(); ?>".
I am trying to run appli under /usr/local/apache2/htdocs/demo as php5 and php4 as server wide.
Please Help.
Try adding these lines in httpd.conf file and restart apache.

Code:
<Directory /usr/local/apache2/htdocs/demo>
Action application/x-httpd-php5 php
AddType application/x-httpd-php5 .php5
AddHandler application/x-httpd-php5 .php5
</Directory>

__________________
David | www.cliffsupport.com
Affordable Server Management Solutions sales AT cliffsupport DOT com
CliffWebManager | Access WHM from iPhone and Android

  #13  
Old 12-01-2009, 02:44 AM
minim minim is offline
Junior Guru Wannabe
 
Join Date: Jul 2009
Posts: 57
Quote:
Originally Posted by david510 View Post
Try adding these lines in httpd.conf file and restart apache.

Code:
<Directory /usr/local/apache2/htdocs/demo>
Action application/x-httpd-php5 php
AddType application/x-httpd-php5 .php5
AddHandler application/x-httpd-php5 .php5
</Directory>
Thanks David. I tried like the above post but no luck
I have to run the application as .php and not as ".php5, so pls advice me and Please let me know the modules which should be included while compiling php5 with apache2.

  #14  
Old 12-01-2009, 09:06 AM
david510 david510 is offline
Web Hosting Master
 
Join Date: Oct 2004
Location: Kerala, India
Posts: 4,708
Compile php5 as follows.
Code:
wget http://us.php.net/get/php-5.2.11.tar.gz/from/us.php.net/mirror
tar -zxf php-5.2.11.tar.gz
cd php-5.2.11
./configure --prefix=/usr/local/php5 --add_the_remaining_options_from_php4_expect_apxs
make
make install
Now run the following command
Code:
/usr/local/php5/bin/php-cgi  -v
It should show as cgi.

Now add the following lines on top of the httpd.conf file
Code:
ScriptAlias /php5/ /usr/local/php5/bin/
Action application/x-httpd-php5 /php5/php-cgi
<Directory "/usr/local/php5/bin/">
    Allow from all
</Directory>
Save httpd.conf file and restart apache.

Open a .htaccess file inside the folder where you need php5 and add the following code to it. Make sure .htaccess support is enabled in your apache configuration.

Code:
AddHandler application/x-httpd-php5 .php
Make a phpinfo.php file in this directory and see what is shows when taken in browser. It should be php5.

See what it shows when the .htaccess line is commented. It should be php4 then.

__________________
David | www.cliffsupport.com
Affordable Server Management Solutions sales AT cliffsupport DOT com
CliffWebManager | Access WHM from iPhone and Android

  #15  
Old 12-02-2009, 12:13 AM
larwilliams larwilliams is offline
Web Hosting Master
 
Join Date: Jan 2008
Location: St. John's, NL
Posts: 2,052
Sounds like you may want the Concurrent DSO patch during EasyApache so that you can run both together as DSOs. A bit of advice though: if you are running a shared server, do not make PHP4 default. It is old, unsupported, and insecure.

__________________
Cpanel/WHM PHP Perl Ruby Full Time Support
LCWSoft - Canada web hosting (based in Newfoundland) since 2007
Servers based in the US and Canada (Uptime Report)

Reply

Similar Threads
Thread Thread Starter Forum Replies Last Post
dual php4 & php5 forcing script to use php5 acctman Programming Discussion 1 09-09-2009 11:22 PM
PHP4 reaching its End Of Life, 4->5 guaranteed transition service (PHP5+PHP4) SHTech Software & Scripts Offers 1 07-16-2008 06:28 AM
php4 and php5 togethor on apache2 (centos 4.5) dinks Hosting Security and Technology 7 07-05-2007 12:35 AM
run php4 for .php4 files and php5 for .php [httpd.conf] SexualChocolate Hosting Security and Technology 2 01-29-2007 09:29 AM
PHP4 + Apache2 + Windows Error Kakashi Hosting Security and Technology 0 07-19-2006 12:56 PM

Related posts from TheWhir.com
Title Type Date Posted
Apache Market Share Falls in Netcraft October Web Server Survey Web Hosting News 2013-10-04 14:34:11
Apache Market Share Dips Slightly in June Netcraft Web Server Survey Web Hosting News 2013-06-06 13:40:21
Apache Continues to Dominate Web Server Market in Netcraft May Survey Web Hosting News 2013-05-06 14:29:02
Researchers Urge System Admins to Check for New Apache Web Server Backdoor Malware Web Hosting News 2013-05-01 11:35:53
CloudStack 4.0 Open Source Cloud Software Released as Apache Incubator Project Web Hosting News 2012-11-08 13:54:10


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?