Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save bonnak/f3b2373d6dddb089555d to your computer and use it in GitHub Desktop.

Select an option

Save bonnak/f3b2373d6dddb089555d to your computer and use it in GitHub Desktop.

Revisions

  1. @HuySokhom HuySokhom revised this gist Aug 15, 2014. 1 changed file with 97 additions and 0 deletions.
    97 changes: 97 additions & 0 deletions Multiple PHP under Ubuntu 12.04 or 14.04.md
    Original file line number Diff line number Diff line change
    @@ -91,6 +91,11 @@ Mine looks like this:
    custom="custom-options-$vmajor.$vminor.$vpatch.sh"
    [ -f $custom ] && source "$custom" $version $vmajor $vminor $vpatch






    ## Compile all the PHP version you need, eg

    cd /opt/phpfarm/src
    @@ -187,3 +192,95 @@ of PHP 5.4.31 at http://example.dev :)
    ## Additional Troubleshooting

    If you are having any issues with mysqli connecting, such as `Warning: mysqli_connect(): (HY000/2002): No such file or directory`, then try changing connecting to `127.0.0.1` instead of `localhost` - not sure why this is, but if you do know a "real" way of fixing it please do let me know :)



    ## More Stuff

    If you are configuring PHP5.3, this is a pretty reliable configuration set..

    #!/bin/bash
    # You can override config options very easily.
    # Just create a custom options file; it may be version specific:
    # - custom-options.sh
    # - custom-options-5.sh
    # - custom-options-5.3.sh
    # - custom-options-5.3.1.sh
    #
    # Don't touch this file here - it would prevent you to just "svn up"
    # your phpfarm source code.

    version=$1
    vmajor=$2
    vminor=$3
    vpatch=$4

    #gcov='--enable-gcov'

    configoptions="\
    --with-libdir=lib64 \
    --enable-memory-limit \
    --with-regex=php \
    --enable-sysvsem \
    --enable-sysvshm \
    --enable-sysvmsg \
    -enable-track-vars \
    --enable-trans-sid \
    --with-bz2 \
    --enable-ctype \
    --without-gdbm \
    --with-iconv \
    --enable-filepro \
    --enable-shmop \
    --with-libxml-dir=/usr \
    --with-kerberos=/usr \
    --with-openssl \
    --enable-dbx \
    --with-system-tzdata \
    --with-mysql=/usr \
    -with-mysqli=/usr/bin/mysql_config \
    --enable-pdo \
    --with-pdo-mysql=/usr \
    --enable-fastcgi \
    --enable-force-cgi-redirect \
    --with-curl \
    --enable-bcmath \
    --enable-calendar \
    --enable-exif \
    --enable-ftp \
    --with-gd \
    --with-jpeg-dir=/usr \
    --with-png-dir \
    --with-freetype-dir=/usr \
    --with-t1lib \
    --with-zlib-dir=/usr \
    --with-gettext=/usr \
    --enable-mbstring \
    --with-mcrypt=/usr \
    --with-mhash \
    --with-mime-magic \
    --enable-soap \
    --enable-sockets \
    --with-tidy \
    --enable-wddx \
    --with-xsl=/usr \
    --with-zip \
    --with-zlib \
    --enable-zip \
    $gcov"

    echo $version $vmajor $vminor $vpatch
    echo 'OK OK OK'

    #custom="custom-options.sh"
    #[ -f $custom ] && source "$custom" $version $vmajor $vminor $vpatch
    #custom="custom-options-$vmajor.sh"
    #[ -f $custom ] && source "$custom" $version $vmajor $vminor $vpatch
    #custom="custom-options-$vmajor.$vminor.sh"
    #[ -f $custom ] && source "$custom" $version $vmajor $vminor $vpatch
    #custom="custom-options-$vmajor.$vminor.$vpatch.sh"
    #[ -f $custom ] && source "$custom" $version $vmajor $vminor $vpatch




  2. @Evan-R Evan-R revised this gist Aug 14, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Multiple PHP under Ubuntu 12.04 or 14.04.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    # Multiple PHP version under Ubuntu 14.04
    # Multiple PHP version under Ubuntu 12.04 or 14.04

    ## Update your machine

  3. @Evan-R Evan-R renamed this gist Aug 14, 2014. 1 changed file with 0 additions and 0 deletions.
  4. @Evan-R Evan-R revised this gist Aug 2, 2014. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions Multiple PHP under Ubuntu 14.04.md
    Original file line number Diff line number Diff line change
    @@ -184,4 +184,6 @@ If you don't get any error you will find a working installation
    of PHP 5.4.31 at http://example.dev :)


    ## Additional Troubleshooting

    If you are having any issues with mysqli connecting, such as `Warning: mysqli_connect(): (HY000/2002): No such file or directory`, then try changing connecting to `127.0.0.1` instead of `localhost` - not sure why this is, but if you do know a "real" way of fixing it please do let me know :)
  5. @Evan-R Evan-R revised this gist Aug 2, 2014. 1 changed file with 5 additions and 2 deletions.
    7 changes: 5 additions & 2 deletions Multiple PHP under Ubuntu 14.04.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    # Multiple PHP version under Ubuntu 13.04
    # Multiple PHP version under Ubuntu 14.04

    ## Update your machine

    @@ -181,4 +181,7 @@ Then restart apache again
    service apache2 restart

    If you don't get any error you will find a working installation
    of PHP 5.4.31 at http://example.dev :)
    of PHP 5.4.31 at http://example.dev :)


    If you are having any issues with mysqli connecting, such as `Warning: mysqli_connect(): (HY000/2002): No such file or directory`, then try changing connecting to `127.0.0.1` instead of `localhost` - not sure why this is, but if you do know a "real" way of fixing it please do let me know :)
  6. @Evan-R Evan-R renamed this gist Aug 2, 2014. 1 changed file with 0 additions and 0 deletions.
  7. @Evan-R Evan-R revised this gist Aug 2, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Multiple PHP under Ubuntu 13.04.md
    Original file line number Diff line number Diff line change
    @@ -181,4 +181,4 @@ Then restart apache again
    service apache2 restart

    If you don't get any error you will find a working installation
    of PHP5.5.0 at http://example.dev :)
    of PHP 5.4.31 at http://example.dev :)
  8. @Evan-R Evan-R revised this gist Aug 2, 2014. 1 changed file with 13 additions and 13 deletions.
    26 changes: 13 additions & 13 deletions Multiple PHP under Ubuntu 13.04.md
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,7 @@
    ## Update your machine

    apt-get update
    apt-get ugrade
    apt-get upgrade

    ## Install some dependencies

    @@ -94,19 +94,19 @@ Mine looks like this:
    ## Compile all the PHP version you need, eg

    cd /opt/phpfarm/src
    ./compile.sh 5.5.0
    ./compile.sh 5.4.31

    If the compilation fails, just install the libraries that caused the error.
    In my case I had to install these packages:

    apt-get install libxml2 libxml2-dev libssl-dev libcurl4-openssl-dev pkg-config \
    libcurl4-gnutls-dev libjpeg-dev libpng12-dev libmysqlclient-dev
    ./compile.sh 5.5.0
    ./compile.sh 5.4.31

    To verify the installation

    cd /opt/phpfarm/inst/bin
    ./php-5.5.0 --version
    ./php-5.4.31 --version

    ## Install and enable FastCGI

    @@ -116,15 +116,15 @@ To verify the installation

    This will disable mod_php.

    Edit the /etc/apache2/apache2.conf, add these lines before the includes
    Edit the `/etc/apache2/apache2.conf`, add these lines before the includes

    FastCgiServer /var/www/cgi-bin/php-cgi-5.5.0
    FastCgiServer /var/www/cgi-bin/php-cgi-5.4.31
    ScriptAlias /cgi-bin-php/ /var/www/cgi-bin/

    Now create the file /var/www/cgi-bin/php-cgi-5.5.0, with this content
    Now create the file `/var/www/cgi-bin/php-cgi-5.4.31`, with this content

    #!/bin/sh
    PHPRC="/etc/php5/cgi/5.5.0/"
    PHPRC="/etc/php5/cgi/5.4.31/"
    export PHPRC

    PHP_FCGI_CHILDREN=3
    @@ -133,21 +133,21 @@ Now create the file /var/www/cgi-bin/php-cgi-5.5.0, with this content
    PHP_FCGI_MAX_REQUESTS=5000
    export PHP_FCGI_MAX_REQUESTS

    exec /opt/phpfarm/inst/bin/php-cgi-5.5.0
    exec /opt/phpfarm/inst/bin/php-cgi-5.4.31

    Make the file executable

    chmod +x /var/www/cgi-bin/php-cgi-5.5.0
    chmod +x /var/www/cgi-bin/php-cgi-5.4.31

    Configure a VirtualHost to use the php version we just configured
    eg: /etc/apache2/sites-available/example.conf
    eg: `/etc/apache2/sites-available/example.conf`

    <VirtualHost *:80>
    ServerName example.dev
    DocumentRoot /var/www/example/
    <Directory "/var/www/example">
    AddHandler php-cgi .php
    Action php-cgi /cgi-bin-php/php-cgi-5.5.0
    Action php-cgi /cgi-bin-php/php-cgi-5.4.31
    <FilesMatch "\.php$">
    SetHandler php-cgi
    </FilesMatch>
    @@ -167,7 +167,7 @@ Restart apache
    service apache2 restart

    I got an error at this point. Apache was complaining about mod_fast already defined.
    To fix the problem opne this file /etc/aoache2/mods-available/fastcgi.conf and comment out
    To fix the problem opne this file `/etc/apache2/mods-available/fastcgi.conf` and comment out
    the last line inside the IfModule block

    <IfModule mod_fastcgi.c>
  9. @Evan-R Evan-R revised this gist Aug 2, 2014. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions Multiple PHP under Ubuntu 13.04.md
    Original file line number Diff line number Diff line change
    @@ -94,14 +94,14 @@ Mine looks like this:
    ## Compile all the PHP version you need, eg

    cd /opt/phpfarm/src
    ./compile 5.5.0
    ./compile.sh 5.5.0

    If the compilation fails, just install the libraries that caused the error.
    In my case I had to install these packages:

    apt-get install libxml2 libxml2-dev libssl-dev libcurl4-openssl-dev pkg-config \
    libcurl4-gnutls-dev libjpeg-dev libpng12-dev libmysqlclient-dev
    ./compile 5.5.0
    ./compile.sh 5.5.0

    To verify the installation

  10. @gmodarelli gmodarelli revised this gist Nov 8, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Multiple PHP under Ubuntu 13.04.md
    Original file line number Diff line number Diff line change
    @@ -105,7 +105,7 @@ In my case I had to install these packages:

    To verify the installation

    cd /opt/phpfarm/src/inst/bin
    cd /opt/phpfarm/inst/bin
    ./php-5.5.0 --version

    ## Install and enable FastCGI
  11. @gmodarelli gmodarelli revised this gist Aug 28, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Multiple PHP under Ubuntu 13.04.md
    Original file line number Diff line number Diff line change
    @@ -77,7 +77,7 @@ Mine looks like this:
    --with-jpeg-dir=/usr/lib \
    --with-zlib \
    --with-gettext \
    --with-mcrypt
    --with-mcrypt \
    $gcov"

    echo $version $vmajor $vminor $vpatch
  12. @gmodarelli gmodarelli revised this gist Aug 28, 2013. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions Multiple PHP under Ubuntu 13.04.md
    Original file line number Diff line number Diff line change
    @@ -77,6 +77,7 @@ Mine looks like this:
    --with-jpeg-dir=/usr/lib \
    --with-zlib \
    --with-gettext \
    --with-mcrypt
    $gcov"

    echo $version $vmajor $vminor $vpatch
  13. @gmodarelli gmodarelli revised this gist Aug 27, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Multiple PHP under Ubuntu 13.04.md
    Original file line number Diff line number Diff line change
    @@ -57,7 +57,7 @@ Mine looks like this:
    #gcov='--enable-gcov'
    configoptions="\
    --enable-bcmath \
    --with-mysql \
    --with-mysqli \
    --with-curl \
    --with-png \
    --with-gd \
  14. @gmodarelli gmodarelli revised this gist Jul 17, 2013. 1 changed file with 64 additions and 3 deletions.
    67 changes: 64 additions & 3 deletions Multiple PHP under Ubuntu 13.04.md
    Original file line number Diff line number Diff line change
    @@ -30,15 +30,76 @@ You should see a page with the heading "It Works!"
    cd /opt
    git clone git://git.code.sf.net/p/phpfarm/code phpfarm

    ## Configure PHP

    Before compiling any PHP version, setup the options you need

    vim /opt/phpfarm/src/options.sh

    Mine looks like this:

    #!/bin/bash
    # You can override config options very easily.
    # Just create a custom options file; it may be version specific:
    # - custom-options.sh
    # - custom-options-5.sh
    # - custom-options-5.3.sh
    # - custom-options-5.3.1.sh
    #
    # Don't touch this file here - it would prevent you to just "svn up"
    # your phpfarm source code.

    version=$1
    vmajor=$2
    vminor=$3
    vpatch=$4

    #gcov='--enable-gcov'
    configoptions="\
    --enable-bcmath \
    --with-mysql \
    --with-curl \
    --with-png \
    --with-gd \
    --enable-gd-native-ttf \
    --enable-calendar \
    --enable-exif \
    --enable-ftp \
    --enable-mbstring \
    --enable-pcntl \
    --enable-soap \
    --with-pdo-mysql \
    --enable-sockets \
    --enable-sqlite-utf8 \
    --enable-wddx \
    --enable-zip \
    --with-openssl \
    --with-jpeg-dir=/usr/lib \
    --with-zlib \
    --with-gettext \
    $gcov"

    echo $version $vmajor $vminor $vpatch

    custom="custom-options.sh"
    [ -f $custom ] && source "$custom" $version $vmajor $vminor $vpatch
    custom="custom-options-$vmajor.sh"
    [ -f $custom ] && source "$custom" $version $vmajor $vminor $vpatch
    custom="custom-options-$vmajor.$vminor.sh"
    [ -f $custom ] && source "$custom" $version $vmajor $vminor $vpatch
    custom="custom-options-$vmajor.$vminor.$vpatch.sh"
    [ -f $custom ] && source "$custom" $version $vmajor $vminor $vpatch

    ## Compile all the PHP version you need, eg

    cd /opt/phpfarm/src
    ./compile 5.5.0

    If the compilation fails, just install the libraries that caused the interruption.
    My first compilation complained about libxml2 and some openssl libs missing. If that's the case for you just run
    If the compilation fails, just install the libraries that caused the error.
    In my case I had to install these packages:

    apt-get install libxml2 libxml2-dev libssl-dev libcurl4-openssl-dev pkg-config
    apt-get install libxml2 libxml2-dev libssl-dev libcurl4-openssl-dev pkg-config \
    libcurl4-gnutls-dev libjpeg-dev libpng12-dev libmysqlclient-dev
    ./compile 5.5.0

    To verify the installation
  15. @gmodarelli gmodarelli revised this gist Jun 29, 2013. 1 changed file with 14 additions and 0 deletions.
    14 changes: 14 additions & 0 deletions Multiple PHP under Ubuntu 13.04.md
    Original file line number Diff line number Diff line change
    @@ -104,5 +104,19 @@ Restart apache

    service apache2 restart

    I got an error at this point. Apache was complaining about mod_fast already defined.
    To fix the problem opne this file /etc/aoache2/mods-available/fastcgi.conf and comment out
    the last line inside the IfModule block

    <IfModule mod_fastcgi.c>
    AddHandler fastcgi-script .fcgi
    #FastCgiWrapper /usr/lib/apahce2/suexec
    #FastCgiIpcDir /var/lib/apache2/fastcgi
    </IfModule>

    Then restart apache again

    service apache2 restart

    If you don't get any error you will find a working installation
    of PHP5.5.0 at http://example.dev :)
  16. @gmodarelli gmodarelli revised this gist Jun 29, 2013. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions Multiple PHP under Ubuntu 13.04.md
    Original file line number Diff line number Diff line change
    @@ -50,6 +50,7 @@ To verify the installation

    apt-get install libapache2-mod-fastcgi apache2-mpm-worker apache2-suexec
    a2enmod actions fastcgi suexec
    service apache2 restart

    This will disable mod_php.

  17. @gmodarelli gmodarelli revised this gist Jun 29, 2013. 1 changed file with 5 additions and 2 deletions.
    7 changes: 5 additions & 2 deletions Multiple PHP under Ubuntu 13.04.md
    Original file line number Diff line number Diff line change
    @@ -46,9 +46,12 @@ To verify the installation
    cd /opt/phpfarm/src/inst/bin
    ./php-5.5.0 --version

    ## Install FastCGI
    ## Install and enable FastCGI

    apt-get install libapache2-mod-fastcgi apache2-mpm-worker apache2-suexec a2enmod actions fastcgi suexec
    apt-get install libapache2-mod-fastcgi apache2-mpm-worker apache2-suexec
    a2enmod actions fastcgi suexec

    This will disable mod_php.

    Edit the /etc/apache2/apache2.conf, add these lines before the includes

  18. @gmodarelli gmodarelli revised this gist Jun 29, 2013. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions Multiple PHP under Ubuntu 13.04.md
    Original file line number Diff line number Diff line change
    @@ -36,9 +36,9 @@ You should see a page with the heading "It Works!"
    ./compile 5.5.0

    If the compilation fails, just install the libraries that caused the interruption.
    My first compilation complained about libxml2 and an openssl lib missing. It that's the case for you run
    My first compilation complained about libxml2 and some openssl libs missing. If that's the case for you just run

    apt-get install libxml2 libxml2-dev libssl-dev
    apt-get install libxml2 libxml2-dev libssl-dev libcurl4-openssl-dev pkg-config
    ./compile 5.5.0

    To verify the installation
  19. @gmodarelli gmodarelli revised this gist Jun 29, 2013. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions Multiple PHP under Ubuntu 13.04.md
    Original file line number Diff line number Diff line change
    @@ -36,9 +36,9 @@ You should see a page with the heading "It Works!"
    ./compile 5.5.0

    If the compilation fails, just install the libraries that caused the interruption.
    My first compilation complained about libxml2 missing. It that's the case for you run
    My first compilation complained about libxml2 and an openssl lib missing. It that's the case for you run

    apt-get install libxml2 libxml2-dev
    apt-get install libxml2 libxml2-dev libssl-dev
    ./compile 5.5.0

    To verify the installation
  20. @gmodarelli gmodarelli revised this gist Jun 29, 2013. 1 changed file with 5 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion Multiple PHP under Ubuntu 13.04.md
    Original file line number Diff line number Diff line change
    @@ -35,7 +35,11 @@ You should see a page with the heading "It Works!"
    cd /opt/phpfarm/src
    ./compile 5.5.0

    If the compilation fails, just install the libraries that cause the interruption
    If the compilation fails, just install the libraries that caused the interruption.
    My first compilation complained about libxml2 missing. It that's the case for you run

    apt-get install libxml2 libxml2-dev
    ./compile 5.5.0

    To verify the installation

  21. @gmodarelli gmodarelli revised this gist Jun 29, 2013. 1 changed file with 7 additions and 0 deletions.
    7 changes: 7 additions & 0 deletions Multiple PHP under Ubuntu 13.04.md
    Original file line number Diff line number Diff line change
    @@ -5,6 +5,13 @@
    apt-get update
    apt-get ugrade

    ## Install some dependencies

    apt-get install build-essential

    This packages contain a lot of necessary tools like a c and a c++ compiler,
    make and other libs.

    ## Install git

    apt-get install git
  22. @gmodarelli gmodarelli revised this gist Jun 29, 2013. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions Multiple PHP under Ubuntu 13.04.md
    Original file line number Diff line number Diff line change
    @@ -1,9 +1,14 @@
    # Multiple PHP version under Ubuntu 13.04

    ## Update your machine

    apt-get update
    apt-get ugrade

    ## Install git

    apt-get install git

    ## Install the lamp server (Apache MySQL PHP)

    apt-get install lamp-server^
  23. @gmodarelli gmodarelli revised this gist Jun 29, 2013. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions Multiple PHP under Ubuntu 13.04.md
    Original file line number Diff line number Diff line change
    @@ -9,6 +9,9 @@
    apt-get install lamp-server^

    The installation will ask you to choose a password for the mysql root user.
    Once finished, open a tab in your browser to http://localhost

    You should see a page with the heading "It Works!"

    ## Install php-farm

  24. @gmodarelli gmodarelli revised this gist Jun 29, 2013. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions Multiple PHP under Ubuntu 13.04.md
    Original file line number Diff line number Diff line change
    @@ -8,6 +8,8 @@

    apt-get install lamp-server^

    The installation will ask you to choose a password for the mysql root user.

    ## Install php-farm

    cd /opt
  25. @gmodarelli gmodarelli revised this gist Jun 29, 2013. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions Multiple PHP under Ubuntu 13.04.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,9 @@
    # Multiple PHP version under Ubuntu 13.04

    ## Update your machine
    apt-get update
    apt-get ugrade

    ## Install the lamp server (Apache MySQL PHP)

    apt-get install lamp-server^
  26. @gmodarelli gmodarelli revised this gist Jun 28, 2013. 1 changed file with 37 additions and 39 deletions.
    76 changes: 37 additions & 39 deletions Multiple PHP under Ubuntu 13.04.md
    Original file line number Diff line number Diff line change
    @@ -2,80 +2,78 @@

    ## Install the lamp server (Apache MySQL PHP)

    apt-get install lamp-server^
    apt-get install lamp-server^

    ## Install php-farm

    cd /opt
    git clone git://git.code.sf.net/p/phpfarm/code phpfarm
    cd /opt
    git clone git://git.code.sf.net/p/phpfarm/code phpfarm

    ## Compile all the PHP version you need, eg

    cd /opt/phpfarm/src
    ./compile 5.5.0
    cd /opt/phpfarm/src
    ./compile 5.5.0

    If the compilation fails, just install the libraries that cause the interruption

    To verify the installation

    cd /opt/phpfarm/src/inst/bin
    ./php-5.5.0 --version
    cd /opt/phpfarm/src/inst/bin
    ./php-5.5.0 --version

    ## Install FastCGI

    apt-get install libapache2-mod-fastcgi apache2-mpm-worker apache2-suexec a2enmod actions fastcgi suexec
    apt-get install libapache2-mod-fastcgi apache2-mpm-worker apache2-suexec a2enmod actions fastcgi suexec

    Edit the /etc/apache2/apache2.conf, add these lines before the includes

    FastCgiServer /var/www/cgi-bin/php-cgi-5.5.0
    ScriptAlias /cgi-bin-php/ /var/www/cgi-bin/
    FastCgiServer /var/www/cgi-bin/php-cgi-5.5.0
    ScriptAlias /cgi-bin-php/ /var/www/cgi-bin/

    Now create the file /var/www/cgi-bin/php-cgi-5.5.0, with this content

    #!/bin/sh
    PHPRC="/etc/php5/cgi/5.5.0/"
    export PHPRC

    PHP_FCGI_CHILDREN=3
    export PHP_FCGI_CHILDREN

    PHP_FCGI_MAX_REQUESTS=5000
    export PHP_FCGI_MAX_REQUESTS

    exec /opt/phpfarm/inst/bin/php-cgi-5.5.0
    #!/bin/sh
    PHPRC="/etc/php5/cgi/5.5.0/"
    export PHPRC
    PHP_FCGI_CHILDREN=3
    export PHP_FCGI_CHILDREN
    PHP_FCGI_MAX_REQUESTS=5000
    export PHP_FCGI_MAX_REQUESTS
    exec /opt/phpfarm/inst/bin/php-cgi-5.5.0

    Make the file executable

    chmod +x /var/www/cgi-bin/php-cgi-5.5.0
    chmod +x /var/www/cgi-bin/php-cgi-5.5.0

    Configure a VirtualHost to use the php version we just configured
    eg: /etc/apache2/sites-available/example.conf

    <VirtualHost *:80>
    ServerName example.dev
    DocumentRoot /var/www/example/
    <Directory "/var/www/example">
    AddHandler php-cgi .php
    Action php-cgi /cgi-bin-php/php-cgi-5.5.0
    <FilesMatch "\.php$">
    SetHandler php-cgi
    </FilesMatch>
    </Directory>
    </VirtualHost>
    <VirtualHost *:80>
    ServerName example.dev
    DocumentRoot /var/www/example/
    <Directory "/var/www/example">
    AddHandler php-cgi .php
    Action php-cgi /cgi-bin-php/php-cgi-5.5.0
    <FilesMatch "\.php$">
    SetHandler php-cgi
    </FilesMatch>
    </Directory>
    </VirtualHost>

    Enable the site

    a2ensite example.conf
    a2ensite example.conf

    Add the server to /etc/hosts

    127.0.0.1 example.dev
    127.0.0.1 example.dev

    Restart apache

    service apache2 restart
    service apache2 restart

    If you don't get any error you will find a working installation
    of PHP5.5.0 at http://example.dev :)


    of PHP5.5.0 at http://example.dev :)
  27. @gmodarelli gmodarelli renamed this gist Jun 28, 2013. 1 changed file with 0 additions and 0 deletions.
  28. @gmodarelli gmodarelli revised this gist Jun 28, 2013. 1 changed file with 29 additions and 16 deletions.
    45 changes: 29 additions & 16 deletions Multiple PHP under Ubuntu 13.04
    Original file line number Diff line number Diff line change
    @@ -1,27 +1,36 @@
    # Install the lamp server (Apache MySQL PHP)
    # Multiple PHP version under Ubuntu 13.04

    ## Install the lamp server (Apache MySQL PHP)

    apt-get install lamp-server^

    # Install php-farm
    ## Install php-farm

    cd /opt
    git clone git://git.code.sf.net/p/phpfarm/code phpfarm

    # Compile all the PHP version you need, eg
    ## Compile all the PHP version you need, eg

    cd /opt/phpfarm/src
    ./compile 5.5.0

    # If the compilation fails, just install the libraries that cause the interruption
    # To verify the installation
    If the compilation fails, just install the libraries that cause the interruption

    To verify the installation

    cd /opt/phpfarm/src/inst/bin
    ./php-5.5.0 --version

    # Install FastCGI
    ## Install FastCGI

    apt-get install libapache2-mod-fastcgi apache2-mpm-worker apache2-suexec a2enmod actions fastcgi suexec

    # Edit the /etc/apache2/apache2.conf, add these lines before the includes
    Edit the /etc/apache2/apache2.conf, add these lines before the includes

    FastCgiServer /var/www/cgi-bin/php-cgi-5.5.0
    ScriptAlias /cgi-bin-php/ /var/www/cgi-bin/

    # Now create the file /var/www/cgi-bin/php-cgi-5.5.0, with this content
    Now create the file /var/www/cgi-bin/php-cgi-5.5.0, with this content

    #!/bin/sh
    PHPRC="/etc/php5/cgi/5.5.0/"
    @@ -35,11 +44,12 @@ export PHP_FCGI_MAX_REQUESTS

    exec /opt/phpfarm/inst/bin/php-cgi-5.5.0

    # Make the file executable
    Make the file executable

    chmod +x /var/www/cgi-bin/php-cgi-5.5.0

    # Configure a VirtualHost to use the php version we just configured
    # eg: /etc/apache2/sites-available/example.conf
    Configure a VirtualHost to use the php version we just configured
    eg: /etc/apache2/sites-available/example.conf

    <VirtualHost *:80>
    ServerName example.dev
    @@ -53,16 +63,19 @@ chmod +x /var/www/cgi-bin/php-cgi-5.5.0
    </Directory>
    </VirtualHost>

    # Enable the site
    Enable the site

    a2ensite example.conf

    # Add the server to /etc/hosts
    Add the server to /etc/hosts

    127.0.0.1 example.dev

    # Restart apache
    Restart apache

    service apache2 restart

    # If you don't get any error you will find a working installation
    # of PHP5.5.0 at http://example.dev :)
    If you don't get any error you will find a working installation
    of PHP5.5.0 at http://example.dev :)


  29. @gmodarelli gmodarelli revised this gist Jun 28, 2013. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions Multiple PHP under Ubuntu 13.04
    Original file line number Diff line number Diff line change
    @@ -39,6 +39,8 @@ exec /opt/phpfarm/inst/bin/php-cgi-5.5.0
    chmod +x /var/www/cgi-bin/php-cgi-5.5.0

    # Configure a VirtualHost to use the php version we just configured
    # eg: /etc/apache2/sites-available/example.conf

    <VirtualHost *:80>
    ServerName example.dev
    DocumentRoot /var/www/example/
    @@ -51,6 +53,9 @@ chmod +x /var/www/cgi-bin/php-cgi-5.5.0
    </Directory>
    </VirtualHost>

    # Enable the site
    a2ensite example.conf

    # Add the server to /etc/hosts
    127.0.0.1 example.dev

  30. @gmodarelli gmodarelli created this gist Jun 28, 2013.
    63 changes: 63 additions & 0 deletions Multiple PHP under Ubuntu 13.04
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,63 @@
    # Install the lamp server (Apache MySQL PHP)
    apt-get install lamp-server^

    # Install php-farm
    cd /opt
    git clone git://git.code.sf.net/p/phpfarm/code phpfarm

    # Compile all the PHP version you need, eg
    cd /opt/phpfarm/src
    ./compile 5.5.0

    # If the compilation fails, just install the libraries that cause the interruption
    # To verify the installation
    cd /opt/phpfarm/src/inst/bin
    ./php-5.5.0 --version

    # Install FastCGI
    apt-get install libapache2-mod-fastcgi apache2-mpm-worker apache2-suexec a2enmod actions fastcgi suexec

    # Edit the /etc/apache2/apache2.conf, add these lines before the includes
    FastCgiServer /var/www/cgi-bin/php-cgi-5.5.0
    ScriptAlias /cgi-bin-php/ /var/www/cgi-bin/

    # Now create the file /var/www/cgi-bin/php-cgi-5.5.0, with this content

    #!/bin/sh
    PHPRC="/etc/php5/cgi/5.5.0/"
    export PHPRC

    PHP_FCGI_CHILDREN=3
    export PHP_FCGI_CHILDREN

    PHP_FCGI_MAX_REQUESTS=5000
    export PHP_FCGI_MAX_REQUESTS

    exec /opt/phpfarm/inst/bin/php-cgi-5.5.0

    # Make the file executable
    chmod +x /var/www/cgi-bin/php-cgi-5.5.0

    # Configure a VirtualHost to use the php version we just configured
    <VirtualHost *:80>
    ServerName example.dev
    DocumentRoot /var/www/example/
    <Directory "/var/www/example">
    AddHandler php-cgi .php
    Action php-cgi /cgi-bin-php/php-cgi-5.5.0
    <FilesMatch "\.php$">
    SetHandler php-cgi
    </FilesMatch>
    </Directory>
    </VirtualHost>

    # Add the server to /etc/hosts
    127.0.0.1 example.dev

    # Restart apache
    service apache2 restart

    # If you don't get any error you will find a working installation
    # of PHP5.5.0 at http://example.dev :)