I have been chasing this issue now for a week. I am new to PHP but have been programming in ASP.NET /VB for over 10 years. I have taken the time to document my issue with PHP connecting to a Localhost database and will try to provide a brief explanation of where I am at.
First some environment information.
OS - Windows 10 - 64bit.
DB - Both SQL Server Manager and MySQL Community. Both running on my development machine.
PHP - Version 7.2.12 Development Server running Localhost.
From my PHP.INI file here are the extensions I am running.
extension=mysqli
extension=odbc
extension=pdo_mysql
Under the ;Paths and DirectoriesI made the following changes.
Uncommented include_path = ".;c:\php\includes"
Uncommented and edited extension_dir = "c:\PHP\EXT"
Note: I also had a number of PHP drivers for MSSQL but have abandoned that attempt and moved to MyPHP
Note I got the same error when trying to use PHP and MSSQL. And the same error with a number of different coding attempts.
Fatal error: Uncaught Error: Call to undefined function mysql__construct() in C:\PHP\www\site.php:3 Stack trace: #0 {main} thrown in C:\PHP\www\site.php on line 3
From the error syntax, it appears that the PHP is attempting to call a function out of the driver and it is not being found. This could indicate that there is a compatibility issue the driver is not being called. I have conducted a great deal of research and there is a lot about this problem but most are a few years old. I have downloaded and installed the most current versions of PHP and the MySQL drivers.
I want to progress with PHP but need to be able to make connections to mySQL or MSSQL database. I would prefer now to use MySQL as it is more popular on hosting sites.
Issue with PHP and SQL Drivers - undefined function mysql__construct
in PHP
Posted
I have been chasing this issue now for a week. I am new to PHP but have been programming in ASP.NET /VB for over 10 years. I have taken the time to document my issue with PHP connecting to a Localhost database and will try to provide a brief explanation of where I am at.
First some environment information.
OS - Windows 10 - 64bit.
DB - Both SQL Server Manager and MySQL Community. Both running on my development machine.
PHP - Version 7.2.12 Development Server running Localhost.
From my PHP.INI file here are the extensions I am running.
extension=mysqli
extension=odbc
extension=pdo_mysql
Note: I also had a number of PHP drivers for MSSQL but have abandoned that attempt and moved to MyPHP
// MY TEST CODE \\
// HERE IS THE ERROR \\
Note I got the same error when trying to use PHP and MSSQL. And the same error with a number of different coding attempts.
Fatal error: Uncaught Error: Call to undefined function mysql__construct() in C:\PHP\www\site.php:3 Stack trace: #0 {main} thrown in C:\PHP\www\site.php on line 3
From the error syntax, it appears that the PHP is attempting to call a function out of the driver and it is not being found. This could indicate that there is a compatibility issue the driver is not being called. I have conducted a great deal of research and there is a lot about this problem but most are a few years old. I have downloaded and installed the most current versions of PHP and the MySQL drivers.
I want to progress with PHP but need to be able to make connections to mySQL or MSSQL database. I would prefer now to use MySQL as it is more popular on hosting sites.