How To Install FileRun on Synology DSM NAS using Web Station

In this guide we will install FileRun on Synology DiskStation Manager (DSM 7), a Linux based software package that is the operating system for the DiskStation and RackStation NAS (Network Attached Storage) products. > Important: This guide is tested against the latest DSM version as of October 2021: DSM 7.0-41890

Benefits of using FileRun over Synology’s own apps:

  • lightweight and fast.
  • no more waiting for indexing before being able to browse your photos, music or videos.
  • mobile friendly without the need of an app (although a few are available).
  • high-res thumbnails and previews.
  • view and manage photos, music, videos, and documents. All within a single app.
  • and a lot more (check out https://filerun.com).
Note that this tutorial has been tested for now only with the Synology DS2415+ device, but should work fine with all DiskStation devices. If you are having troubles, drop us a message and we’ll help you fast and free.

This step is straightforward:

  1. Open up the Synology DSM in your browser.
  2. Open the Package Center app.
  3. Search for Web Station and install the found package.

Open the just installed Web Station package and click on the Management icon for the PHP 7.4 Back-end Package:

Web Station

Web Station

This will open the Package Center and will offer you to install PHP 7.4. Complete the installation and close the Package Center.

Back on the Web Station you should now see PHP 7.4 marked as Installed.

Switch to the PHP Settings tab and click the Create button to add a new PHP profile.

wl

Type a Profile Name, Description and choose PHP 7.4 for the PHP version:

Under Extensions, enable the following:

  • curl
  • exif
  • gd
  • imagick
  • openssl
  • pdo_mysql
  • zip
  • zlib
Make sure the option Enable PHP cache is NOT checked.

It should look like this:

wl

And click Ok.

Switch to the General Settings tab.

Using the PHP version drop down menu, select the just added PHP 7.4 profile, and click Apply:

wl

Install the ionCube extension

ionCube is a PHP extension which is needed by FileRun to function.

For this step we will be using SSH.

See: How to login to DSM with root permission via SSH/Telnet

You might need to follow this guide to enable SSH access.

Once connected:

Change the current folder to /usr/local/lib/php74/modules:

cd /usr/local/lib/php74/modules

Download the right version of ionCube, appropriate for the CPU type of your Synology device. You can find the CPU model in the Synology Control panel, under Info Center. Google the model name and you will find more information about it and it’s architecture.

For 64 bit Intel CPU’s:

sudo wget http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz

For 32 bit Intel CPU’s:

sudo wget http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86.tar.gz

For 32 bit ARM CPU’s:

sudo wget https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_armv7l.tar.gz

For 64 bit ARM CPU’s:

sudo wget https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_aarch64.tar.gz
Note that you might be asked to provide the admin password again for running these commands.

Extract the downloaded archive:

sudo tar xvfz ioncube_loaders_lin_*.tar.gz

Now create an additional custom PHP configuration file:

sudo vim /run/php-fpm/conf.d/filerun.ini

Press i to enter edit mode then right-click to paste the following inside:

zend_extension = /usr/local/lib/php74/modules/ioncube/ioncube_loader_lin_7.4.so

To save the changes, press Esc, :wq! and Enter.

There has been a reported problem, with the above change being lost after restarting the server. You might want to try to put the above configuration inside the file /volume1/@appstore/PHP7.4/misc/php-fpm.ini instead.

For the changes to take effect, restart PHP 7.4 by running the following command:

sudo synosystemctl restart pkgctl-PHP7.4

For DSM version 6, the command is:

sudo synoservicectl -restart pkgctl-PHP7.4
You can also restart it from Package Center, by selecting PHP 7.4 and then Stop, wait for it to stop, and then Run.

Back on the SSH console, to very that ionCube is installed and loaded:

Create a file called info.php file in the root directory of your web server:

sudo vim /volume1/web/info.php

Paste the following inside the file, then save and close it.

<?php
phpinfo();
Press i key for opening edit mode, right-click to paste the text, Esc to exit edit mode, :wq! followed by Enter to save and exit.

Then

sudo chmod 755 info.php

to adjust the file’s permission.

Now visit http://<^>nas_ip_address<^>/info.php in your web browser. The web page you’ve opened should look something like this:

PHP Info PHP Info

Note the “==with the ionCube PHP Loader (enabled)==” text at the bottom of the screenshot.

This is an easy step:

  1. Open the Package Center app.
  2. Search for MariaDB and install the found package.

Open MariaDB and click Change MariDB password to set a password. Make sure you write this password down.

MariaDB MariaDB

If you don’t have the phpMyAdmin package already installed, use this guide.

  1. Open phpMyAdmin and login as root with the password you set previously.
  2. Navigate to the User accounts tab and click Add user account
  3. Type in a User name. In the screenshot bellow the username filerun has been filled in.
  4. Select Local for the Host name.
  5. Type a Password of your choice and Re-type it.
  6. Make sure the Create database with same name and grant all privileges. option is checked.

Adding MariaDB user Adding MariaDB user

Click the Go button at the bottom of the page to add the user account.

You can now close phpMyAdmin.

Back to the SSH console.

You can install FileRun in the root folder of your webserver (/var/services/web/) or a subfolder of your choice.

cd /volume1/web/

If you wish to use the root of your web server (no subfolder) make sure you delete the default index.html file from its folder.

rm index.html

Download the FileRun installation zip archive from the FileRun client account: https://filerun.com/client-area

Unzip the downloaded archive:

sudo 7z x FileRun.zip

Allow PHP to write temporary data:

sudo chown http:http -R system/data/

From here you just have to follow the web-based installer, which will help you get FileRun running with just a few clicks.

Web-based installer

Open your browser and point it to http://YOUR-NAS-IP/

Note: If you placed FileRun in a subfolder, add the subfolder name to the URL.

FileRun installer welcome screen FileRun installer welcome screen

If you do not see the installer web page, but perhaps a 500 Internal Server Error page, change the PHP configuration so that display_errors is set to On. The same page will then provide an error message with troubleshooting information.

If you are getting an error such as Fatal error: Uncaught --> Smarty: unable to write file, know that you can also use Synology File Station to browse to the FileRun folder and change the permissions of the system/data folder, allowing http use the Write permission.

For more troubleshooting information, see this page or contact us (with as much details as possible).

Click Next to proceed. Review the server requirements check and make sure there is no red error message:

FileRun server requirements check FileRun server requirements check

Click Next to proceed with the database connection setup:

  • Type in the Database name. This is the same as what you used for the MariaDB username at the step 5 above (filerun in our example).
  • Type in the MySQL user: filerun (The same as above).
  • Type in the Password you have configured for the MariaDB user account.
  • Then click Next.

FileRun database connection setup FileRun database connection setup

You will be presented with the following screen, letting you know that FileRun has been successfully installed:

FileRun successfull installation FileRun successfull installation

Imortant: Make sure you made a copy of the username and password displayed on the screen, before proceeding. The password is being randomly generated at this step. Do not use the password from this tutorial screenshot, it won’t work on your install.

Click Next to open FileRun. You should see the login page:

FileRun login page FileRun login page

The form should be prefilled so you can just hit Sign in.

Troubleshooting MySQL connection problems

On some Synology devices, users have reported getting the error SQLSTATE[HY000] [2002] No such file or directory. The solution is to tweak the PHP configuration a bit.

  1. On the Synology desktop, click to open the Main Menu and select MariaDB
  2. Note the Port (number, typically 3306) and Domain Socket (file path, something like /run/mysqld/mysqld.sock) information and write these down somewhere. You can now close the “MariaDB” options panel.
  3. Back to the Main Menu, open Web Station.
  4. Select the PHP Settings tab and click Advanced Settings.
  5. Select the Extensions tab.
  6. Search for pdo_mysql and locate the field pdo_mysql.default_socket.
  7. Set the value of the field to the Domain Socket path you made a note of, at step 2.
  8. Click Ok

Also, if you notice the MariaDB server running on a different port than the default 3306, when configuring the MySQL hostname in the FileRun installer, set localhost:3306, where 3306 is your actual port number.

Now you can configure your FileRun user accounts to manage your existing photos:

Managing existing photos Managing existing photos

One of the first things you would wish to enable inside FileRun’s configuration is ImageMagick and FFmpeg. These are server components which gives FileRun the capability of handling a large variety of image and video files, to provide you with quick image previews and thumbnails.

  1. Login to FileRun, open the Control panel.
  2. Select Image Preview from the menu.
  3. Check the “Enable ImageMagick support” option.
  4. Update the ImageMagick convert binary path to /bin/convert.
  5. Check the “Enable FFmpeg support” option.
  6. Update the FFmpeg binary path to /bin/ffmpeg

wl

Click Save Changes and you’re done!

Enable the mobile apps and the desktop sync

You might also want to enable the API, so that you can use the mobile and desktop sync apps with your NAS. You do that like this:

  1. Login to FileRun via HTTPS
  2. Open the Control Panel
  3. Select API (OAuth2) from the menu
  4. Check the Enable OAuth2 option and click Save Changes

You should now be able to connect to your FileRun using the mobile and desktop apps.

Support for NGINX X-Accel feature can be enabled from FileRun’s control panel. To enable that inside Synology, one will need to:

sudo vim /volume/@appstore/WebStation/misc/nginx_default_server.mustache

and add something like this:

location /volume {
    internal;
    root /;
}

Then restart NGINX like this:

sudo synoservicecfg --restart nginx

Now FileRun will be able to provide file downloads in a more efficient manner.

You have now successfully installed FileRun on a Synology NAS server. It’s time to upload your files, photos, music or work documents and start sharing.

For more information on FileRun features and settings, visit https://docs.filerun.com