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.
ssailerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Newly released Acronis True Image 2019

In announcing the release of the 15th Anniversary Edition of Acronis True Image 2019, the company revealed that its artificial intelligence-based anti-ransomware technology – stopped more than 200,000 ransomware attacks on 150,000 customers last year.

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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Databases

From novice to tech pro — start learning today.