I updated my xampp
to a new version, which now includes php7
all my scripts don't work anymore.
I found here some "solutions" which don't works.
I get these messages:
Fatal error: Uncaught Error: Call to undefined function odbc_connect()
Fatal error: Uncaught Error: Call to undefined function
mysql_connect()
I have the extensions in my php.ini
extension=php_bz2.dll
extension=php_curl.dll
extension=php_fileinfo.dll
extension=php_gd2.dll
extension=php_gettext.dll
;extension=php_gmp.dll
;extension=php_intl.dll
;extension=php_imap.dll
;extension=php_interbase.dll
;extension=php_ldap.dll
extension=php_mbstring.dll
extension=php_exif.dll
extension=php_mysql.dll
extension=php_mysql_libmysql.dll
extension=php_mysql_mysqlnd.dll
extension=php_mysqli.dll
;extension=php_oci8_12c.dll
;extension=php_openssl.dll
;extension=php_pdo_firebird.dll
extension=php_pdo_mysql.dll
;extension=php_pdo_oci.dll
extension=php_pdo_odbc.dll
;extension=php_pdo_pgsql.dll
extension=php_pdo_sqlite.dll
;extension=php_pgsql.dll
;extension=php_shmop.dll
;extension=php_snmp.dll
;extension=php_soap.dll
;extension=php_sockets.dll
;extension=php_sqlite3.dll
;extension=php_tidy.dll
;extension=php_xmlrpc.dll
;extension=php_xsl.dll
I saved the php.ini
and restarted my apache - but the result is the same.
Any ideas? :(
if still interested, in case u got old source with many mysql_ functions you could use wrapper functions for mysqli and then include it in any file that uses mysql_ funtions.The Wrapper file may could look like:
(may some functions are missing, as this was all functions i used in mysql_)
<?php
if (PHP_VERSION_ID > 59999)
{
function mysql_connect($a,$b,$c,$d=null) { return mysqli_connect($a,$b,$c,$d); }
function mysql_query($a,$b) { return mysqli_query($b,$a); }
function mysql_affected_rows($a) { return mysqli_affected_rows($a); }
function mysql_close($a) { return mysqli_close($a); }
function mysql_fetch_assoc($a) { return mysqli_fetch_assoc($a); }
function mysql_free_result ($a) { mysqli_stmt_free_result($a); }
function mysql_select_db ($a,$b) { mysqli_select_db($b,$a); }
}
?>
I used above code to quickly migrate some old dirty scripts with many mysql_querys in them. As you got enabled the mysqli extension in your ini-file, it should work for you either.
You should RTM。
The mysql extension was deprecated in PHP 5.5.0, and it was removed in PHP 7.0.0.
you can use Mysqli or PDO instead!
The mysql extension (and the mysql_* functions) have been deprecated since PHP 5.5. For a direct migration, you can use the mysqli extension and the mysqli_* OR PDO functions instead.
If you still want to use mysql extension and function. check out this link.
https://ckon.wordpress.com/2015/08/06/put-mysql-functions-back-into-php-7/