Can PHP 4 and 5 coexist on a single server?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Justin L. Kennedy

    #1

    Can PHP 4 and 5 coexist on a single server?

    Our current webserver is a Linux Apache 2 engine running several websites
    in separate virtual hosts. All of our websites were written for PHP 4,
    and thus is the version of PHP running. But we are looking to host a copy
    of MediaWiki which will start to require PHP 5 during the next major
    release.

    Since our existing sites are much to large to test and update to run under
    PHP 5, I want to investigate whether we can install PHP 5 and configure
    Apache to use PHP 4 for all the existings sites and use PHP 5 for the new
    one.

    Has anyone successfully done this, and how?

    --
    Justin Kennedy

  • Taariqq

    #2
    Re: Can PHP 4 and 5 coexist on a single server?

    Sorry to intrude, Justin and all,

    I am looking to do the same on an Windows XP machine.
    I have PHP 4 and Apache 2.0.55 configured and running. Looking to
    install PHP 5, and be able to switch b/w them, to test different code.

    Sincerely,
    Tariq


    Justin L. Kennedy wrote:[color=blue]
    > Our current webserver is a Linux Apache 2 engine running several websites
    > in separate virtual hosts. All of our websites were written for PHP 4,
    > and thus is the version of PHP running. But we are looking to host a copy
    > of MediaWiki which will start to require PHP 5 during the next major
    > release.
    >
    > Since our existing sites are much to large to test and update to run under
    > PHP 5, I want to investigate whether we can install PHP 5 and configure
    > Apache to use PHP 4 for all the existings sites and use PHP 5 for the new
    > one.
    >
    > Has anyone successfully done this, and how?
    >
    > --
    > Justin Kennedy[/color]

    Comment

    • Chung Leong

      #3
      Re: Can PHP 4 and 5 coexist on a single server?

      Taariqq wrote:[color=blue]
      > Sorry to intrude, Justin and all,
      >
      > I am looking to do the same on an Windows XP machine.
      > I have PHP 4 and Apache 2.0.55 configured and running. Looking to
      > install PHP 5, and be able to switch b/w them, to test different code.
      >
      > Sincerely,
      > Tariq[/color]

      For development purpose, it's probably easiest to run multiple
      instances of Apache 2.

      First, open C:\WINDOWS\syst em32\drivers\et c and add a couple aliases to
      the loopback address, like so:

      127.0.0.4 php4
      127.0.0.5 php5

      Now, when you type in http://php5/ the browsers goes to one address and
      when you type in http://php4/ it goes to another.

      Second, create two copies of httpd.conf, name them httpd.php4.conf and
      httpd.php5.conf (or whatever you feel like). In each, look for the
      Listen directive and change it from 80 to 127.0.0.4:80 and
      127.0.0.5:80. Put in the appropriate directives for loading the PHP
      modules. You will likely want to use the PHPIniDir directive to set
      the locations of php.ini.

      Third, if Apache 2 is set up as a service already, remove it. Open a
      command prompt window, cd to the Apache 2 bin folder, and enter "apache
      -k uninstall." Then add two separate Apache services with the
      following:

      apache -k install -f conf/httpd.php4.conf -n "Apache 2 (PHP 4)"
      apache -k install -f conf/httpd.php5.conf -n "Apache 2 (PHP 5)"

      When you open up Services under Administrative tools, you'll see the
      new services. Activate them. If the Apache monitor is running, restart
      it. Then you'll see the two services there as well.

      Finally, go to a phpinfo page at each location and verify the version
      and php.ini path.


      Happy coding!

      Comment

      • Sawi

        #4
        Re: Can PHP 4 and 5 coexist on a single server?

        Taariqq napisał(a):[color=blue]
        > Sorry to intrude, Justin and all,
        >
        > I am looking to do the same on an Windows XP machine.
        > I have PHP 4 and Apache 2.0.55 configured and running. Looking to
        > install PHP 5, and be able to switch b/w them, to test different code.[/color]

        This feature is present in WAMP serwer.

        --
        Pozdrawiam,
        Sawi

        Comment

        • Metin Savignano

          #5
          Re: Can PHP 4 and 5 coexist on a single server?

          > Since our existing sites are much to large to test and update to run under[color=blue]
          > PHP 5, I want to investigate whether we can install PHP 5 and configure
          > Apache to use PHP 4 for all the existings sites and use PHP 5 for the new
          > one.
          >
          > Has anyone successfully done this, and how?[/color]

          Yes, you can do that. You have to setup different application types in
          the Apache conf, and then you can map the php suffix to any of them.
          This can be done on a per-directory base using .htaccess (will be
          propagated to all directories underneath as well).

          HTH-!

          Comment

          • Justin L. Kennedy

            #6
            Re: Can PHP 4 and 5 coexist on a single server?

            Metin Savignano <ms507@zipfly.d e> wrote:[color=blue]
            > Yes, you can do that. You have to setup different application types in
            > the Apache conf, and then you can map the php suffix to any of them.
            > This can be done on a per-directory base using .htaccess (will be
            > propagated to all directories underneath as well).[/color]

            When installing PHP 5, are there precautions to make sure it won't
            overwrite files from PHP 4?

            --
            Justin Kennedy

            Comment

            Working...