Mysqli_real_connect(): (HY000/2002)

I am trying to create cron jobs with linux crontab. So i need to call custom-cron.php in the public folder.

I am calling wp-load.php to initiate WordPress but i am getting this error all time:

PHP Warning:  mysqli_real_connect(): (HY000/2002): No such file or directory in /Users/johndoe/Sites/test/app/public/wp-includes/class-wpdb.php on line 1987

Hello @bmalkoc -

Does that file exist when you click “Go to site folder”? That error seems to indicate the file doesn’t exist, did you create it?

I don’t see it when I look in my typical install of WordPress.



1 Like

I think i know what is the problem.

I created crontab with this command: "/Users/johndode/Library/Application Support/Local/lightning-services/php-8.3.0+1/bin/darwin-arm64/bin/php" /Users/johndode/Sites/test/app/public/cron.php

When I check cron.php it gets the php.ini file from a different place. It does not get the php.ini that the site uses.