View previous topic :: View next topic |
Author |
Message |
ariejan Tux's lil' helper
Joined: 01 Jun 2002 Posts: 100 Location: Eindhoven, The Netherlands
|
Posted: Mon Nov 17, 2003 2:20 pm Post subject: Safely testing PHP5 |
|
|
Is is possible to test PHP5 together with PHP4? (Like with PHP 3 and 4 that only files with .php5 extentions will be parsed by php5?)
I have only a (production) server to test PHP5 on at this moment. I don't want to upgrade PHP4 now, but maybe I can run both versions?
Is the above possible? Or do I have to jump some other loops? (Please tell me which loops. ) |
|
Back to top |
|
|
kauschovar n00b
Joined: 05 Sep 2002 Posts: 17
|
Posted: Thu Jun 17, 2004 1:11 am Post subject: |
|
|
Edit: lol, I just realized that this is a really old thread. When I read it before I thought it said June 17 2004 for some reason. I probably should have written this reply in a newer thread, but oh well, it's too late now.
I was wondering the same thing. I configured Apache in a way that should theoretically execute all *.php5 files with PHP5 and the rest with PHP4 if you supply both -D PHP4 and -D PHP5. With that setup I could use either PHP4 or PHP5, but if I tried to use both all the PHP scripts would cause a segfault whether they were PHP4 or PHP5 files:
Code: | [Wed Jun 16 17:44:56 2004] [notice] child pid 12121 exit signal Segmentation fault (11)
[Wed Jun 16 17:45:18 2004] [notice] child pid 12122 exit signal Segmentation fault (11)
[Wed Jun 16 17:45:24 2004] [notice] child pid 12123 exit signal Segmentation fault (11)
[Wed Jun 16 17:45:29 2004] [notice] child pid 12124 exit signal Segmentation fault (11) |
So I posted a question about this on #php and a guy there told me that PHP4 and PHP5 use the same memory space, so trying to run them at the same time is impossible (explains the segfaults). But that's okay, I can switch between -D PHP4 and -D PHP5 pretty easily, and PHP5 will still run PHP4 code just fine. Just download the PHP5 source code from http://www.php.net/downloads.php, extract it, cd, ./configure, make, and cp libs/libphp5.so to /usr/lib/apache2/extramodules, and add this to your /etc/apache2/conf/modules.d/70_mod_php.conf:
Code: | <IfDefine PHP5>
<IfDefine !PHP4>
<IfModule !mod_php5.c>
LoadModule php5_module extramodules/libphp5.so
</IfModule>
<IfModule mod_mime.c>
AddType application/x-httpd-php .php
AddType application/x-httpd-php .phtml
AddType application/x-httpd-php .php3
AddType application/x-httpd-php .php4
AddType application/x-httpd-php-source .phps
AddType application/x-httpd-php .php5
</IfModule>
<Files *.php>
LimitRequestBody 524288
RequestHeader unset If-Modified-Since
</Files>
<Files *.php3>
LimitRequestBody 524288
RequestHeader unset If-Modified-Since
</Files>
<Files *.php4>
LimitRequestBody 524288
RequestHeader unset If-Modified-Since
</Files>
<Files *.php5>
LimitRequestBody 524288
RequestHeader unset If-Modified-Since
</Files>
<Files *.phps>
LimitRequestBody 524288
RequestHeader unset If-Modified-Since
</Files>
<Files *.phtml>
LimitRequestBody 524288
RequestHeader unset If-Modified-Since
</Files>
</IfDefine>
</IfDefine> |
Then in /etc/conf.d/apache2, make sure you have either '-D PHP4' or '-D PHP5' but not both. |
|
Back to top |
|
|
BudgetDedicated n00b
Joined: 26 Apr 2004 Posts: 12 Location: NL
|
Posted: Thu Jun 17, 2004 4:10 pm Post subject: |
|
|
A very good (though no ultimately easy ) way to solve this problem (and run PHP4 AND 5 together) is running a front-end proxy that forwards to a PHP4 or a PHP5 backend. The differentiation can easily be made on file extension, but other rules can also be used. This if ofcourse also for mixing different server-software (mix Apache 2 with apache1/zeus or a port of a webserver on a FreeBSD box)
(We use front-end proxies anyway, so it's not really a problem, but I can imagine its too much trouble to go through, though.) _________________ Grt, Erik
[ My commercial Ad.: Europe's top quality Gentoo VPS provider: BudgetDedicated (starting at 20 euro/month) ] |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|