Category Archives: Ubuntu / Debian

Installing PHP 7 on Debian Jessie

Add this to the file /etc/apt/sources.list:

deb jessie all
deb-src jessie all

Then run:

sudo apt-key add dotdeb.gpg
sudo apt-get update

Time to install PHP!

sudo apt-get install php-7.0

Installing support for certain packages is easy, just replace php5- with php7-!

Note: These instuctions do not work on ARM-based devices, such as the Raspberry Pi.


Setting up EasyEngine on Ubuntu 14.04 + PHP 5.5 + Nginx + Memcached Object cache

Start with a base Ubuntu 14.04 install, and then run:

curl -sL | sudo bash    # install easy-engine
source /etc/bash_completion.d/ee # code completion in CLI
apt-get install memcached php5-memcached # install memcached and  memcached php bridge (optionally also install php5-memcache)

ee system install                # install nginx, php, mysql, postfix
ee site create --wp  # install wordpress on    


That’s really all you need to do!

SVG to PNG conversion with transparent background in ImageMagick

Here’s a quick way to convert SVG to PNG with transparent background

convert -background none image.svg image.png

Adjust size

If you want to scale the image to a larger size without antialiasing (which makes the image look fuzzy), you can add the density parameter, like this:

convert -density 200 -background none image.svg image.png

Simply increase the density value to increase the image size.

To install ImageMagick on OS X with Homebrew:

brew install imagemagick

For Ubuntu:

sudo apt-get install imagemagick

Display output of multiple log files with tail

To show the output from all log files in a directory, run:

tail -f *.log

Output example:

==> log1 <== - - [16/Nov/2014:03:31:06 +0000] "GET /robots.txt HTTP/1.1" 200 107 - - [16/Nov/2014:03:31:07 +0000] "GET / HTTP/1.1" 200 7777 - - [16/Nov/2014:03:36:05 +0000] "GET /robots.txt HTTP/1.1" 200 107

==> log2 <== - - [16/Nov/2014:05:39:36 +0000] "GET / HTTP/1.1" 200 34569 - - [16/Nov/2014:05:40:44 +0000] "POST /wp-admin/ HTTP/1.0" 200 961 - - [16/Nov/2014:05:40:57 +0000] "POST /wp-admin/ HTTP/1.0" 200 50505

Debian LAMP stack in one command

Start out with the basics – Apache, MySQL and PHP + extensions

apt-get install mysql-server mysql-client apache2 php5 php5-cli libapache2-mod-php5 php5-mysql php5-curl php5-gd php-pear php5-imagick php5-mcrypt php5-memcache php5-mhash php5-sqlite php5-xmlrpc php5-xsl php5-json php5-dev libpcre3-dev

I recommend using this on Debian Jessie. That way you get a bleeding edge version of PHP (5.5.8 as of right now)

OpCode cache and APCu (Optional)

pecl install ZendOpcache-beta
pecl install apcu-beta

Add the following to /etc/php5/apache2/php.ini

Configure Opcache by adding this to /etc/php5/apache2/php.ini


Restart apache. The extensions should be available and configured. (You can verify this via phpinfo(); )

Useful tools (Optional)

apt-get install htop vim

PHP 5.5 on Raspbian Raspberry Pi

php 5.5.8

Raspberry pi runs Debian Wheezy, but with just one quick line change we can upgrade to Debian Jessie which is a newer version and provides PHP 5.5 binaries (5.5.8 at the time of this blog post.)

Start out by editing the APT sources:

vim /etc/apt/sources.list

Change wheezy to jessie, so that it looks like this:

deb jessie main contrib non-free rpi

(Don’t add or remove any lines, just change the one above)

Now run:

apt-get update && apt-get upgrade && apt-get autoremove

If you havent aready installed PHP, you can do it now via:

apt-get install php5 php5-cli

Finally, confirm your PHP version:

php -v

This should result in:

PHP 5.5.8-2 (cli) (built: Jan 18 2014 07:39:52)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies