Upgrading php on a Synology NAS

Steve
Posts: 79
Joined: Sun Oct 01, 2017 3:08 pm

Upgrading php on a Synology NAS

Post by Steve » Wed Feb 20, 2019 11:27 am

If it's been a while since you installed php on your NAS, here are some instructions. First, go to the package center.
 
Image
 
Type php in the search bar and press enter. When the programs appear, select install php 7.2 or the newest version.
 
Image
 
If you have more than one volume available, select the volume to use, which is usually volume one. Select the check box if you want future installs loaded on the volume and select next.
 
Image
 
A confirmation screen appears showing the actions to be performed. If everything is correct select apply.
 
Image
 
Once the installation is complete, return to the menu and select web station.
 
Image
 
The web station status page displays programs that can be configured and used for web station.
 
Image
 
Select General Settings. These are settings applied to programs running in the web folder. There is an option to enable personal websites for users of your NAS. I do not recommend using this option because it only runs on Apache 2.2 and php 5.6. Support for Apache 2.2 ended Jan 1, 2018. Support for php 5.6 ended Jan 1, 2019.
 
Image
 
Select the back-end server you want to run. If you are going to run WordPress or another program requiring Apache, select Apache 2.4. You can select nginx but it requires setting up configuration files in the NAS. If you are not familiar with setting up linux configuration files select Apache. If you have not setup any versions of php you will be unable to make a selection. If the pull-down selection displays Not configured, select php settings.
 
Image
 
Selecting create allows you to create unique profiles for php. You can create more than one profile for the same version of php that only use modules required for a specific website.
 
Image
 
After selecting create, the General Settings tab appears. Select the version of php you want to setup from the pull-down menu.
 
Image
 
Enter a unique Profile name and Description. To use multiple profiles, for different websites, make each profile name and description different. Be sure to pick names you can easily identify. Enabling php cache allows php to compile code without execution, making the process faster. You may want to enable display errors if you are writing code or think there are issues on your website. Check the box under extensions, which enables ALL extensions.
 
Image
 
Scroll down the extension list and uncheck any extensions that are not needed. For example, if you are using MariaDB DO NOT disable any MYSQL extensions but you do not need the PDO_DBLIB extension for Mirosoft servers, PDO_PGSQL and pgsql for PostgreDQL databases or PDO_SQLITE and sqlite3 for SQLite databases.
 
Image
 
If you want to use an error log select the core tab. Scroll down to error_log and enter the path and file name you want to use. If you are using multiple profiles make sure the file name or folder is unique.
 
Image
 
Return to the General tab, confirm all entries are correct and then press OK. Repeat this procedure for each version of php and profile you want to create.
 
Image
 
When complete return to General Settings. Select php and the php profiles you created will appear in the pull-down. Select the version you want to use for the web folder. When finished select apply.
 
Image
 
Open File Station and create the log folder for the php error file(s). Make sure the path is the same as the one you entered in the php core. Select OK to crerate the folder.
 
Image
 
If you are using virtual hosts, you can use a unique profile for each one, if needed. In any case, make sure your program is compatible with the version of php specified for the host. Some older programs may not be compatible with php 7.0 or php 7.2 which will generate errors.