1Z0-909 · Question #5
Examine the Test.php script which is numbered for clarity, and its output: PHP Fatal error: Uncaught Error: call to underined function mysqli_connect () in Test.php:2 Which action will fix this error?
The correct answer is A. Enable the mysqli extension in the php.ini file. Option A is correct because the error "call to undefined function mysqli_connect()" means PHP cannot find the mysqli extension - it's installed but not enabled. Adding or uncommenting extension=mysqli in php.ini (and restarting the web server) makes the function available. Why…
Question
Examine the Test.php script which is numbered for clarity, and its output:
PHP Fatal error: Uncaught Error: call to underined function mysqli_connect () in Test.php:2 Which action will fix this error?
Exhibit
Options
- AEnable the mysqli extension in the php.ini file.
- BReplace line 2 with Slink = mysql.connect {"localhost: 3306n, "username", "pas "schema") ;
- CReplace line 2 With: Slink = mysql_xdevapi\getSession
- DInstall the PHP executable in the path used by the MySQL installation.
How the community answered
(23 responses)- A91% (21)
- B4% (1)
- C4% (1)
Explanation
Option A is correct because the error "call to undefined function mysqli_connect()" means PHP cannot find the mysqli extension - it's installed but not enabled. Adding or uncommenting extension=mysqli in php.ini (and restarting the web server) makes the function available.
Why the distractors fail:
- B uses invalid PHP syntax (
mysql.connect, curly braces for arguments) and references the older, removedmysql_*API - this code would itself throw a fatal error. - C references
mysql_xdevapi, which is a separate extension for the MySQL X Protocol (used with MySQL 8+ document store), not a drop-in replacement for standardmysqli_connect(). - D is a red herring - PHP and MySQL are separate runtimes; PHP's binary path has no bearing on whether a PHP extension is loaded.
Memory tip: "Undefined function" errors in PHP almost always mean a missing or disabled extension, not missing installation - think php.ini first, not file paths or syntax swaps.
Topics
Community Discussion
No community discussion yet for this question.
