Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Page 1 of 3 1 2 3 LastLast
Results 1 to 15 of 42
  1. #1
    Member
    Join Date
    Feb 2003
    Posts
    29

    Question PHP5 & PHP4 Hosting Options

    To Quote http://www.iniquinet.com/php5_hosting.php
    PHP5 is here!

    Stay on the cutting edge of web technology with PHP5. We stay up to date with the latest releases!

    We can convert your entire webspace to PHP5 or you may optionally have PHP4 + PHP5 support in the same webspace. (Files with the .php extension are processed by PHP4 while .php5 files are processed by PHP5) This is the ultimate development platform! If you're looking for the incredible power of Fantastico and cPanel with PHP5, we highly suggest you check out our cPanel hosting site A2 Web Hosting. We're one of the first to offer Fantastico, cPanel, PHP4, PHP5 and incredible support all in one package.

    We are also happy to install any other PHP modules or other extensions you need as long as they don't affect server stability and security. These will be handled on a case by case basis. If you have any questions, please feel free to contact us.

    Add a MySQL or Postgres database for a truly comprehensive development environment!

    Hint: When you sign up, ask for PHP 5 to be enabled for your account. Otherwise PHP 4 will be the default.
    How is this sort of setup possible in cpanel? This sounds like a great stepping stone to get users moving towards PHP5 without killing all your php4 customers.


    Mark

  2. #2
    Member
    Join Date
    Sep 2004
    Posts
    529

    Default

    Use the search button on the top menu...

    there was another thread recently that discussed installing both versions at the same time.

  3. #3
    Member
    Join Date
    Sep 2004
    Posts
    422

    Default

    I have installed php4 + php5 onto a server for testing (both running as apache modules, rather than run 1 as a module and 1 as CGI).

    I did this by installing a second apache installation onto the server with php5 configured --with-apxs=/path/to/apache_php5/apxs and installing mod_proxy into the original apache server, allowing only localhost to access the second apache install which runs on a different port.

    This way, the users can test php5 in an apache module environment, as it would be when we install it instead of php4 ... if that happens, eventually.

  4. #4
    Member
    Join Date
    Jan 2004
    Location
    Manhattan
    Posts
    37

    Default hey ... that's me :)

    I was the one who set it up originally for Iniquinet.com (quoted in first post of this thread) and did the same thing for www.a2hosting.com

    Basically I did what DigitalN described. That's the best way I could think to do it since you can't load both modules in the same Apache, and running one as a CGI didn't seem like a good solution either.

  5. #5
    Member
    Join Date
    Feb 2003
    Posts
    29

    Default

    Quote Originally Posted by barwin
    I was the one who set it up originally for Iniquinet.com (quoted in first post of this thread) and did the same thing for www.a2hosting.com

    Basically I did what DigitalN described. That's the best way I could think to do it since you can't load both modules in the same Apache, and running one as a CGI didn't seem like a good solution either.
    Awesome, thanks :-D Would you have the time or patience to post up a step by step of what you did? I'm wondering if cpanel's apache builder will eventually go this route as they integrate php5 more.

    Thanks,
    Mark

  6. #6
    Member
    Join Date
    Sep 2004
    Posts
    422

    Default

    Quote Originally Posted by djspark
    Awesome, thanks :-D Would you have the time or patience to post up a step by step of what you did? I'm wondering if cpanel's apache builder will eventually go this route as they integrate php5 more.

    Thanks,
    Mark
    I will post a How To do this at the weekend if I have the time - Unless someone beats me to it

  7. #7
    Member
    Join Date
    Feb 2003
    Posts
    29

    Default

    Quote Originally Posted by DigitalN
    I will post a How To do this at the weekend if I have the time - Unless someone beats me to it
    Thank you very much! I doubt anyone will beat you to it since everyone else I talked to is under NDA

    Thanks again,

    Mark

  8. #8
    Member
    Join Date
    Feb 2003
    Posts
    29

    Default

    Quote Originally Posted by DigitalN
    I will post a How To do this at the weekend if I have the time - Unless someone beats me to it
    was this posted somewhere else?


    mark

  9. #9
    Member
    Join Date
    Sep 2004
    Posts
    422

    Default

    Quote Originally Posted by djspark
    was this posted somewhere else?


    mark
    No, haven't really had the time to think about posting a how to for this (and haven't had any offers of crossing my palm with gold to do it for anyone either ) but maybe I'll post an example install for you shortly.

  10. #10
    Member
    Join Date
    Sep 2004
    Posts
    422

    Default

    OK, here is an example of how you can run mod_php + mod_php5 on the same server.

    NOTE: This covers the installation where you are running mod_php - It won't work for people wanting to use phpsuexec and cgi installs of php.

    Disclaimer: You are on your own, if you use or follow any of the following advice and you have any problems, you should be able to work things out for yourself. If you aren't competent in installing apache/php and solving simple related problems, then I would advise that you proceed at your own risk.

    Ok,

    If you have installed cpanels apache lately, cd to the directory where apache was installed and copy the buildscript to buildscriptphp5

    Otherwise, reinstall apache


    Code:
    # cd /usr/local/src 
    # wget http://layer1.cpanel.net/buildapache.sea
    # sh buildapache.sea
    Make sure to select the option to install apache, even if the version is the same.

    Then when apache has been reinstalled and is back running, cd to wherever your buildapache is, could be /usr/local/src or /home/cpapachebuild

    Code:
    # cd buildapache
    
    # cp buildscript buildscriptphp5
    Now edit the file buildscriptphp5

    Replace the following at around line 24

    Code:
    REWRITE="--enable-module=rewrite --enable-shared=rewrite"
    WITH

    Code:
    REWRITE="--enable-module=rewrite --enable-shared=rewrite --enable-module=proxy --enable-shared=proxy"
    I am assuming here that you will have built apache with mod_rewrite enabled, if you haven't got that line within buildscriptphp5 then add --enable-module=proxy --enable-shared=proxy
    to the apache ./configure line lower down the script.

    Now, to install apache as you did the last time you ran the buildapache install script, with the new addition of mod_proxy type

    Code:
    # rm -rf apache_1.3.33 mod_ssl-2.8.22-1.3.33
    # ./buildscriptphp5
    Assuming all went well and your new apache install has kicked up ok, check the following and add to /usr/local/apache/conf/httpd.conf if you need to

    Create a file to hold all the php5 enabled vhosts

    Code:
    # touch /usr/local/apache/conf/httpd.php5.conf
    Edit httpd.conf, make sure these are included and add the Include within your vhost section of httpd.conf

    Within the LoadModule config

    Code:
    LoadModule proxy_module       libexec/libproxy.so
    Within the AddModule config

    Code:
    AddModule mod_proxy.c
    Then within your Vhost config add

    Code:
    <IfModule mod_proxy.c>
    Include /usr/local/apache/conf/httpd.php5.conf
    </IfModule>

    Then restart apache, watch for any errors

    Code:
    # /etc/init.d/httpd graceful
    The above will enable mod_proxy into your existing apache installation, which we will use later on to access the second install of apache.

    Right, now we will install our second installation of apache, this is where mod_php5 will be installed and running from.

    Code:
    # cd /usr/local/src
    You can use this to install apache if needed, basically just download apache from your apache mirror or use the one that the cpanel script downloaded for you earlier if need be.
    Just change the apache url (APACHE variable) or comment the download part out if you copy the files locally.

    This will install apache into

    /usr/local/apache_php5

    using --prefix=/usr/local/apache_php5

    Create the apache install script named anything you like and enter the following

    Code:
    #!/bin/sh
    # Install apache for php5 - Make listen to 127.0.0.1 port 8080
    # or a port of your choosing.
    
    # Change the apache mirror to where yours is http://httpd.apache.org/download.cgi
    APACHE="http://Your_apache_mirror/apache_1.3.33.tar.gz"
    
    if [ ! -e "/usr/local/src/apache-php5" ]; then
    mkdir /usr/local/src/apache-php5
    fi
    cd /usr/local/src/apache-php5
    if [ ! -e "/usr/local/src/apache-php5/apache_1.3.33.tar.gz" ]; then
    wget -c $APACHE
    fi
    if [ ! -e "/usr/local/src/apache-php5/mod_ssl-2.8.22-1.3.33" ]; then
    wget -c http://www.modssl.org/source/mod_ssl-2.8.22-1.3.33.tar.gz
    fi
    if [ -d "/usr/local/src/apache-php5/mod_ssl-2.8.22-1.3.33" ]; then
    rm -rf /usr/local/src/apache-php5/mod_ssl-2.8.22-1.3.33
    fi
    if [ -d "/usr/local/src/apache-php5/apache_1.3.33" ]; then
    rm -rf /usr/local/src/apache-php5/apache_1.3.33
    fi
    tar xvzf mod_ssl-2.8.22-1.3.33.tar.gz
    tar xvzf apache_1.3.33.tar.gz
    cd /usr/local/src/apache-php5/mod_ssl-2.8.22-1.3.33
    SSL_BASE=/usr \
    CFLAGS="-DEAPI" \
    ./configure --with-apache=/usr/local/src/apache-php5/apache_1.3.33 \
    --prefix=/usr/local/apache_php5 --with-ssl=/usr \
    --enable-module=rewrite --enable-shared=rewrite \
    --enable-module=ssl --enable-shared=ssl \
    --enable-suexec \
    --suexec-logfile=/usr/local/apache_php5/logs/suexec_log \
    --suexec-caller=nobody \
    --suexec-uidmin=100 \
    --suexec-gidmin=100 \
    --suexec-docroot=/ \
    --suexec-userdir=public_html \
    --enable-module=expires --enable-shared=expires \
    --enable-module=so
    
    cd /usr/local/src/apache-php5/apache_1.3.33
    SSL_BASE=/usr \
    C_INCLUDE_PATH=/usr/kerberos/include make
    C_INCLUDE_PATH=/usr/kerberos/include make certificate
    C_INCLUDE_PATH=/usr/kerberos/include make install
    This is assuming redhat and that you want SSL to be enabled for this apache install, I haven't enabled ssl and you will need to figure that out if you need it.
    If you don't want SSL to be enabled.
    Enter the defaults or your details when prompted for the SSL cert details.
    Do not say 'y' to having the ssl cert password protected, the one that is generated with 'make certificate' otherwise you will need to type in that pass everytime that you restart this installation of apache.

    Now if the install went ok,

    edit /usr/local/apache_php5/conf/httpd.conf

    Change the Values and add as per the following

    Code:
    Listen 127.0.0.1:8080
    Code:
    #
    # Port: The port to which the standalone server listens. For
    # ports < 1023, you will need httpd to be run as root initially.
    #
    Port 8080
    Code:
    <IfDefine SSL>
    Listen 8080
    Listen 8081
    </IfDefine>
    Within the Vhost section, add

    Code:
    NameVirtualHost 127.0.0.1:8080
    Assuming all goes well

    /usr/local/apache_php5/bin/apachectl start

    You should see

    Code:
    # ps auxf
    Code:
    /usr/local/apache_php5/bin/httpd
    nobody   25971  0.0  1.0 16288 5616 ?        S    12:40   0:00  \_ /usr/local/apache_php5/bin/httpd
    nobody   25972  0.0  1.0 16320 5436 ?        S    12:40   0:00  \_ /usr/local/apache_php5/bin/httpd
    nobody   25973  0.0  1.1 16288 5620 ?        S    12:40   0:00  \_ /usr/local/apache_php5/bin/httpd
    nobody   25974  0.0  1.1 16288 5628 ?        S    12:40   0:00  \_ /usr/local/apache_php5/bin/httpd
    nobody   25975  0.0  1.0 16320 5436 ?        S    12:40   0:00  \_ /usr/local/apache_php5/bin/httpd
    nobody   25976  0.0  1.0 16188 5356 ?        S    12:40   0:00  \_ /usr/local/apache_php5/bin/httpd
    If not, then check the error logs for further clues

    /usr/local/apache_php5/logs/error_log
    Last edited by DigitalN; 02-15-2005 at 05:51 PM.

  11. #11
    Member
    Join Date
    Sep 2004
    Posts
    422

    Default

    Part 2

    Ok, lets now install php 5

    Download and extract php5 - www.php.net choose your mirror or download from elsewhere.

    You can use the following to install php into /usr/bin/php5

    If you need other modules included or get errors when the ./configure runs, you will need to install what you need or remove the --with-whatever from the script until the install goes clean.

    cd /usr/local/src

    Assuming you have extracted php-5.0.3 already into /usr/local/src (if not then do that)

    Code:
    #!/bin/sh
    PHPVERSION="5.0.3"
    
    cd php-$PHPVERSION
    if [ -f "Makefile" ]; then
    make clean
    fi
    ./configure --with-apxs=/usr/local/apache_php5/bin/apxs --prefix=/usr/local/php5 --with-config-file-path=/usr/local/lib/php5 --with-xml --enable-bcmath --enable-calendar --with-curl --with-dom --with-dom-xslt --with-dom-exslt --enable-exif --enable-ftp --with-gd --with-jpeg-dir=/usr/local --with-png-dir=/usr --with-xpm-dir=/usr/X11R6 --with-gettext --with-imap --with-imap-ssl --with-kerberos --enable-mbstring --enable-mbstr-enc-trans --enable-mbregex --enable-magic-quotes --with-mysql=/usr --enable-discard-path --with-pear --with-pgsql=/usr --with-pspell --enable-safe-mode --enable-sockets --enable-track-vars --with-ttf --with-freetype-dir=/usr --enable-gd-native-ttf --enable-versioning --enable-wddx --with-xmlrpc --with-zip --with-zlib
    make
    make install
    if [ ! -e "/usr/local/lib/php5" ]; then
    mkdir /usr/local/lib/php5
    fi
    /bin/cp php.ini-dist /usr/local/lib/php5/php.ini
    if [ -f "/usr/local/lib/php5/php.ini" ]; then
    echo " Review the php config /usr/local/lib/php5/php.ini .. then"
    fi
    echo " Restart apache_php5 /usr/local/apache_php5/bin/apachectl graceful"
    cd ..
    Now check that you have the following and add to /usr/local/apache_php5/conf/httpd.conf

    Code:
    LoadModule php5_module        libexec/libphp5.so
    Code:
    AddModule mod_php5.c
    Code:
    <IfModule mod_dir.c>
        DirectoryIndex index.html index.php index.pl index.cgi index.htm
    </IfModule>
    Code:
        AddHandler cgi-script .cgi .pl
        AddType application/x-httpd-php .php
        #
        # To use server-parsed HTML files
        #
        AddType text/html .shtml
        AddHandler server-parsed .shtml
    Add any other extensions as needed, but those will do for a default install.

    Now, restart your php5 enabled apache

    Code:
    # /usr/local/apache_php5/bin/apachectl graceful
    Assuming no errors, you should see

    Code:
    # ps auxf
    Code:
    /usr/local/apache_php5/bin/httpd
    nobody   25971  0.0  1.0 16288 5616 ?        S    12:40   0:00  \_ /usr/local/apache_php5/bin/httpd
    nobody   25972  0.0  1.0 16320 5436 ?        S    12:40   0:00  \_ /usr/local/apache_php5/bin/httpd
    nobody   25973  0.0  1.1 16288 5620 ?        S    12:40   0:00  \_ /usr/local/apache_php5/bin/httpd
    nobody   25974  0.0  1.1 16288 5628 ?        S    12:40   0:00  \_ /usr/local/apache_php5/bin/httpd
    nobody   25975  0.0  1.0 16320 5436 ?        S    12:40   0:00  \_ /usr/local/apache_php5/bin/httpd
    nobody   25976  0.0  1.0 16188 5356 ?        S    12:40   0:00  \_ /usr/local/apache_php5/bin/httpd
    Right now all that is really left is to add a Vhost that we will use for php5 usage

    edit /usr/local/apache/conf/httpd.php5.conf

    xxx.xxx.xxx.xxx is the IP of the site, could be your shared IP.
    Replace php5.domain.com with your sites - I have added an example here that will simply use a subdomain to access the php5 installation. If you want to redirect based on file extension say .php5 then you need to do something different.

    Code:
    ProxyRequests Off
    <VirtualHost xxx.xxx.xxx.xxx>
    Servername php5.domain.com
    ServerAlias php5.domain.com
    DocumentRoot /home/user/public_html
    User user
    Group user
    ProxyPass / http://proxy.domain.com:8080/
    ProxyPassReverse / http://proxy.domain.com:8080/
    </VirtualHost>
    Now edit the php5 httpd.conf /usr/local/apache_php5/conf/httpd.conf

    Add the Vhost for the redirect domain - proxy.domain.com

    Code:
    NameVirtualHost 127.0.0.1:8080
    <VirtualHost 127.0.0.1>
    ServerName proxy.domain.com
    ServerAlias proxy.domain.com
    DocumentRoot /home/user/public_html
    User user
    Group user
    ErrorLog logs/proxy.domain.com-error_log
    CustomLog logs/proxy.domain.com-access_log common
    ScriptAlias /cgi-bin/ /home/user/public_html/cgi-bin/
    </VirtualHost>
    Make sure the A records are added for php5 and proxy as follows

    edit

    /var/named/domain.com.db

    Code:
    php5  IN   A   xxx.xxx.xxx.xxx
    proxy     IN    A     127.0.0.1
    The xxx.xxx.xxx.xxx IP as the same as you added in the apache vhost /usr/local/apache/conf/httpd.php5.conf

    Reload named

    Code:
    # rndc reload
    Restart both installs of apache

    Code:
    # /etc/init.d/httpd graceful
    Code:
    # /usr/local/apache_php5/bin/apachectl graceful
    Now make a test page

    Code:
    # echo "<? phpinfo();?>" > /home/user/public_html/testphp5.php
    All being well

    http://php5.domain.com/testphp5.php

    will show up a phpinfo page with the php 5 installation details.

    I hope this is a helping hand as to how you can do this installation - Good luck


    References:

    http://httpd.apache.org
    http://httpd.apache.org/docs/mod/mod_proxy.html
    www.php.net
    Last edited by DigitalN; 02-14-2005 at 09:17 PM.

  12. #12
    Member
    Join Date
    Jan 2005
    Posts
    13

    Default

    Just did the tutorial and it works great. I had a few issues with getting mod_proxy on my current apache install, so all I did was complied mod_proxy on my linux test box and moved the .so over.


    If you want to redirect based on file extension say .php5 then you need to do something different.
    Is there an easy way to do that? If so, what would I have to do?


    Thanks for the tutorial.

    Ryan

  13. #13
    Member
    Join Date
    Sep 2004
    Posts
    422

    Default

    Quote Originally Posted by rgyure
    Just did the tutorial and it works great. I had a few issues with getting mod_proxy on my current apache install, so all I did was complied mod_proxy on my linux test box and moved the .so over.
    You could try to cd the apache module src and install it like

    cd apache_1.3.33/src/modules/proxy/

    /usr/local/apache/bin/apxs -cia mod_proxy.c

  14. #14
    Member
    Join Date
    Jan 2005
    Posts
    13

    Default

    Quote Originally Posted by DigitalN
    You could try to cd the apache module src and install it like

    cd apache_1.3.33/src/modules/proxy/

    /usr/local/apache/bin/apxs -cia mod_proxy.c
    I got mod_proxy all worked out. I built mod_proxy off my test linux machine.

    The thing I want to know about is this:
    If you want to redirect based on file extension say .php5 then you need to do something different.

    Ryan
    Last edited by rgyure; 02-15-2005 at 10:56 PM.

  15. #15
    Member
    Join Date
    Sep 2004
    Posts
    422

    Default

    Quote Originally Posted by rgyure
    I got mod_proxy all worked out. I build mod_proxy off my test linux machine.

    The thing I want to know about is this:



    Ryan
    I've given you all a good start - You can work the rest out and modify to do as you need it to do, including redirecting based on file extension - There are a few ways of achieving the same thing, you could use mod_rewrite rules or something else, what works for you is the best.

Similar Threads & Tags
Similar threads

  1. php4 & php5, 500 errors
    By dxm in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 11-05-2009, 07:51 PM
  2. apache 2 + php4&5 - php5 files not being parsed
    By DBJoshua in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 10-18-2007, 09:19 AM
  3. Configure php4 & php5 with easyapache?
    By Anthony-mmbcom in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 07-22-2005, 09:34 PM
  4. PHP4 & PHP5 together on one server under phpsuexec
    By WMS in forum cPanel and WHM Discussions
    Replies: 7
    Last Post: 02-23-2005, 10:05 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube