0

I'm using XAMPP and PHP CLI to test my PHP script locally. The problematic line (the line 98) in db.php is:

$this->mysqli = new mysqli($host, $user, $pass, $dbname, $port);

And the error is:

No such file or directory in /path/to/my/file/db.php on line 98

This problem only appears when I execute a PHP file that requires db.php in Terminal. It works fine when I run it in browser. How come?

The CLI command I use is:

php test.php

Well, that's a very simple command. Is there anything I missed?

Note: I'm using Mac OS X 10.10.1

PHP version:

PHP 5.5.14 (cli) (built: Sep  9 2014 19:09:25) 
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
Raptor
  • 53,206
  • 45
  • 230
  • 366
  • That's the complete error message? Not something more like `Fatal error: require(): Failed opening required 'abcd' (include_path='.') in ...\test - Kopie.php on line 2` ? – VolkerK Feb 03 '15 at 09:39
  • Yes, it's the complete error code already. I found this in : `/var/mail/my.username` – Raptor Feb 03 '15 at 09:47
  • Probably it can help you: http://stackoverflow.com/questions/1676688/php-mysql-connection-not-working-2002-no-such-file-or-directory – stepozer Feb 03 '15 at 10:59

0 Answers0