Setting and Modifying PHP Directives on VPS Servers with ISPConfig Panel.
This tutorial presents the addition and modification of PHP directives on VPS servers with the ISPConfig control panel.
Introduction
- The ISPConfig panel offers the ability to change and/or set values for the most common PHP directives, using a file named .user.ini from the root directory of the site for which we want to make changes.
Requirements
- The FTP access data. An FTP account can be created by following the tutorial: Creating FTP User in ISPConfig panel;
- The ISPConfig panel administration data received in the email inbox associated with the Hostico account when the VPS was activated.
Steps to follow
- Using the FTP connection details we will connect to the server to modify/add files.
As an example, in the image above, we used the FTP client FileZilla. A tutorial related to accessing files with this client can be found at the following link Accessing files through Filezilla;
In the connection fields of Filezilla, we will enter the data as follows:
- In "Host" we will enter the IP or the hostname of the VPS (it will work with the hostname only if the hostname domain has the VPS's custom nameservers set at the registrar);
- In the "Username" and "Password", we will enter the user and password of the FTP account created in the ISPConfig panel, according to the tutorial mentioned in "Requirements";
- In the "Port" field, we will use 21.
After connecting, we access the main directory of our website, where we will create a file named "user.ini";
We can find the root directory of the site we are working with by accessing the ISPConfig Control Panel -> Sites tab in the navigation menu -> click on Websites, Subdomain, or Alias as appropriate -> Click on the domain in question -> on the domain tab in the Document Root field, we will have the path to the domain's root directory;
In the FTP client used, we will navigate to this path and further enter the "web" directory. For example, a complete path to the root directory will look like this: "/var/www/clients/client1/web1/web";
Next, to modify the PHP directives, we will create a file named ".user.ini" (locally on the computer), in which we will set the desired directives. After saving the file, we will upload it to the directory mentioned above using the FTP client;
Some examples of directives that can be modified are presented below:
allow_url_fopen = off
display_errors = false
log_errors = off
date.timezone = Europe/Bucharest
error_log = php_errors.log
error_reporting = E_ALL & ~E_NOTICE
max_execution_time = 300
max_input_time = 300
max_input_vars = 2000
memory_limit = 512M
post_max_size = 500M
upload_max_filesize = 500M
opcache.enable = on
The directives with the current set values can be checked using the php function "phpinfo()". If you notice that a particular directive is not changing, please contact technical support.