XF 2.1 cannot use cmd.php commands

MesterPerfect

Active member
I cannot use cmd.php commands
php cmd.php xf-addon:create

Code:
PHP Fatal error:  Uncaught Error: Call to undefined function mysqli_init() in /home/test.mx-blind.com/public_html/src/XF/Db/Mysqli/Adapter.php:152
Stack trace:
#0 /home/test.mx-blind.com/public_html/src/XF/Db/Mysqli/Adapter.php(28): XF\Db\Mysqli\Adapter->makeConnection(Array)
#1 /home/test.mx-blind.com/public_html/src/XF/Error.php(85): XF\Db\Mysqli\Adapter->getConnection()
#2 /home/test.mx-blind.com/public_html/src/XF/App.php(2311): XF\Error->logException(Object(ErrorException), true, '')
#3 /home/test.mx-blind.com/public_html/src/XF.php(213): XF\App->logException(Object(ErrorException), true)
#4 [internal function]: XF::handleFatalError()
#5 {main}
  thrown in /home/test.mx-blind.com/public_html/src/XF/Db/Mysqli/Adapter.php on line 152
root@srv:/home/test.mx-blind.com/public_html#
 
You likely have multiple php versions.

Use whereis php to determine which one XF is using (which presumably has mysqli enabled) and use that explicitly.
 
You likely have multiple php versions.

Use whereis php to determine which one XF is using (which presumably has mysqli enabled) and use that explicitly.
Code:
root@srv:~# whereis php
php: /usr/bin/php7.2 /usr/bin/php /usr/lib/php /etc/php /usr/include/php /usr/share/php /usr/share/php7.2-common /usr/share/php7.2-readline /usr/share/php7.2-opcache /usr/share/php7.2-json /usr/share/php7.2-xml /usr/share/man/man1/php.1.gz
root@srv:~#
 
This command only reproduces the PHP versions that the system is using.
If you use multiple php versions, e.g. from Plesk, you can find php under: /opt/plesk/php/<phpversion>/bin/php

A CLI command must be called here like this:
sudo -u root /opt/plesk/php/7.4/bin/php /var/www/vhosts/elo-forum.org/httpdocs/cmd.php xf: run-jobs
and in /cron.d/mycronjob:

/4*** myftpuser /opt/plesk/php/7.4/bin/php /var/www/vhosts/mydomain.tld/httpdocs/cmd.php xf:run-jobs
to start the "xf: runjobs" task, and php7.4, every 4 minutes...
More...

Hth
 
Top Bottom