Windows NetBeans: Where is php.ini?

I have been out of PHP for a long time, so hopefully this is a simple oversight. But I can not enable the MySQL extension.

Customization

  • 64-bit version of Windows 8 Pro
  • NetBeans 7.2.1 (PHP Embedded Web Server)
  • MySQL
  • PHP 5.4.8

Problem

Fatal error: call to undefined function mysql_connect ()

Attempt to resolve

  • Copy php.ini-development to php.ini (files where I installed PHP, E: \ Software \ php-5.4.8-Win32-VC9-x86)
  • Edit php.ini by uncommenting the lines
    • extension_dir = "ext"
    • extension = php_mysqli.dll
  • Added E: \ Software \ php-5.4.8-Win32-VC9-x86 \ ext for NetBeans PHP Include path in project properties

Still crashing with the same error

Diagnostic output

Added phpinfo () call at the top of the page. It means:

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

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

Question

Where is NetBeans / PHP retrieving the configuration since starting my project and how can I edit this configuration?

+4
source share
3 answers

Restart the web server / netbeans :-)

+1
source

If the php.ini file is not listed as a downloadable phpinfo() , then it is not. In this case, PHP will use the default values ​​for everything. All that needs to be redefined can be placed in the new php.ini in one of the places specified by phpinfo() , as scanned for ini files.

0
source

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

 extension=php_mysqli.dll ^ 

But in your question you write:

Fatal error: call to undefined function mysql_connect ()

This is another extension, namely windows:

 extension=php_mysql.dll 

(without i )

This is probably just a little supervision that you are missing here. You have two options:

  • Put the code in mysqli_* function (recommended for new code)
  • Activate old php_mysql.dll extension (for outdated code)

Do what suits your needs. The following file names are interesting in windows (search on your disk):

  • php.ini - usually inside the directory where you find php.exe
  • php_mysql.dll - usually inside the ext subdirectory of the directory just specified.
0
source

Source: https://habr.com/ru/post/1442178/


All Articles