php.ini suggested settings?

Ask your questions regarding TimeTrex installation here.
Post Reply
EricM
Posts: 30
Joined: Wed Jan 16, 2013 2:22 pm

php.ini suggested settings?

Post by EricM »

I recently migrated my TimeTrex installation from a VM running 32 bit Ubuntu 12 LTS which had Timetrex installed with the Linux installer to a new VM running 64 bit Ubuntu 14 LTS that has TimeTrex installed via zip file.

So far the results have been very promising, punches that used to take 4.5 seconds are down to 1.5 seconds.

I noticed that the linux installer had some custom settings in php.ini, but the zip file instructions didn't mention needing any changes.

Example from Linux Installer:

Code: Select all

max_execution_time = 600
max_input_time = 600
memory_limit = 1024M
php.ini defaults:

Code: Select all

max_execution_time = 30
max_input_time = 60
memory_limit = 128M
Is this change no longer needed? Or should it still be done? Any other suggested php or apache configuration tweaks?
shaunw
Posts: 7839
Joined: Tue Sep 19, 2006 2:22 pm

Re: php.ini suggested settings?

Post by shaunw »

It depends on your specific situation, but the higher you make those settings, the less likely strange and "random" errors will occur due to exceeding those limits.
EricM
Posts: 30
Joined: Wed Jan 16, 2013 2:22 pm

Re: php.ini suggested settings?

Post by EricM »

For anyone else trying to install via zip, I would highly suggest keeping a copy of the Linux installer on hand to use as a reference. The zip installer doesn't include some of the scripts like backup_database and is rather light on installation documentation.

Below is the installation checklist I made for myself for installing via the Timetrex Zip file.

Install Ubuntu 14 LTS from DVD
sudo apt-get install apache2
sudo apt-get install samba
sudo apt-get install libapache2-mod-php5
sudo apt-get install openssh-server
sudo apt-get install postgresql postgresql-contrib
sudo apt-get install pgadmin3.
sudo apt-get install php5-gd
sudo apt-get install php5-pgsql

Change port in both apache config files to 8085 if desired
sudo nano /etc/apache2/ports.conf Listen 8085
sudo nano /etc/apache2/sites-available/000-default.conf

Enable local login for Postgre:
sudo nano /etc/postgresql/9.3/main/pg_hba.conf

# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/32 trust
# IPv6 local connections:
host all all ::1/128 trust

Increase PHP settings:
sudo nano /etc/php5/apache2/php.ini

max_execution_time = 600 ; Maximum execution time of each script, in seconds
max_input_time = 600 ; Maximum amount of time each script may spend parsing request data
memory_limit = 1024M ; Maximum amount of memory a script may consume (128MB)

Grab a copy of restore_database and backup_database from the Linux installer and edit as required. I ended up enabling verbose logging and waiting a day to see where Timetrex was looking for the backup_database script to be located.

copy over old timetrex.php and edit as needed (set installer enabled to true)

Set file permissions:
sudo adduser timetrex www-data
sudo chown -R www-data:www-data /var/www

restore old database with restore_database

run installer

Add Timetrex cron job (Note, I leave a server backup window from 2-5 AM, this may not be needed with Postgre 9.3):
* 0,1,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23 * * * /usr/bin/php5 /var/www/html/maint/cron.php >> /dev/null 2>&1
EricM
Posts: 30
Joined: Wed Jan 16, 2013 2:22 pm

Re: php.ini suggested settings?

Post by EricM »

As a final tweak, PostgreSQL seems to work better once tuned for your amount of system ram.

This can be done by running your config file through pgtune

sudo apt-get install pgtune
pgtune -i /etc/postgresql/9.3/main/postgresql.conf -o /etc/postgresql/9.3/main/postgresql.NEW

Inspect the new file, replace your old config with it, and then restart.

The online pgtune calculator is similar:
http://pgtune.leopard.in.ua/
Post Reply