In demand

ad1

Thursday, September 24, 2015

How to Install PHP7 on Linux Today!

The PHP development team announces the immediate availability of PHP 7.0.0 RC 3. This is the eighth pre-release of the new PHP 7 major series. All users of PHP are encouraged to test this version carefully, and report any bugs and incompatibilities in the bug tracking system. Many are waiting for php7 to appear on launchpad or in a experimental repo. But you can install PHP7 release candidates today and get started with developing with it.

Here are the instructions and resources for creating a development for you r local machine , VPS or virtual machine. 

 

Start with Webmin


Since I want an easy to administrate development laptop I choose not to sit at the command line creating websites, administating and updating the LAMP stack. I'll use a GUI, Webmin to remove most of the burden of having to remember everything. Webmin is a web-based interface for system administration for Unix. Using any modern web browser, you can setup user accounts, Apache, DNS, file sharing and much more. Webmin removes the need to manually edit Unix configuration files like /etc/passwd, and lets you manage a system from the console or remotely.

Webmin for Ubuntu and Debian


Open a terminal:

  1. Run below command to edit the source file

    sudo vi /etc/apt/sources.list
    

  2. Press i on keyboard to start editing the file and add this line into the end. Press Esc to exit edit. Shift + : and followed by wq to save the changes.

    deb http://download.webmin.com/download/repository sarge contrib

  3. Now execute command to download and install the key.

    wget -q http://www.webmin.com/jcameron-key.asc -O- | sudo apt-key add -

  4. After that, you can always use below commands to install the latest version of Webmin

    sudo apt-get update
    sudo apt-get install webmin
    

Finally in your client’s web browser go to the webmin login page http://youripaddress:10000 the login is the username and password of your linux installation.

Webmin for Redhat and Cent OS

  1. Open a terminal and enter
    nano /etc/yum.repos.d/webmin.repo
  2. Paste the following text:
    [Webmin]
    
    name=Webmin Distribution Neutral
    
    
    #baseurl=http://download.webmin.com/download/yum
    
    
    mirrorlist=http://download.webmin.com/download/yum/mirrorlist
    
    
    enabled=1
    
  3. CTRL+O to save then CTRL+X to exit.
  4. Install the GPG key and Webmin:
    wget http://www.webmin.com/jcameron-key.asc
    rpm --import jcameron-key.as
    yum install webmin
    

Once Webmin has finished installing you should be load the following address in your browser. http://youripaddress:10000 the login is the username and password of your linux installation.

Get PHP 7

PHP 7 for Ubuntu and Debian


Ubuntu is debian under the skin. It's hard to know though which Debian package is under which Ubuntu release. Here's a chart for reference.

Once you know this there's a whole new world of experimentation open to you. The one I like to use Dotdeb over debian experimental. Less noise and faster updates. Dotdeb is a repository containing packages to turn your Debian boxes into powerful, stable and up-to-date LAMP servers :
  • Nginx,
  • PHP 7.0 (preview), 5.6, 5.5, 5.4 and 5.3,
  • useful PHP extensions : apcu, imagick, mongo, Pinba, xcache, Xdebug, XHprof…
  • MySQL 5.5 and 5.6
  • Percona toolkit,
  • Redis,
  • Zabbix
Dotdeb supports :
  • Debian 8.x “Jessie“,
  • Debian 7.x “Wheezy” and Debian 6.x “Squeeze
  • both amd64 and i386 architectures


Branch Ubuntu Release Codename Debian release
15.04 vivid jessie / sid Debian 8.x
14.10 utopic jessie / sid Debian 8.x
14.04 trusty jessie / sid Debian 8.x
13.10 saucy wheezy / sid Debian 7.x
13.04 raring wheezy / sid Debian 7.x
12.10 quantal wheezy / sid Debian 7.x
12.04 precise wheezy / sid Debian 7.x
11.10 oneirc wheezy / sid Debian 7.x
11.04 natty squeeze / sid Debian 6.x
10.10 maverick squeeze / sid Debian 6.x
10.04 lucid squeeze / sid Debian 6.x

