Skip to content

Installing

Jean J. de Jong edited this page Dec 10, 2016 · 24 revisions

These instructions are provided for Ubuntu Server editions. They have been tested with 14.04 (Trusty) and 16.04 (Xenial). You may need to adapt them for other Linux distributions.

NOTE that the user interface has only been developed and tested with FireFox in mind. It is likely that there will be artifacts if you use Internet Explorer. We do not envisage improving support for IE ourselves, since we only use FireFox.

I. Automated installation method on Ubuntu

This method will only work on Ubuntu systems with an Internet connection - the commands and configuration files are specific to Ubuntu. You should not use this method if you've already installed phpIP, because it will wipe your existing database and it will interfere with your settings.

Download the install-phpip-<version> script from the sources, and run it. This script assumes you haven't installed a LAMP system - it will install Apache, MySQL and PHP. For Ubuntu Trusty, type the following in your Linux console:

wget https://raw.githubusercontent.com/jjdejong/phpip/master/install/install-phpip-trusty.sh
sudo sh install-phpip-trusty.sh

For Ubuntu Xenial:

wget https://raw.githubusercontent.com/jjdejong/phpip/master/install/install-phpip-xenial.sh
sudo sh install-phpip-trusty.sh

You will be prompted a first time to provide a root password for MySQL. This password will be required again towards the end of the script for creating the database.

The script creates two MySQL accounts with the password "changeme":

  • phpip: a system account that is used by the phpIP backend and defined in the application/configs/application.ini file.
  • phpipuser: a first phpIP account for connecting to the software, with full privileges in MySQL on the phpip database.

After running the script, you will be able to connect to http://phpip.local within your Ubuntu machine. Connect as phpipuser/changeme.

In order to connect from other machines, see the end of section 2.2 (setting up your DNS or hosts file).

II. Manual method

The detail of what the above script does, with some explanations.

1. Installing the required packages

Make sure your software is up to date. In a console, type:

sudo apt-get update
sudo apt-get upgrade

1.1. Apache, PHP and MySQL

Install these as follows:

  • In a console, type:
sudo tasksel
  • Select "LAMP", then "OK". This will download and install the required packages. You will be prompted to create a new password for the MySQL administrator (root) - you will need that password later

As an alternative to running tasksel, which is not installed by default on all Ubuntu editions, run:

sudo apt-get install lamp-server^
  • Enable mod_rewrite in Apache:
sudo a2enmod rewrite
  • Make sure that the php type definitions are uncommented in /etc/mime.types. With the nano editor, in the console, type:
sudo nano /etc/mime.types

And delete the "#" signs from the following lines:

#application/x-httpd-php                        phtml pht php
#application/x-httpd-php-source                 phps
#application/x-httpd-php3                       php3
#application/x-httpd-php3-preprocessed          php3p
#application/x-httpd-php4                       php4
#application/x-httpd-php5                       php5

1.2. Zend Framework

  • In the console, type:
sudo apt-get install zend-framework-bin
  • Uncomment the line in /etc/php5/apache2/conf.d/zend-framework.ini or /etc/php5/mods-available/zend-framework.ini. Use for instance the nano editor:
sudo nano /etc/php5/mods-available/zend-framework.ini
  • Enable Zend in php:
sudo php5enmod zend-framework
  • Reload Apache:
sudo service apache2 reload

This will install the Zend Framework version packaged for your current Ubuntu distribution. If you want the latest, you may download it from http://framework.zend.com (I haven't seen the need for this, yet).

1.3. phpIP

The code goes in folder /var/www/phpip.

In the console:

cd /var/www
sudo tar zxpvf <path to phpip.tar.gz>

This is if you have downloaded a release package.

Otherwise you can get the bleeding edge code using Git. You may need to install Git first:

sudo apt-get install git-core

Then:

cd /var/www
sudo git clone https://github.com/jjdejong/phpip.git

phpIP's initial configuration goes in the application.ini file. Use the provided application.ini.example file for starting (adapt it according to your needs and later database settings):

cp phpip/application/configs/application.ini.example phpip/application/configs/application.ini

2. Configuring

2.1 Quick start and check

The tool is now accessible by pointing your browser to: http://<your server>/phpip/public

You should see a login screen. You won't get past that, because no tables or users have been installed yet in MySQL.

2.2 Virtual host in Apache for Zend

This is maybe the most complex configuration section.

  • In the console, type:
sudo nano /etc/apache2/sites-enabled/phpip.conf
  • Paste the following in nano's edit window:
<VirtualHost *:80>
    ServerName phpip.local
    DocumentRoot /var/www/phpip/public
    SetEnv APPLICATION_ENV "live"
    ErrorLog /var/log/phpip-apache2/error.log
    CustomLog /var/log/apache2/phpip-access.log combined
