DOLIBARR ENVIRONMENT
- Version: 10.0.3
- Operating System: Linux (Synology DSM 6.2.2-24922 Update 3)
- Web Server: nginx 1.15.7
- PHP: Dolibarr shows 7.3.7, but phpMyAdmin shows 5.6.40
- Database: MariaDB 10.3.11
- URL(s): index.php?mainmenu=home&leftmenu=home
admin/tools/dolibarr_export.php?mainmenu=home&leftmenu=admintools
During setup the only way I could get Dolibarr to connect to MariaDB was to set $dolibarr_main_db_host to include the port number (i.e. localhost:3307). $dolibarr_main_db_port was also set to 3307. I found this fix in a forum from another using running Dolibarr on Synology DSM.
This causes backups to fail using mysqldump with the error:
Error : Failed to run external command. Check it is available and runnable by your PHP server. If PHP Safe Mode is enabled, check that command is inside a directory defined by parameter safe_mode_exec_dir.
The issue is not actually safe mode, when I run the backup command using SSH I get the following error:
/usr/local/mariadb10/bin/mysqldump dolibarr [color=#ff0000]-h localhost:3307[/color] -u doli -P 3307 -l --single-transaction --add-drop-table=TRUE --tables -c -e --hex-blob --default-character-set=utf8 -p"********************************"
mysqldump: Got error: 2005: “Unknown MySQL server host ‘localhost:3307’ (-2)” when trying to connect
The issue is the hostname, I get a successful dump when I amend the hostname and run in SSH
/usr/local/mariadb10/bin/mysqldump dolibarr [color=#ff0000]-h localhost[/color] -u doli -P 3307 -l --single-transaction --add-drop-table=TRUE --tables -c -e --hex-blob --default-character-set=utf8 -p"********************************"
I tried changing $dolibarr_main_db_host in conf.php , but without the port included in the host variable Dolibarr will not launch and I get a php error.
I tried editing core/class/utils.class.php to use a new global variable $dolibarr_main_db_host_for_backup, and added $dolibarr_main_db_host_for_backup to conf.php , but it didn’t work, it was producing the backup command with no hostname:
/usr/local/mariadb10/bin/mysqldump dolibarr [color=#ff0000]-h [/color] -u doli -P 3307 -l --single-transaction --add-drop-table=TRUE --tables -c -e --hex-blob --default-character-set=utf8 -p"********************************"
I don’t actually know php so I probably did something wrong in my attempted fix. Any help with a workaround for this would be greatly appreciated.