修改php.ini后phpinfo未生效,Scaleway主机CentOS+VestaCP配置求助
Hey there, let's work through this issue together—it's a super common gotcha with VestaCP since it manages multiple PHP versions and config overrides behind the scenes. Here's how to get your php.ini changes to stick:
1. Confirm Which PHP Version Your Site Is Using
First, check the PHP Version listed at the top of your phpinfo() output. VestaCP often installs multiple PHP versions (like 7.4 or 8.1), and each has its own separate php.ini file—the /etc/php.ini you edited is likely for the CLI version, not the web/FPM version your site actually uses.
2. Locate the Correct php.ini File for Your PHP Version
VestaCP stores PHP-FPM configs in version-specific directories. For example:
- For PHP 7.4:
/etc/php/7.4/fpm/php.ini - For PHP 8.1:
/etc/php/8.1/fpm/php.ini
You can also run this SSH command to find the exact FPM config path for your active PHP version:
php-fpm<version> -i | grep "Loaded Configuration File"
(Replace <version> with your PHP version, e.g., php-fpm74 -i | grep "Loaded Configuration File")
3. Edit the Correct php.ini and Update max_execution_time
Open the FPM-specific php.ini with your preferred editor (like nano):
nano /etc/php/<version>/fpm/php.ini
Find the max_execution_time line, uncomment it if needed, and set your desired value:
max_execution_time = 300 ; Adjust this to your needs, e.g., 300 seconds
Save and exit (for nano: press Ctrl+O, hit Enter, then Ctrl+X).
4. Check for VestaCP Panel Overrides
VestaCP lets you set PHP settings per-site, which will override your php.ini changes:
- Log into your VestaCP panel
- Go to the Web tab, find your site, and click Edit
- Scroll down to the PHP Settings section
- Look for
max_execution_time—if there's a value entered here, delete it (or set it to your desired value) to let thephp.initake effect - Save the changes
5. Restart PHP-FPM to Apply Changes
Your new config won't take effect until you restart the PHP-FPM service. Run the appropriate command for your PHP version:
# For PHP 7.4 systemctl restart php-fpm74 # For PHP 8.1 systemctl restart php-fpm81 # Generic fallback if you're unsure systemctl restart php-fpm
6. Verify the Fix
Refresh your phpinfo() page and check two key values:
- Loaded Configuration File: Should now show the path to the FPM
php.iniyou edited - max_execution_time: Should display your updated value
Bonus: Check for Pool Config Overrides
If it's still not working, check your site's PHP-FPM pool config (VestaCP creates these per domain):
nano /etc/php/<version>/fpm/pool.d/<your-domain>.conf
Look for lines like php_admin_value[max_execution_time] = 60—if present, this will override php.ini. Either comment it out (add a ; at the start) or update the value to match your php.ini setting, then restart PHP-FPM again.
内容的提问来源于stack exchange,提问作者Hakan Erdur

