Re: how use php4 / php5 in localhost



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/"
<Directory "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]
</Directory>

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)


.



Relevant Pages

  • Re: Php error in module mode and not in CGI
    ... Here is phpinfo with php module: ... Directive Local Value Master Value ... SMTP localhost localhost ... Interfaces Countable, OuterIterator, RecursiveIterator, SeekableIterator, ...
    (comp.lang.php)
  • Re: Why is localhost added to all my links ?
    ... Hal Halloway wrote: ... if you prefix a URL with http:// or just a /, ... > is and localhost is not added. ... PHP does have a mechanism via which you can control what markup elements ...
    (comp.lang.php)
  • Re: Check out this email....[Fwd: The next big thing for websites]
    ... still brings up my own localhost account. ... its not online and its only my localhost account. ... For example if you are using php: ... importantly to see how successful their spam is and collect IP ...
    (Ubuntu)
  • Re: Sending email from PHP script.
    ... I am testing my scripts on localhost with PHP ... reconfigure PHP or Appache. ... PHP must be able to access a mail server. ...
    (comp.lang.php)
  • Re: Sending email from PHP script.
    ... reconfigure PHP or Appache. ... I had this issue awhile back and found a good 'free' mail server that allowed me to use mailon the localhost to test email coding. ...
    (comp.lang.php)