Results 1 to 5 of 5

Thread: Multiple PHP versions using htaccess

  1. #1
    Join Date
    Apr 2006
    Beans
    35

    Multiple PHP versions using htaccess

    I am trying to use php 5.3 and php 5.4 in my development server, and choose between them using htaccess.

    I have made a mix of this two guides:
    http://zgadzaj.com/how-to-install-ph...on-ubuntu-1204

    http://www.webhostrepo.com/blog/runn...-cpanel-server

    But I am quite missing something.

    1. compiled ok
    2. installation ok
    3. create the handler
    4. modify apache config to recongize the handler
    5. create htaccess to use the handler


    Any hint?

  2. #2
    Join Date
    Apr 2006
    Beans
    35

    Re: Multiple PHP versions using htaccess

    I forgot to tell I am using ubuntu 12.04

  3. #3
    Join Date
    Sep 2006
    Beans
    7,635
    Distro
    Lubuntu Development Release

    Re: Multiple PHP versions using htaccess

    .htaccess is only needed if it is not your server and you do not have access to the actual configuration files. If you have access to the web server's configuration file, then you can use that instead.

  4. #4
    Join Date
    Apr 2006
    Beans
    35

    Re: Multiple PHP versions using htaccess

    I want to use htacces because I want to select php version "per site", not for the whole server.

    I added at /etc/apache2/sites-available/default:
    <code>
    ScriptAlias /php54-cgi /usr/lib/cgi-bin/php54-cgi
    Action application/x-httpd-php54 /php54-cgi
    AddType application/x-httpd-php54 .php
    </code>

    and at .htaccess:
    <code>
    AddHandler application/x-httpd-php54 .php
    </code>

  5. #5
    Join Date
    Sep 2006
    Beans
    7,635
    Distro
    Lubuntu Development Release

    AddHandler

    per-site customizations are exactly what the configuration files are for. A separate one is made for each vhost or else if you want separate configurations for special directories use the <Directory> configuration directive within a vhost and put the handler info inside that. It will save trouble down the road to have everything in one place rather than scattered around in multiple (possibly conflicting) .htaccess files.

    Wherever you do put the handler information, maybe you could try SetHandler instead of AddHandler to override the default. I haven't tried mixing PHP versions though.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •