xfiveco / generator-chisel

Chisel is a development framework for creating easy to maintain and fast WordPress websites.
https://www.getchisel.co
MIT License
270 stars 37 forks source link

Call to undefined function mysql_connect() #462

Open hitch90 opened 4 years ago

hitch90 commented 4 years ago

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

marcinkrzeminski commented 4 years ago

Hey,

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

mysql --version
mysqlcheck --version
hitch90 commented 4 years ago

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)```
luboskmetko commented 4 years ago

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

hitch90 commented 4 years ago

yes

Fichtner21 commented 3 years ago

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

luboskmetko commented 3 years ago

@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?

gpisarski commented 2 years ago

@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.