VTiger安装报错求助:MySQL需配置指定sql_mode及PHP配置未生效
Hey there, let's work through these VTiger setup snags step by step—you're so close to getting this sorted out! These are super common gotchas with VTiger's strict pre-flight checks, especially when mixing older PHP versions with Ubuntu 18.04's default service configs.
1. Fix PHP's error_reporting and log_errors Settings
First off, a critical mistake many folks make: on Ubuntu 18.04, PHP 5.6's Apache-specific config file isn't /etc/php.ini (that's a legacy path). You need to edit the Apache module's dedicated php.ini instead:
- Open the correct config file with:
sudo nano /etc/php/5.6/apache2/php.ini - Update the
error_reportingline to match VTiger's exact recommendation:error_reporting = E_WARNING & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT - Find the
log_errorsline and set it to:log_errors = Off - Save the file (Ctrl+O, hit Enter) and exit (Ctrl+X). Then restart Apache to apply changes:
sudo systemctl restart apache2
The key here: Ubuntu splits PHP configs per service (Apache, CLI, FPM), so editing the wrong php.ini won't affect your web server's PHP environment at all.
2. Ensure MySQL sql_mode Is Properly Applied
Ubuntu 18.04 uses either MySQL 5.7 or MariaDB, and the mysqld service doesn't always pick up settings added to the end of /etc/mysql/my.cnf. Let's fix that:
- Open the actual mysqld config file:
sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf - Look for the
[mysqld]section (it's at the top of the file), and add yoursql_modeline inside this section (not floating at the end):[mysqld] ... # keep existing settings sql_mode=ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION - Save and exit, then restart MySQL to activate the change:
sudo systemctl restart mysql - Verify it worked by running this MySQL command (log into MySQL first with
sudo mysql):
You should see the exact string you added in the output.SELECT @@GLOBAL.sql_mode;
If you previously added this to /etc/mysql/my.cnf, check if that file includes a line like !includedir /etc/mysql/mysql.conf.d/—if not, your old setting was never being loaded by the service.
3. Verify Changes Are Live
After applying these fixes, clear your browser cache and reload the VTiger setup page. If the issues still pop up, confirm the PHP settings are active by creating a quick info file:
- Make a file named
info.phpin your web root (e.g.,/var/www/html/info.php):<?php phpinfo(); ?> - Access it via your browser (e.g.,
http://your-server-ip/info.php) and search for:error_reporting(confirm it matches the exact value we set)log_errors(should showOff)
This will tell you for sure if your PHP config changes are being picked up by Apache.
内容的提问来源于stack exchange,提问作者Elkor