</VirtualHost>
<Directory /var/www/phpip/public>
    Options Indexes MultiViews FollowSymLinks
    DirectoryIndex index.php
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

If you are using haproxy, like in Zentyal 3.5, replace port 80 by the haproxy port, eg. 62080 in Zentyal, and put "phpip.local:80" in the ServerName directive.

  • Save and reload Apache:
sudo service apache2 reload

You then need to create a DNS entry mapping name "phpip.local", i.e. the value of parameter ServerName in the above VirtualHost definition, to the IP address of your server. If this is obscure to you, the simplest is to add the following line in the "hosts" file of the workstations that will access phpIP:

<your server's IP address>    phpip.local

On Windows workstations, the "hosts" file is usually in: c:\windows\system32\drivers\etc\hosts

On Macs and Linux workstations, it is located in /etc/hosts.

Now point your browser to http://phpip.local.

You should see the login screen again. You still won't get past that, because you have no database yet.

2.3. MySQL

Make sure the InnoDB engine is ON in /etc/mysql/my.cnf, and that it's not turned OFF by a configuration file in /etc/mysql/conf.d/, like zentyal.conf.

You need to import the phpIP tables into MySQL. You should find a script named phpip_skel.sql for that in /var/www/phpip/install. It will probably be compressed and have a date tag (e.g. phpip_skel-YYYYMMDD.sql.gz). In the console type (skip gunzip if the file is not compressed):

cd /var/www/phpip/install
sudo gunzip phpip_skel-YYYYMMDD.sql.gz
mysql -u root -p < phpip_skel-YYYYMMDD.sql

You will be prompted for the MySQL root password, i.e. the one you provided upon installing the LAMP package via tasksel. If you forgot the password or weren't prompted to create one in the first place, you probably need to reset the password - you can then use this procedure.

BEWARE: do not perform the above operation as an upgrade on a production system, because the script will drop all tables before re-creating them.

The script creates two MySQL accounts with the password "changeme":

  • phpip: a system account that is used by the phpIP backend and defined in the application/configs/application.ini file.
  • phpipuser: a first phpIP account for connecting to the software, with full privileges in MySQL on the phpip database.

Create further phpIP accounts, as needed, like this:

mysql -u root -p -e "CREATE USER 'phpipuser2'@'%' IDENTIFIED BY 'changeme'; GRANT ALL ON phpip.* TO 'phpipuser2'@'%';"

You also need to add this account to the actor table for connecting to phpIP:

mysql -u root -p -e "INSERT INTO phpip.actor (login, name, email, password, password_salt) VALUES ('phpipuser2', 'phpIP User 2', 'root@localhost', md5('changemesalt'), 'salt');"

In a more secure environment, you'll want to assign different "salt" values to the different accounts.

NB: with regard to the second mysql instruction above, the PHP authentication code on login checks the MD5 hash of a concatenated string of the password and the password_salt. This is why the value of phpipuser2 in the example above has the construct MD5('changemesalt') for the value of the password inserted into the Actor table. For most people used to copy/pasting command lines and wanting to insert their own passwords, this is probably not immediately obvious. So, to be clear, when adding a new user to the Actor table, remember that the password string you enter here must consist of the concatenation of the mysql user password and the string corresponding to the salt that you wish to set.

(These steps for adding a phpIP account are rather tedious and it's something that needs to be improved. There is no utility in the user interface yet - volunteers for developing one are welcome.)

Now point your browser to http://phpip.local, and login. Connect as phpipuser/changeme. If you see "Application error", you've done something wrong.

To make error messages more verbose:

sudo nano /etc/apache2/sites-enabled/phpip

and change "live" to "development" in line

SetEnv APPLICATION_ENV "live"

If for some reason you want to apply the phpip_skel script again, make sure you delete the phpip and phpipuser accounts from MySQL, otherwise the script will attempt to create them again and cause an error. To remove these users, run:

mysql -u root -p -e "DROP USER 'phpip'@'%'; DROP USER 'phpipuser'@'%';"

3. Updating

3.1 The phpIP User Interface

Updates will be frequent. Go into your phpip folder and pull the changes from Github:

cd /var/www/phpip
sudo git pull

3.2 The database structure

Updates will not be frequent.

NEVER import a phpip_skel.sql file into your production database, like in the database creation step (2.3). This would erase your data.

Instead, apply in order all phpip_upgrade.sql files available in phpip/install, having date stamps above the last one you applied (keep a note of the last one you applied, like by saving that file outside the phpip tree).

mysql -u root -p phpip < phpip_upgrade-<date stamp>.sql
Clone this wiki locally