how use php4 / php5 in localhost
am 28.10.2007 17:39:24 von artevnow I use wmserver that have mysql apache and php4;
which solutions are there for to use both in localhost: php4 or php5
according to needs?
now I use wmserver that have mysql apache and php4;
which solutions are there for to use both in localhost: php4 or php5
according to needs?
Also sprach artev:
> now I use wmserver that have mysql apache and php4;
> which solutions are there for to use both in localhost: php4 or php5
> according to needs?
I use PHP as CGI in my local setup. I have a directory
(C:/Programme/xampp/php-cgi/) which contains folders for different PHP
versions, like "5.2.0/" or "4.4.4/" into which I unzip the downloaded PHP
version. In my localhost directory, I have a subfolder for each project I'm
working on, and in that folder I use a .htaccess file to select the PHP
version I want to work with. Also in the same folder, I have the php.ini
file, so I can choose both the PHP version and php.ini settings for each
project individually.
httpd.conf:
ScriptAlias /php-cgi/ "C:/Programme/xampp/php-cgi/"
AllowOverride None
Options FollowSymLinks
Order allow,deny
Allow from all
RewriteEngine On
RewriteCond %{ENV:REDIRECT_PHPRC} (.+)
RewriteRule ^ - [E=PHPRC:%1]
localhost/project-using-php5/.htaccess:
# PHP 5.2.0
SetEnv PHPRC "C:\localhost\project-using-php5\"
AddHandler application/x-php520 .php
Action application/x-php520 "/php-cgi/5.2.0/php-cgi.exe"
localhost/project-using-php4/.htaccess:
# PHP 4.4.4
SetEnv PHPRC "C:\localhost\project-using-php4\"
# AddHandler application/x-php444 .php
# Action application/x-php444 "/php-cgi/4.4.4/php.exe"
Note that you need to have mod_rewrite loaded (unless you don't care for
per-project php.inis, in which case you can remove all the Rewrite and
SetEnv lines).
Greetings,
Thomas
--
C'est pas parce qu'ils sont nombreux à avoir tort qu'ils ont raison!
(Coluche)
but you have both php4 and php5 how cgi?
I read a solution
that use PHP 5 how CGI on Apache port dedicated
so the php4 can it used how module;
(I want use at the moment php5 only for two applications)
the trick is to setting a virtualhost on one other port,
so cgi and module functioning are separated in security mode
and is possible to use same environment, same webserver and sam
document_root
to write at bottom file apache
Port 80
Listen 80
ServerName localhost
ServerAdmin me@localhost
DirectoryIndex index.php
DocumentRoot "C:/Programmi/Apache Group/Apache/htdocs"
ScriptAlias /cgi-bin/ "C:/PHP5/"
Action php5-script /cgi-bin/php-cgi.exe
AddHandler php5-script .php5
Listen 81
ServerName localhost
ServerAdmin me@localhost
DirectoryIndex index.php
DocumentRoot "C:/Programmi/Apache Group/Apache/htdocs"
ScriptAlias /cgi-bin/ "C:/PHP5/"
Action php5-script /cgi-bin/php-cgi.exe
AddHandler php5-script .php .php5
think is onoother good solutions?
Also sprach artev:
> but you have both php4 and php5 how cgi?
Yes, on my developement server, I run all PHP versions as CGI, because
- it's easier to set up
- I can run as many PHP versions as I want
- changes in php.ini take effect immediately (no need to restart Apache)
> I read a solution
> that use PHP 5 how CGI on Apache port dedicated
Yes, that would be another solution. I have not tried it, though.
> so the php4 can it used how module;
On my server (I'm using XAMPP), PHP is also running as a module, so you can
have that in addition to the CGI versions. Is it really necessary for you to
have PHP run as a module?
> (I want use at the moment php5 only for two applications)
Think of the future: PHP4 will no longer be supported, and PHP6 is to come
out soon (read: sooner or later).
> the trick is to setting a virtualhost on one other port,
> so cgi and module functioning are separated in security mode
> and is possible to use same environment, same webserver and sam
> document_root
Yes, with additional requirements you may have to do it this way. Your
original post, however, was simply about the question of running different
PHP versions concurrently. You had not mentioned any additional constraints.
[Apache configuration using two different ports]
> think is onoother good solutions?
As I said, I have never tried this solution. To me, it seems a bit
complicated (what if you want more than two PHP versions?), but it really
depends on your specific needs.
Greetings,
Thomas
--
C'est pas parce qu'ils sont nombreux à avoir tort qu'ils ont raison!
(Coluche)
>> I read a solution
>> that use PHP 5 how CGI on Apache port dedicated
>
> Yes, that would be another solution. I have not tried it, though.
>
>> so the php4 can it used how module;
>
> On my server (I'm using XAMPP), PHP is also running as a module, so you can
> have that in addition to the CGI versions. Is it really necessary for you to
> have PHP run as a module?
no; but now I have php4 installed how module and my applications work; so
now I not want change (only because if I have some difficulty I not know if
simple return at previous settings);
also I not know if when one application run on php cgi is possible that
some application not run more (I am not an php expert so not know potential
problmes);
also I know that moduel is more fast but not know if this is so important
for small applications in localhost;
> [Apache configuration using two different ports]
>> think is onoother good solutions?
>
> As I said, I have never tried this solution. To me, it seems a bit
> complicated (what if you want more than two PHP versions?), but it really
> depends on your specific needs.
not more than two; only two;
a question when you move an application from php cgi to server you on
server use module ? and you had some problems?
Also sprach artev:
> no; but now I have php4 installed how module and my applications
> work; so now I not want change (only because if I have some
> difficulty I not know if simple return at previous settings);
Just make a backup of your httpd.conf. Then it's no problem to switch back.
(Just remember to restart Apache.) I have simply added an Include directive
to the httpd.conf file to load my additional config with the CGI settings.
If anything should go wrong, I can either comment out the include or replace
the included file with an empty one.
> also I not know if when one application run on php cgi is possible
> that some application not run more (I am not an php expert so not
> know potential problmes);
It is true that there are a few things one cannot do with the CGI version,
like HTTP authentication or setting PHP config values or flags in an
..htaccess file, but if your application does not make use of either, I see
no problem.
> also I know that moduel is more fast but not know if this is so
> important for small applications in localhost;
Yes, the module version is faster (as it is loaded only once when Apache
starts). But there are many other factors that influence the speed, so I do
not think this issue is of much importance.
> a question when you move an application from php cgi to server you on
> server use module ? and you had some problems?
An application that runs fine under CGI should run fine under a PHP module.
I've never had any problems with that. Just give it a try!
Greetings,
Thomas
--
C'est pas parce qu'ils sont nombreux à avoir tort qu'ils ont raison!
(Coluche)