Disclaimer: Always test changes in a safe environment before applying them to your live server. Consult the latest documentation for any updates.
Plesk is a powerful web hosting platform that simplifies the management of websites, applications, and server settings. One essential aspect of managing your web applications is configuring PHP settings, which can significantly affect performance and functionality.
What is php.ini?
The php.ini file is the main configuration file for PHP that controls various settings, such as error reporting, file uploads, and memory limits. Understanding how to locate and edit this file for your domains is crucial for optimal performance.
Prerequisites
- Administrative access to your Plesk panel.
- Basic understanding of PHP settings and their impact on your applications.
Steps to Edit PHP Configuration for a Domain
- Log into Your Plesk Panel.
- Go to Domains > example_domain.com > PHP Settings.
- To view PHP configuration, click on View the phpinfo() page to see all current PHP configurations for this domain.
- Edit PHP settings to adjust the required options in the PHP Settings section and add any specific PHP settings you need.
Steps to Edit Global PHP Configuration for All Domains
- Log into Your Plesk Panel.
- To access global PHP settings, navigate to Tools and Settings > PHP Settings.
- To select a PHP handler, click on the desired PHP handler, then go to the php.ini tab.
- Make the necessary changes and click OK to save your changes.
Note: Some options may be hidden.
Editing PHP Configuration via Service Plan for Multiple Domains
- Access Service Plans and assign all relevant subscriptions to a service plan.
- To modify PHP settings, go to PHP Settings within the service plan. After making changes, click Update & Sync to apply these settings across the selected subscriptions.
Using SSH/RDP for Older Plesk Versions
If you're using an older version of Plesk, you may need to connect to your server via SSH or RDP. PHP uses different configuration files based on the PHP handler type. Here's where you can find the configuration files on Linux:
Location of Configuration Files
- Domain's php.ini:
- If using Nginx + PHP-FPM by OS vendor:
- For Ubuntu:
/etc/php*/fpm/fpm.d/example_domain.com.conf
- For CentOS:
/etc/php-fpm.d/example_domain.com.conf
- For Ubuntu:
- If using Nginx + PHP-FPM supplied with Plesk:
/opt/plesk/php/$php_version/etc/php-fpm.d/example_domain.com.conf
- If using Apache + FastCGI:
/var/www/vhosts/system/example_domain.com/etc/php.ini
- If using Apache + PHP_mod:
/var/www/vhosts/system/example_domain.com/conf/httpd.conf
- If using Nginx + PHP-FPM by OS vendor:
- Global php.ini:
- For system PHP:
/etc/php.ini
- For Plesk PHP:
/opt/plesk/php/$php_version/etc/php.ini
- For system PHP:
By following these steps, you can easily locate and edit PHP configuration files in Plesk for both individual domains and globally. Properly configuring PHP settings is essential for the performance and security of your web applications.