xampp php 7调用未定义的函数(mysql&odbc)

我将 xampp </ code>更新为新版本,现在包含 php7 < / code>
all我的脚本不再起作用了。</ p>

我在这里找到了一些不起作用的“解决方案”。</ p>

我得到了 这些消息:</ p>


致命错误:未捕获错误:调用未定义函数odbc_connect()
致命错误:未捕获错误:调用未定义函数
mysql_connect()< / p>
</ blockquote>

我的 php.ini </ code> </ p>

  extension = php_bz2中有扩展名。  DLL 
extension = php_curl.dll
extension = php_fileinfo.dll
extension =文件php_gd2.dll
extension = php_gettext.dll \ N;延长= php_gmp.dll \ N;延长= php_intl.dll \ N;延长= php_imap.dll \ n; 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 \ N;延长= php_oci8_12c.dll \ N;延长= php_openssl.dll \ N;延长= php_pdo_firebird.dll
extension = php_pdo_mysql.dll \ N;延长= php_pdo_oci.dll
extension = php_pdo_odbc.dll \ N;延长= php_pdo_pgsql.dll
extension = php_pdo_sqlite.dll \ N;延长= php_pgsql.dll \ N;延长= php_shmop.dll \ N;延长= php_snmp.dll \ N;延长= php_soap.dll \ N;延长= php_sockets.dll \ N;延长= php_sqlite3.dll \ N;延长= php_tidy。 dll
; extension = php_xmlrpc.dll
; extension = php_xsl.dll
</ code> </ pre>

我保存了 php.ini </ code>并重新启动了我的 apache - 但结果是一样的。</ p>

任何想法? :( </ p>
</ div>

展开原文

原文

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? :(

drpsrvu85668
drpsrvu85668 但是我的php.ini中提供了这个扩展名
大约 4 年之前 回复
drnysdnnb2909701
drnysdnnb2909701 也许这个:stackoverflow.com/questions/34321203/...
大约 4 年之前 回复
duanpo1498
duanpo1498 好吧,为什么我得到错误:致命错误:未捕获错误:调用未定义函数odbc_connect()
大约 4 年之前 回复
douchui1657
douchui1657 odbc还在那里
大约 4 年之前 回复
dongxianghuan3587
dongxianghuan3587 有没有理由你不去看看自己?
大约 4 年之前 回复
duanpei4455
duanpei4455 好吧和odbc呢?
大约 4 年之前 回复
drudfe0446838
drudfe0446838 php7中不支持mysql
大约 4 年之前 回复
dongmin4990
dongmin4990 因为最后在PHP7中完全删除了mysql_*函数(从5.5中弃用)
大约 4 年之前 回复
duanliao3826
duanliao3826 php.net/mysql_connect阅读大红色框。
大约 4 年之前 回复

3个回答



你应该RTM。
在PHP 5.5.0中不推荐使用mysql扩展,它已经在PHP 7.0.0中删除了。
你 可以使用Mysqli或PDO代替!</ p>
</ div>

展开原文

原文

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!

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.



自PHP 5.5以来,不推荐使用mysql扩展(以及mysql_ *函数)。 对于直接迁移,您可以使用mysqli扩展和mysqli_ * OR PDO函数。</ p>

如果您仍想使用mysql扩展和函数。 查看此链接。
https ://ckon.wordpress.com/2015/08/06/put-mysql-functions-back-into-php-7/ </ p>
</ div>

展开原文

原文

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/

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