nerdexam
Oracle

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…

Application Development

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

1Z0-909 question #5 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)
  • A
    91% (21)
  • B
    4% (1)
  • C
    4% (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, removed mysql_* 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 standard mysqli_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

#PHP extensions#mysqli extension#database connectivity#PHP configuration

Community Discussion

No community discussion yet for this question.

Full 1Z0-909 Practice