Tips on how to get Gallery3 working on a synology (mine is a ds213j)

frankij

Joined: 2014-06-03
Posts: 1
Posted: Tue, 2014-06-03 12:53

It took me so much time to get gallery3 working good on my synology nas ds213j, that i thought I would share this information for others.
Some of this i figured out myself, while some came from various topics on these and other forums. This is not a step by step guide, it is for people that know how to move around linux, know how to login using ssh etc. These steps can be found by browsing the internet.
Be aware, it is a simple nas, and does not have real processing power, so it will always be slower than a real server.

* Begin by activating the virtual host on your synology, and having it create the ../web/gallery directory
* test this by creating a simple index.html file in that directory and removing it afterwards.
* make sure you have mysql active and you know your mysql user and pass (synology uses the mariadb, but the application will not know the difference)
* Install the latest version of your gallery in the directory ../web/gallery (by following the normal gallery3 installation procedure)
Make sure gallery works in its defaults, and that you can login etc. Do not do any mayor uploads yet

= Now comes the tuning part, that needs to be done, because otherwise you would have some problems with the php-gd library. This procedure is for making things work with the php-gd library, as my imagemagick convert produced black or white thumbnails. And i could not find a solution for this anywhere.

Make the following changes in /etc/php/php.ini

max_execution_time = 240
max_input_time = 60
memory_limit=256M
max_execution_time=500

Afterwards restart apache. This changes per synology version, so either /usr/syno/etc/rc.d/S97apache-user.sh restart or /usr/syno/etc/rc.d/S97apache-sys.sh restart or reboot your nas
Verify eveything works, and that you can upload some big pictures. If this is not working, either increase the memory limits, or stop right here and try to get imagemagick working.

= Tune mysql for performance
the mariadb is not optimally tuned for gallery3. So after having it run for some time, i used the mysqltuner.pl (found on the internet) to get some readings back. But since synology is a weird linux version i had to pass some extra parameters. IE: perl mysqltuner.pl –forcemem 512 –forceswap 512 –user=root –pass=«»

I ended up with the following settings for /usr/syno/etc/packages/MariaDB/my.cnf :
[mysqld]
innodb_buffer_pool_size=20M
thread_cache_size=4
table_cache=30
query_cache_size=8M
#extra tuning
query_cache_limit=8M
max_heap_table_size=20M
key_buffer_size=800k
tmp_table_size=20M

Restart mysql afterwards: /usr/share/mysql/mysql.server restart

= You might benefit from apache php caching tuning
In ../web/gallery/application/config/config.php, make the following changes

$config["internal_cache"] = 3600;
$config["log_threshold"] = 0;
$config["display_errors"] = FALSE;
$config["render_stats"] = FALSE;

Restart apache!

= and of course disable all modules that you don't need or do not use. Such as gallery2 import.

Hope this helps some people get going.

Regards
Frank