logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Other Software View previous topic :: View next topic
Reply to topic   Topic: Run different php versions to run different php scripts ?
Author
maskego



Joined: 16 Apr 2010
Posts: 238

PostPosted: Tue 09 Oct '12 9:36    Post subject: Run different php versions to run different php scripts ? Reply with quote

I do search AL posts.I can't find how to set different php version to run different php scripts(some php scripts is too old to run under new version of php).Is there any sample to indicate that setting? Smile
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7288
Location: Germany, Next to Hamburg

PostPosted: Tue 09 Oct '12 10:45    Post subject: Reply with quote

There is a topic about that --> https://www.apachelounge.com/viewtopic.php?t=3430

if you have any further question please ask in this topic.
Back to top
maskego



Joined: 16 Apr 2010
Posts: 238

PostPosted: Tue 09 Oct '12 12:39    Post subject: Reply with quote

I read that post too.
But,I can't understand how to set various version php.ini for each php version to use.

Is there any note to explain clearly?
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7288
Location: Germany, Next to Hamburg

PostPosted: Tue 09 Oct '12 13:01    Post subject: Reply with quote

the trick is using FcgidInitialEnv PHPRC
So in each of that path you can have your own php.ini and using the same php binaries each time OR different php binaries with their own php.ini

Code:

#using php 5.2
<VirtualHost *:80>
   ServerName user1.example.com
   DocumentRoot "C:/home/user1/htdocs"
   FcgidInitialEnv PHPRC "C:/php5.2"
   AddHandler fcgid-script .php
   FcgidWrapper "C:/php5.2/php-cgi.exe" .php
</VirtualHost>

#using php 5.3
<VirtualHost *:80>
   ServerName user2.example.com
   DocumentRoot "C:/home/user2/htdocs"
   FcgidInitialEnv PHPRC "C:/php5.3"
   AddHandler fcgid-script .php
   FcgidWrapper "C:/php5.3/php-cgi.exe" .php
</VirtualHost>

#also using php 5.3, but using C:/home/user3/php.ini
<VirtualHost *:80>
   ServerName user3.example.com
   DocumentRoot "C:/home/user3/htdocs"
   FcgidInitialEnv PHPRC "C:/home/user3/"
   AddHandler fcgid-script .php
   FcgidWrapper "C:/php5.3/php-cgi.exe" .php
</VirtualHost>
Back to top
maskego



Joined: 16 Apr 2010
Posts: 238

PostPosted: Tue 09 Oct '12 23:37    Post subject: Reply with quote

After try,it get the internal error 500.(I have only one ip to run VirtualHost)
What else should I need to check at httpd.conf or others?Such as DocumentRoot or ?

Code:
[Wed Oct 10 06:20:45.132526 2012] [fcgid:warn] [pid 3800:tid 1716] (OS 109) mod_fcgid: get overlap result error
[Wed Oct 10 06:20:45.132526 2012] [core:error] [pid 3800:tid 1716]  End of script output before headers: index.php
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7288
Location: Germany, Next to Hamburg

PostPosted: Wed 10 Oct '12 10:45    Post subject: Reply with quote

try a simple script like

Code:
<?php
phpinfo();
?>


if it than still crashes it is PHP related. Of cause you should run a httpd -t to do a syntax check.

also et in your php.ini
display_startup_errors = On

I had such a problem too until I changed PHP to thread safe version.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7288
Location: Germany, Next to Hamburg

PostPosted: Wed 10 Oct '12 11:50    Post subject: Reply with quote

Well I made a whole test setup. Working with 3 different PHP versions

http://pastebin.com/raw.php?i=eJTSmUsw

Hadn't fun to try PHP 5.2, but I think it should work, too.

Notice that you can use any subdomain of *.local.apachehaus.de to test your config, since any .local.apachehaus.de will give back 127.0.0.1 or IPv6 ::1 No need to edit your hosts file Wink

If I run multiple php version productive, I copy each php-cgi.exe or rename it to e.g. php547-cgi.exe. Than I can see in the taskmanager if a specific version run amok
Back to top
maskego



Joined: 16 Apr 2010
Posts: 238

PostPosted: Thu 11 Oct '12 2:24    Post subject: Reply with quote

James:
Thank you so much.It's very useful.I will try and post back soon. Smile
Back to top


Reply to topic   Topic: Run different php versions to run different php scripts ? View previous topic :: View next topic
Post new topic   Forum Index -> Other Software