Support

Akeeba Backup for Joomla!

#41742 cli.php execute

Posted in ‘Akeeba Backup for Joomla! 4 & 5’
This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

Environment Information

Joomla! version
5.2.5
PHP version
8.1.31
Akeeba Backup version
10.0.2

Latest post by avoysey on Wednesday, 26 March 2025 15:24 CDT

avoysey

EXTREMELY IMPORTANT: Please attach a ZIP file containing your Akeeba Backup log file in order for us to help you with any backup or restoration issue. If the file is over 10MiB, please upload it on your server and post a link to it.

I have some custom scripts that use Unite to automatically restore websites using Akeeba Backup. These have been failing when running Unite. I'm attempting to port the scripts to use kickstart and BRS CLI restore instead. I am getting an error when I set the dbport parameter in the config.yml.php file I get an error as below. If I leave the value as hte default null the script does not complain but does not restore the database

ERROR 


Unhandled OutOfRangeException exception

Invalid port number. Must be between 1 and 65535.

nicholas
Akeeba Staff
Manager

Can you please give me the line you are using in the config file? It looks like it's being read as either a value outside the range of integers stated, or as not an integer.

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

avoysey
site:
dbtype: mysqli
dbname: alvc_dv
dbhost: localhost
dbport: 3306
dbsocket: ''
 
It appears to be the dbport line that the cli.php execute command doesn't like

nicholas
Akeeba Staff
Manager

OK, what you have is actually an invalid configuration.

When using the database hostname localhost you are telling PHP to use a named pipe or socket to connect to the database. If you want to use a TCP/IP connection you need to set the hostname to 127.0.0.1. This is something I've documented since 2007 and it's the way PHP has worked ever since it added MySQL support a very long time ago.

Since you have set dbhost to localhost BRS looks at the  dbsocket parameter for the path to the named pipe or socket. However, you have explicitly set it to an empty string which does not point to a valid path. At this point, BRS tries to figure out what you tried doing, so it tries to parse dbsocket as the database port name, ignoring dbport (dbport is only read when dbhost is NOT localhost). Being an empty string, when converted to an integer it becomes 0 which is indeed out of range.

You should instead use this configuration:

dbtype: mysqli
dbname: alvc_dv
dbhost: 127.0.0.1
dbport: 3306

That is, change dbhost to 127.0.0.1 and remove dbsocket altogether.

Moreover, 3306 is the default MySQL port, so you can further simplify your configuration by removing the explicit declaration of the implicit default:

dbtype: mysqli
dbname: alvc_dv
dbhost: 127.0.0.1

My approach is to only set configuration values when they deviate from the defaults. This way I can easily tell what I've set myself (it's explicitly configured) and what is an implied default.

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

avoysey

Thanks - custom file with just the changes (dbname, dbhost as 127.0.0.1, dbuser and dbpass) worked

Support Information

Working hours: We are open Monday to Friday, 9am to 7pm Cyprus timezone (EET / EEST). Support is provided by the same developers writing the software, all of which live in Europe. You can still file tickets outside of our working hours, but we cannot respond to them until we're back at the office.

Support policy: We would like to kindly inform you that when using our support you have already agreed to the Support Policy which is part of our Terms of Service. Thank you for your understanding and for helping us help you!