0

This PHP script:

<?php
    ini_set("display_errors", 1);
    error_reporting(E_ALL);

    $foo = new mysqli();
    var_dump($foo);
?>

gives this error message:

Fatal error: Class 'mysqli' not found in /home/xubuntu/Documents/www/quote_register/foo.php on line 5". 

However, running this from the PHP console:

xubuntu@xubuntu:~/Documents/www/quote_register$ php -a
Interactive shell

php > $foo = new mysqli();
php > var_dump($foo);

dumps a mysqli-object as expected.

Honestly, I'm quite stumped by this... Anyone got any idea what's going on?

mort
  • 704
  • 2
  • 9
  • 21

1 Answers1

0

did you run the same php versions?

maybe a solution could be to check if cli and apache version have the same

  1. php version
  2. php ini-load
  3. php mysqli config

to do this, just try phpinfo() on both and compare

donald123
  • 5,638
  • 3
  • 26
  • 23