Php Versions

I been coding php for quite a long time. I might as well post my question.
One of my php script failed access to my database with mysqli calls , so I created a simple script TestConn.php. It allows connecting to the data base via either $mysqli = new mysqli( $host, $username, $password, $db_name); or $mysqli = mysqli_connect($host, $username, $password, $db_name;). It works on the hosting site using PHP Version 7.2.21 and using Xammp7 PHP Version 7.0.6 but FAILS using Xammp7 with PHP Version 7.3.8. Any Ideas why version 7.3.8 fails?

mysql is on the end of its life. Even if you can connect with mysql you should not want too, The best option is to use PDO. Even if your code works then you will have problems with all other mysql(i) functions. You need to rewrite your code and use at least mysqli functions with prepared statements

Since you didn’t exactly state how this fails, what does your php error reporting say? What does your mysqli error reporting say?

Using xampp7, Ran http://localhost/derWk/phpinfo.php/ displays PHP Version 7.3.8
Ran https://localhost/DerMysql/TestConn.php/ received the following results.
Echo statements
This script is used to test two means of connecting to the database
Using mysqli = mysqli_connect(etc) to connect.
DerMysql\TestConn.php\ Host localhost, User root, Pw , DB addressbook, Table colleaque
Fatal error: Uncaught Error: Call to undefined function mysqli_connect() in F:\xampp7\htdocs\DerMysql\TestConn.php:18 Stack trace: #0 {main} thrown in F:\xampp7\htdocs\DerMysql\TestConn.php on line 18
Here is line 18, fails using mysqli_connect
$mysqli = mysqli_connect($host, $username, $password, $db_name);
Please note: phpinfo.php runs on xampp7 using PHP Version 7.0.6 and on my host using PHP Version 7.2.21. without errors.
My general question is what type of varication is used between versions of PHP?

Varication? No idea what you are asking.

The mysqli extension is not installed/enable in the php.ini.

Thank you for your fix. I notice that when downloading the latest php version, that php.ini file is not included. Copy a previous php.ini from php version 7.0.6, but the following incidents occur. When xammp7 starts, httpd.exe entry point nghttp2_session.set_local_window_size not located in nghtp2.dll. Also when running a php file that contains mysqli functions, a Certificate error occurs. Ignore the incidents and they run OK. None of these incidents occur using PHP version 7.0.6.

Sponsor our Newsletter | Privacy Policy | Terms of Service