• Status: Solved
  • Priority: Low
  • Security: Public
  • Views: 75
  • Last Modified:

How do I enable phpinfo() in php.ini?

I'm using Dreamweaver to connect to a MySQL database on localhost, and I'm suddenly getting the error:

Your PHP server doesn't have the MySQL or MySQLi module loaded or you can't use the mysql_(p)connect functions

How can I enable phpinfo() in php.ini?

Thank you.
0
ssailer
Asked:
ssailer
  • 8
  • 4
  • 2
3 Solutions
 
gr8gonzoConsultantCommented:
You don't "enable" phpinfo(). It's a core function of the PHP engine. You just create a blank file and add these 2 lines:

<?php
phpinfo();

...then save and view the page via its URL.

That particular error message sounds like you've got some old PHP code that uses the mysql_connect() or mysql_pconnect() functions, which have been deprecated for a while. You should be using mysqli instead, like mysqli_connect. Should be part of your PHP installation already.
1
 
ssailerAuthor Commented:
Ah, yes ... my Dreamweaver server behaviors are depreciated with the newer version of PHP code.  Got it.  Thank you!  I will adjust accordingly.
0
 
Julian HansenCommented:
Your error is suggesting you don't have the MySQLi extension enabled in your PHP.INI file.

First check:
Create this script
pi.php
<?php
phpinfo();

Open in new window

Save that to the root of your web folder and call it.
Search the results for MySQLi

If not found then search the above for PHP.INI and copy the path
Use that path to open PHP.INI in a text editor
ss155.jpgIn the PHP.INI file look for this line
;extension=php_mysqli.dll

Open in new window

If it has a ';' remove the ';'.
Save the file and restart your HTTP server.
Also check in the ext folder of your PHP folder that you have the following file
php_mysqli.dll

Open in new window

0
Improve Your Query Performance Tuning

In this FREE six-day email course, you'll learn from Janis Griffin, Database Performance Evangelist. She'll teach 12 steps that you can use to optimize your queries as much as possible and see measurable results in your work. Get started today!

 
ssailerAuthor Commented:
Julian, php_mysqli.dll is enabled AND php_mysqli.dll is in the ext folder.  Not sure why I'm getting this error now, as everything seems to be enabled.  

Thanks.
0
 
Julian HansenCommented:
Can you try this test script
<?php
$conn = new mysqli('SERVER', 'USER', 'PASSWORD', 'DB');

if ($conn->connect_error) {
    die('Connect Error (' . $conn->connect_errno . ') '
            . $conn->connect_error);
}

$query = "SHOW TABLES";
$result = $conn->query($query);
if ($result) {
  while($row = $result->fetch_array()) {
    echo "Table: {$row[0]}<br>";
  }
}

Open in new window

Copy that into a file (test.php or similar) place in the root of your web site and call it from the browser
(Remember to update the DB connection parameters to match your environment)
Does this give the same error.
0
 
ssailerAuthor Commented:
Julian, that works fine, and it displays all my tables.  Actually, I can browse all of my PHP files in localhost - I just can't create a Connection to them in Dreamweaver, or use any of the Dreamweaver behaviors.
0
 
Julian HansenCommented:
Ok, but that script is telling us your PHP is setup correctly which means the problem is somewhere else.

I am not a DW fundi so I am going to have to guess here.
a) Can you show us your code that is causing the problem
b) What version of PHP are you using
c) Is your code using the mysql() (NOTE, NOT mysqli()) library - if so that library has been deprecated and removed in later versions of PHP.
0
 
ssailerAuthor Commented:
Julian, I am unable to create a MySQL or a MySQLi Connection.
0
 
ssailerAuthor Commented:
I am using PHP version: 7.1.9
0
 
ssailerAuthor Commented:
I am also using XAMPP.  Thank you.
0
 
gr8gonzoConsultantCommented:
Make sure you answer Julian's last question. Search your code for "mysql_" and if you find any code that matches that, it might be the source of the problem.
0
 
ssailerAuthor Commented:
This is NOT commented out in php.ini:  extension=php_mysqli.dll

This is also correct:  mysqli.default_port=3306

These is NOT commented out:  
mysqli.default_host=
mysqli.default_user=
mysqli.default_pw=
0
 
Julian HansenCommented:
There is a difference between mysql_ and mysqli_ (note the 'i') in the second one.

extensions=php_mysqli.dll DOES NOT COVER THE FIRST CASE.

If you have code the uses mysql_ then that will cause the error you are seeing - even if MySQLi is installed.
0
 
ssailerAuthor Commented:
OK ... problem solved.  mysql.php was an older version, being created.  It's working now.  Thank you to everyone with your awesome suggestions!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 8
  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now