Using Dotdeb is very simple:

1. Add the main repository to your sources.list

Depending on your distribution (Jessie, Wheezy or Squeeze), add these two lines to your /etc/apt/sources.list file (you can also choose a mirror near you) :

deb http://packages.dotdeb.org jessie all
deb-src http://packages.dotdeb.org jessie all

or

deb http://packages.dotdeb.org wheezy all
deb-src http://packages.dotdeb.org wheezy all

or

deb http://packages.dotdeb.org squeeze all
deb-src http://packages.dotdeb.org squeeze all

2. Options

If you want to install :
  • PHP 7.0 on Debian 8 “Jessie” (rc3), add these two lines too :
    deb http://packages.dotdeb.org jessie-php7.0 all
    deb-src http://packages.dotdeb.org jessie-php7.0 all
     
  • PHP 5.6 on Debian 7 “Wheezy” (without Zend thread safety), add these two lines too :
    deb http://packages.dotdeb.org wheezy-php56 all
    deb-src http://packages.dotdeb.org wheezy-php56 all
  • PHP 5.6 on Debian 7 “Wheezy” (with Zend thread safety), add these two lines instead :
    deb http://packages.dotdeb.org wheezy-php56-zts all
    deb-src http://packages.dotdeb.org wheezy-php56-zts all
  • PHP 5.5 on Debian 7 “Wheezy”, add these two lines too :
    deb http://packages.dotdeb.org wheezy-php55 all
    deb-src http://packages.dotdeb.org wheezy-php55 all
  • PHP 5.4 on Debian 6 “Squeeze”, add these two lines too :
    deb http://packages.dotdeb.org squeeze-php54 all
    deb-src http://packages.dotdeb.org squeeze-php54 all

3. Fetch and install the GnuPG key

wget https://www.dotdeb.org/dotdeb.gpg
sudo apt-key add dotdeb.gpg

4. Enjoy

Run apt-get update. You should now be able to install the Dotdeb packages you want with apt-get (or dselect, or aptitude as well…)
Notes :

PHP 7 for RedHat and Cent OS

Please be mindful that you should use REMI repository along with EPEL repository. Otherwise you may end up with dependency problem sometimes.

On CentOS/RHEL/Scientific Linux 7 x86_64:
wget http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
rpm -Uvh remi-release-7.rpm

On CentOS/RHEL/Scientific Linux 6 i386 or x86_64:
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
rpm -Uvh remi-release-6.rpm
## for RHEL only
rhn-channel --add --channel=rhel-$(uname -i)-server-optional-6

On CentOS/RHEL/Scientific Linux 5 i386 or x86_64:
wget http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
rpm -Uvh remi-release-5.rpm

On Fedora 20  i386 or x86_64:
wget http://rpms.famillecollet.com/remi-release-20.rpm
yum install remi-release-20.rpm

On Fedora 19  i386 or x86_64:
wget http://rpms.famillecollet.com/remi-release-19.rpm
yum install remi-release-19.rpm

On Fedora 18  i386 or x86_64:
rpm -Uvh http://rpms.famillecollet.com/remi-release-18.rpm

Enable REMI repository

Edit file remi.repo,
vi /etc/yum.repos.d/remi.repo
Find the line enabled =0 and change it to 1 to enable REMI repository.
[...]
enabled=1
[...]
Save and close the file.

To install PHP7 from the new install run:

yum --enablerepo=remi,remi-test install php70

PHP 7 Zend Nightly builds

Add Zends PHP7 early access repo for Ubuntu 14.04 upwards and Debian 8 and compatible distros:

echo "deb http://repos.zend.com/zend-server/early-access/php7/repos ubuntu/" >> /etc/apt/sources.list

To install PHP7 nightly build:

apt-get update && apt-get install php7-nightly

To install PHP 7 Beta 1 run the following:

apt-get update && apt-get install php7-beta1

PHP7 will be installed to /usr/local/php7


Today's Links

Post a Comment

Print this!