-
Notifications
You must be signed in to change notification settings - Fork 3
Installing
These instructions are provided for Ubuntu Server editions. They have been tested with 16.04 (Xenial) and 18.04 (Bionic). 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.
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 Bionic, type the following in your Linux console:
wget https://raw.githubusercontent.com/jjdejong/phpip/master/install/install-phpip-bionic.sh
sudo sh install-phpip-bionic.sh
For other Ubuntu versions, replace "bionic" with the version, for instance "xenial".
For Xenial, 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).
The detail of what the above script does, with some explanations.
Make sure your software is up to date and you have the universe repository enabled. In a console, type:
sudo add-apt-repository universe
sudo apt update
sudo apt upgrade
Install these as follows:
- In a console, type:
sudo apt install lamp-server^ php7.2-simplexml
- Enable mod_rewrite in Apache:
sudo a2enmod rewrite
- In the console, type:
sudo apt-get install zend-framework-bin
- Uncomment the single line in /etc/php/7.0/mods-available/zend-framework.ini. Use for instance the nano editor:
sudo nano /etc/php/7.0/mods-available/zend-framework.ini
- Enable Zend in php:
sudo phpenmod zend-framework
- In the console, type:
sudo apt install zendframework
sudo service apache2 reload
The code goes in folder /var/www/html/phpip.
Install it via Git. You may need to install Git first:
sudo apt install git-core
Then:
cd /var/www/html
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
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.
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/html/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/html/phpip/public>
Options Indexes MultiViews FollowSymLinks
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
- 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.
Make sure the InnoDB engine is ON in MySQL's configuration files (in /etc/mysql).
You need to import the phpIP tables into MySQL. You should find a script named phpip_sample.sql for that in /var/www/html/phpip/install. In the console type:
cd /var/www/html/phpip/install
sudo mysql < phpip_sample.sql
In Xenial you set a root password for MySQL at the beginning of the installation - you then need to run mysql -u root -p < phpip_sample.sql
instead and type the password when prompted.
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_sample
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'@'%';"
Updates will be frequent. Go into your phpip
folder and pull the changes from Github:
cd /var/www/html/phpip
sudo git pull
Updates will not be frequent.
NEVER import a phpip_sample.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