Eric J.
Eric J.

Reputation: 150198

Windows, NetBeans: Where's the php.ini?

I have been away from PHP for quite a while, so hopefully this is a simple oversight. But, I am not able to include the MySQL extension.

Setup

Problem

Fatal error: Call to undefined function mysql_connect()

Attempted Resolution

Still fails with the same error

Diagnostic Output

Added a call to phpinfo() at the top of the page. That indicates:

Configuration File (php.ini) Path C:\Windows

However, there is no php.ini in C:\Windows. In fact, I searched all disks and found only the one php.ini file that I previously edited.

Question

Where is NetBeans / PHP pulling the configuration from when I run my project, and how can I edit that configuration?

Upvotes: 4

Views: 5366

Answers (3)

hakre
hakre

Reputation: 198214

From your description what you did to php.ini (excerpt):

extension=php_mysqli.dll
                   ^

But in your question you write:

Fatal error: Call to undefined function mysql_connect()

Which is a different extension, namely on windows:

extension=php_mysql.dll

(without the i)

Probably it's just a little oversight you're missing here. You have two options then:

  1. Port the code to mysqli_* functions (recommended for new code)
  2. Activate the old php_mysql.dll extension (for legacy code)

Do what fit's your needs. On windows, the folloing filenames (search your disk) are interesting:

  • php.ini - normally inside the directory where you find php.exe
  • php_mysql.dll - normally inside the ext subdirectory of the just said directory.

Upvotes: 0

Sammitch
Sammitch

Reputation: 32272

If there's no php.ini file listed as being loaded by phpinfo() then there is not one. PHP will use default values for everything in this case. Anything that needs to be overridden can be placed in a new php.ini in one of the locations specified by phpinfo() as being scanned for ini files.

Upvotes: 0

AlexP
AlexP

Reputation: 9857

Restart the web server/netbeans :-)

Upvotes: 1

Related Questions