Installing PHP

If you are installing PHP now, on a modern Linux distribution, here is a quick command for you to copy:

sudo apt-get install php8.2-common libapache2-mod-php8.2 php8.2-cli php8.2-mysqlnd php8.2-curl php8.2-zip php8.2-xml php8.2-mbstring php8.2-imagick

This should install most of the extensions FileRun needs. The IonCube extension would need separate installation.

Configuring PHP

FileRun requires PHP version 8.1 or 8.2, configured with the “ionCube Loader” extension.

The OPCache extension is highly recommended, for dramatically speeding FileRun/PHP up.

The following are the optimal PHP settings we recommend for using with your FileRun installation.

(This guide assumes that you have a default PHP installation, configured without any –disable or –without parameters.)

Create a file named “info.php” inside the FileRun installation folder and copy the following inside:

<?php
phpinfo();

Now “http://yourdomain.com/filerun/info.php” should provide information about your PHP configuration, as in the following example:

Scroll down on that page and check your settings.

expose_php              = Off
error_reporting         = E_ALL & ~E_NOTICE
display_errors          = Off
display_startup_errors  = Off
log_errors              = On
error_log               = "/private/path/php_error.log"
ignore_repeated_errors  = Off

Note: Replace /private/path/php_error.log with a valid path.

Keep in mind that you need to have display_errors set to “Off” on a production server and it's a good idea to frequently check the error logs for possible problems.

If encountering any problems with your FileRun installation, please temporarily set “display_errors” to “On” before providing our technical support access for troubleshooting. Or send us the PHP error log when you are reporting a problem.

open_basedir            = /path-to-filerun:/path-to-user-files/

Note: Replace /path-to-filerun and /path-to-user-files above with actual paths.

This allows PHP access to the FileRun application files (to run the application) and your files, to allow FileRun to manage them. You can add more paths, as needed. Under Windows, separate the directories with a semicolon character (;).

allow_url_fopen         = On
allow_url_include       = Off
variables_order         = "GPCS"
allow_webdav_methods    = On
memory_limit            = 128M
max_execution_time      = 300
output_buffering        = Off
output_handler          = ""
zlib.output_compression = Off
zlib.output_handler     = ""
safe_mode               = Off
register_globals        = Off
magic_quotes_gpc        = Off
date.timezone           = "UTC"

Note: Replace UTC with your actual time zone. For a list of possible values, please visit: http://php.net/manual/en/timezones.php

file_uploads            = On
upload_tmp_dir          = /path/to/your/temp/folder/
upload_max_filesize     = 20M
post_max_size           = 20M

Note: Replace /path/to/your/temp/folder/ with an actual path.

“post_max_size” needs to have at least the same value as “upload_max_filesize”. If you go with larger values than 20M keep in mind that your server might have other limitations in place, which might prevent FileRun from uploading file in larger chunks. If having troubles uploading larger files, always set the two settings lower not higher, as low as 2M. If you are sure that your server can receive larger pieces of files, than increasing these two values will allow for a faster throughput.

enable_dl               = Off
disable_functions       = ""
disable_classes         = ""

Disabling functions such as “sys” and “exec” is a common practice but note that it does not necessary make your PHP safer and it disables any FileRun feature which requires third-party programs (ImageMagick, FFmpeg, Apache Tika, etc.)

session.save_handler     = files
session.use_cookies      = 1
session.use_only_cookies = 1
session.auto_start       = 0
session.cookie_lifetime  = 0
session.cookie_httponly  = 1
session.cookie_secure    = 1

It is a good practice to change “session.name” to something else than the PHP default.

Make sure session.save_path is set in your PHP configuration file and points to an existing folder that PHP can write to.

The following are the extensions needed by FileRun. For performance, it's recommended that you disable anything else that PHP doesn't has enabled by default.

  • curl
  • mbstring
  • openssl
  • pdo_mysqlnd
  • pdo_mysql
  • sockets
  • xml
  • xmlreader (sometimes it is included with the xml package)
  • xmlwriter (same as above)
  • json
  • ionCube
  • zip

For installing ionCube, see this page.

The following extensions are optional, but good to have:

  • fileinfo
  • exif
  • OPcache
  • iconv

If your FileRun installation fails to connect to other servers because of SSL problems, you can try fix it by updating the SSL certificate bundle used for cURL.
To do so, please follow these steps:

  1. Replace the file system/classes/vendor/GuzzleHttp/cacert.pem (inside your FileRun installation folder) with the newly downloaded version.

If this is not fixing the problem, your PHP might have it's own file configured inside the “php.ini” configuration file.

The configuration would look something like this:

[CURL]
curl.cainfo = "/path/to/cacert.pem"

Please try to replace the file at that path with the newly downloaded cacert.pem above. You will need to restart PHP (either by restarting PHP-FPM or Apache/Nginx, depending on how your server is configured), for the change to take effect.

CentOS users might want to try also yum update ca-certificates

fastcgi.impersonate = 0
cgi.fix_pathinfo = 1

To avoid troubles installing FileRun updates, make sure the above is set in your PHP configuration.

Besides the settings above, for everything else we recommend to leave the default PHP settings.

The log settings are contained in the php.ini file stored on the server.

If you don't know where that is, create a PHP file inside the FileRun installation folder, add the following as the second line

<?php phpinfo();

Then open the URL of the file in a browser and look on the generated page for the entry Configuration File (php.ini) Path.

When you have located php.ini open it in your favorite text editor.

Find the Error handling and logging section of the php.ini file.

Make sure that both display_errors = On, display_startup_errors = On and log_errors = On are present and uncommented.

Check the value of error_log - this tells you the location of the file errors are logged to. If it is commented out then errors will be sent to the web server error log file.

Remember, if you make any changes to this file you will need to restart the web server (or just reboot the server).