PHP v5.4 and Class 'mysqli' not found error

Hello folks,

   I upgraded to Web Expressions 4 from Web Matrix 3. I also upgraded my PHP from v5.3 to v5.4.
I checked in the applications option to ensure it had the right path for the php and it does.
But when I try to execute my page this is what I receive:

Fatal error: Class 'mysqli' not found in C:\Users\laptop\Documents\My Web Sites\SuppliersPHP\agentlogon.php on line 18

So I looked it up and mysqli should still be valid.
The web pages worked fine under PHP v5.3 in Web Matrix 3.
But I need to have Web Expression 4 working properly as its time to retire Web Matrix 3.
Can someone tell me what is wrong and how to fix it?
I really need PHP 5.4 and Web Expressions to work properly.
I also found a snippet of coding that test to see if mysqli is installed and it returns that it is not!
How can that be when I successfully used with PHP v5.3 in Web Matrix 3?

I have also included the entire section
<?php 
    require_once ("Includes/dbconfig.php");
    include("Includes/session.php");
   
    $baderr= "";

    if (isset($_POST['cancel']))
        {
           header ("Location: goodbye.php");
        }

    if (isset($_POST['submit']))
       {
           $username = $_POST['username'];
           $password = $_POST['password'];

        // create database connection
        $databaseConnection = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
        if ($databaseConnection->connect_error)
          {
            die("Database selection failed: " . $databaseConnection->connect_error);

          }else{

             $query = "SELECT * FROM agents WHERE AgentUserName = '$username' AND AgentPassword = '$password'";

             $result = $databaseConnection->query($query);

            if ($result->num_rows > 0)
               {
              // output data
                while($row = $result->fetch_assoc())
                   {
                      //set up global session vars to be used thru out pages
                        $_SESSION["UserType"] ="A";
                        $_SESSION["AgentRecId"] = $row["RecId"];
                        $_SESSION["MsSqlAgentId"] = $row["AgentIdPk"];
                        $_SESSION["AgentFirstName"] = $row["FirstName"];
                        $_SESSION["AgentLastName"] = $row["LastName"];
                        $_SESSION["AgencyName"] = $row["AgencyName"];
                        $_SESSION["AgentEmail"] = $row["EmailAddress"];
                   }
                     // close database connection and redirect to agents menu
                        mysqli_close($databaseConnection);
                        header ("Location: agentmenu.php");
           } else {
               $baderr = "Username/password combination is incorrect. Please try again";
           }
       }
    }
?>

Open in new window

of coding below:
OverthereAsked:
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.

Dan CraciunIT ConsultantCommented:
Check in php.ini for a line containing:
extension=mysqli.so
or in Windows:
extension=php_mysqli.dll

If it's commented out, remove the ;, then restart your web server.

HTH,
Dan
OverthereAuthor Commented:
I had checked the php.ini and removed the ; then restarted my IIS. I even rebooted. I am now receiving " PHP startup: Unable to load dynamic library c:\php\php_mysqli.dll"
I don't even have a file folder on c as PHP!

I made sure in Web Expression 4 that the application and site path for php was correct.
Its installed in C:\Program Files (x86)\php-5.4.45\php-cgi.exe

I then changed the php.ini - first to inserting the entire path and that resulted in it phewing.
And then uncommented to just:  extension=php_mysqli.dll
Still phews.

 What now?




I don't even have a file folder on c called "php"
Dan CraciunIT ConsultantCommented:
Search for "php_mysqli.dll" on your computer.
Exploring ASP.NET Core: Fundamentals

Learn to build web apps and services, IoT apps, and mobile backends by covering the fundamentals of ASP.NET Core and  exploring the core foundations for app libraries.

OverthereAuthor Commented:
here's what worked.
1. dragged my PHP folder to root (c:\)
2.adjusted my application and site options to that path
3. rechecked my php.ini

the error for mysqli.dll has disappeared but it is slower than a turtle. It was much,much faster in web Matrix 3. In addition, it now can not find pages. And the coding on pages are having a problem finding other pages. I use this:  
Any ideas on that one? this is discouraging.. I also noticed that when I create a website in web Expression, it does not appear in IIS 7 - why is that?
header("Location: agentmenu.php");

Open in new window

OverthereAuthor Commented:
Here's what I did - I uninstall web Expression4. Reverted back to Web Matrix 3.
Made sure that in the php.in file that any reference in the extensions section for mysqli.dll, including pdo , was unchecked. Works better but still can get their examples to work. My previos sites that used php 5.3 work fine now too.
What gives?
Ray PaseurCommented:
Some things changed between PHP 5.3 and PHP 5.4.  This article explains a bit of what you need to know.
https://dev.mysql.com/downloads/connector/php-mysqlnd/

Also, PHP 5.6+ is current and PHP 7 is only days away.  So running PHP 5.3 in 2015 is so out-of-date that it's asking for trouble these days.  Time to upgrade!

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
OverthereAuthor Commented:
I agree. I upgraded to 5.4 and depending on the components I am going to be using, I may upgrade to 5.6. Most of what I wrote in 5.3 was for demos and for myself as learning experience.
I did some more digging using IE and Chrome debugging options and it all points to the MySQL drivers. Haven't made a decision yet as to what I will do. I don't like MS Web Expression 4 - its buggy in my option. And Web Matrix 3 only supports  up PHP v5.5 - so I am kinda in a bind on that issue.
I like to be able to "preview" what the web page will render as a result of my PHP coding and as you know - some web developing packages don't handle that very well. Any suggestions?

Thank you again Ray for pointing me in the right path.
Ray PaseurCommented:
Check into Bitnami - they offer some virtual machine images that you can install on localhost.  I think you need a VMWare instance, but you can probably get that for free.
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
PHP

From novice to tech pro — start learning today.