1

We're using mysqli, and have been for years, and under normal usage it works just fine. The problem we have is that when we try to use exec() to run code in the background it fails, and if we capture the output we see this:

Fatal error: Class 'mysqli' not found

At the point where we try to create a new mysqli object. We can call the same code by loading the PHP file in a browser, and the code executes just fine, including the usage of mysqli. For some reason it only fails when we attempt to execute it via exec(). All the rest of the code being exec'd appears to be working just fine.

Do we need to do something special to make mysqli available when running via exec()?

We're running PHP 7.2.30 on CentOS 6.10.

MaineChap
  • 13
  • 3
  • This question was more relevant to my situation, but thank you for suggesting the above solution, as it helped me perform a more useful search: https://stackoverflow.com/questions/181222/php-mysql-connect-wont-work-via-command-line – MaineChap Apr 30 '20 at 13:57

0 Answers0