generator-chisel icon indicating copy to clipboard operation
generator-chisel copied to clipboard

Call to undefined function mysql_connect()

Open hitch90 opened this issue 5 years ago • 7 comments

I tried run yo chisel and after yarn install I had:

PHP Fatal error:  Uncaught Error: Call to undefined function mysql_connect() in C:\xampp\htdocs\reksio\wp\wp-includes\wp-db.php:1661
Stack trace:
#0 C:\xampp\htdocs\reksio\wp\wp-includes\wp-db.php(631): wpdb->db_connect()
#1 C:\xampp\htdocs\reksio\wp\wp-includes\load.php(426): wpdb->__construct()
#2 C:\xampp\htdocs\reksio\wp\wp-settings.php(126): require_wp_db()
#3 phar://C:/Users/Tomek/AppData/Roaming/npm/node_modules/generator-chisel/helpers/wp-cli.phar/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1237): require('C:\\xampp\\htdocs...')
#4 phar://C:/Users/Tomek/AppData/Roaming/npm/node_modules/generator-chisel/helpers/wp-cli.phar/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1158): WP_CLI\Runner->load_wordpress()
#5 phar://C:/Users/Tomek/AppData/Roaming/npm/node_modules/generator-chisel/helpers/wp-cli.phar/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php(23): WP_CLI\Runner->start()
#6 phar://C:/Users/Tomek/AppData/Roaming/npm/node_modules/generator-chisel/helpers/wp-cli.phar/vendor/wp-cli/wp-cli/php/bootstrap.php(74): WP in C:\xampp\htdocs\reksio\wp\wp-includes\wp-db.php on line 1661
Fatal error: Uncaught Error: Call to undefined function mysql_connect() in C:\xampp\htdocs\reksio\wp\wp-includes\wp-db.php:1661
Stack trace:
#0 C:\xampp\htdocs\reksio\wp\wp-includes\wp-db.php(631): wpdb->db_connect()
#1 C:\xampp\htdocs\reksio\wp\wp-includes\load.php(426): wpdb->__construct()
#2 C:\xampp\htdocs\reksio\wp\wp-settings.php(126): require_wp_db()
#3 phar://C:/Users/Tomek/AppData/Roaming/npm/node_modules/generator-chisel/helpers/wp-cli.phar/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1237): require('C:\\xampp\\htdocs...')
#4 phar://C:/Users/Tomek/AppData/Roaming/npm/node_modules/generator-chisel/helpers/wp-cli.phar/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1158): WP_CLI\Runner->load_wordpress()
#5 phar://C:/Users/Tomek/AppData/Roaming/npm/node_modules/generator-chisel/helpers/wp-cli.phar/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php(23): WP_CLI\Runner->start()
#6 phar://C:/Users/Tomek/AppData/Roaming/npm/node_modules/generator-chisel/helpers/wp-cli.phar/vendor/wp-cli/wp-cli/php/bootstrap.php(74): WP in C:\xampp\htdocs\reksio\wp\wp-includes\wp-db.php on line 1661
Error: There has been a critical error on your website.Learn more about debugging in WordPress. There has been a critical error on your website.

C:\Users\Tomek\AppData\Roaming\npm\node_modules\generator-chisel\helpers\index.js:21
        throw err;
        ^
255
(Use `node --trace-uncaught ...` to show where the exception was thrown)

I use the newest MariaDB

hitch90 avatar Apr 15 '20 14:04 hitch90

Hey,

are you able to run these commands from the command line (cmd.exe)?

mysql --version
mysqlcheck --version

marcinkrzeminski avatar Apr 15 '20 14:04 marcinkrzeminski

mysql  Ver 15.1 Distrib 10.5.2-MariaDB, for Win64 (AMD64), source revision f01e7a4741bdf6da419c8a9a0676978b35cb02b4

λ mysqlcheck --version
mysqlcheck  Ver 2.7.4-MariaDB Distrib 10.5.2-MariaDB, for Win64 (AMD64)```

hitch90 avatar Apr 15 '20 15:04 hitch90

@hitch90 thanks for reporting the issue. Can you install and run WP instance outside Chisel?

luboskmetko avatar Apr 16 '20 08:04 luboskmetko

yes

hitch90 avatar Apr 17 '20 05:04 hitch90

i have the same problem, some solved this? That kind of problem exist only when i want to use WP CLI.

Fichtner21 avatar Nov 02 '20 21:11 Fichtner21

@Fichtner21 thanks for the report. Could you try the new version to see if the problem persists https://github.com/xfiveco/generator-chisel/issues/465?

luboskmetko avatar Nov 03 '20 07:11 luboskmetko

@Fichtner21 I had the same issue, it's caused by PHP config, not Chisel itself. You probably don't have mysqli library enabled in your php.ini file. WordPress checks in db_connect method if mysqli is enabled, if not it tries to use mysql_connect function, but this function has been removed in PHP 7.0+ so you probably don't have a possibility to connect with your database.

gpisarski avatar Oct 22 '21 21:10 gpisarski