Author |
|
maskego
Joined: 16 Apr 2010 Posts: 238
|
Posted: Tue 09 Oct '12 9:36 Post subject: Run different php versions to run different php scripts ? |
|
|
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? |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7373 Location: Germany, Next to Hamburg
|
|
Back to top |
|
maskego
Joined: 16 Apr 2010 Posts: 238
|
Posted: Tue 09 Oct '12 12:39 Post subject: |
|
|
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: 7373 Location: Germany, Next to Hamburg
|
Posted: Tue 09 Oct '12 13:01 Post subject: |
|
|
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
|
Posted: Tue 09 Oct '12 23:37 Post subject: |
|
|
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: 7373 Location: Germany, Next to Hamburg
|
Posted: Wed 10 Oct '12 10:45 Post subject: |
|
|
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: 7373 Location: Germany, Next to Hamburg
|
Posted: Wed 10 Oct '12 11:50 Post subject: |
|
|
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
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
|
Posted: Thu 11 Oct '12 2:24 Post subject: |
|
|
James:
Thank you so much.It's very useful.I will try and post back soon. |
|
Back to top |
|