Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call to undefined function mysql_connect() #462

Open
hitch90 opened this issue Apr 15, 2020 · 7 comments
Open

Call to undefined function mysql_connect() #462

hitch90 opened this issue Apr 15, 2020 · 7 comments

Comments

@hitch90
Copy link

hitch90 commented Apr 15, 2020

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
Copy link
Collaborator

Hey,

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

mysql --version
mysqlcheck --version

@hitch90
Copy link
Author

hitch90 commented Apr 15, 2020

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
Copy link
Member

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

@hitch90
Copy link
Author

hitch90 commented Apr 17, 2020

yes

@Fichtner21
Copy link

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

@luboskmetko
Copy link
Member

@Fichtner21 thanks for the report. Could you try the new version to see if the problem persists #465?

@gpisarski
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants