调用未定义的函数 mysql_query() [英] Call to undefined function mysql_query()

查看:72
本文介绍了调用未定义的函数 mysql_query()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法在此站点上找到此问题.当我加载我的页面时,我收到以下错误

调用未定义的函数mysql_query()

所以我检查了我的 phpinfo() 文件,但我根本找不到 mysql 扩展或任何扩展.所以我进入我的 php ini 文件并取消注释扩展

extension=php_pdo_mssql.dll扩展名=php_pdo_mysql.dll

我重新启动了我的 apache 服务器和 mysql,但没有任何改变,并且无法识别扩展.我有运行 mysql 服务器,我有运行 php 的 apache,但我很难加载扩展.所以我检查了我的扩展目录(我的 phpinfo() 指定的目录,那里什么都没有.)MacPorts 安装了除了我的扩展之外的所有东西.有没有搞错 ??还有什么我遗漏的吗.

php.ini

;;;;;;;;;;;;;;;;;;;;;;动态扩展;;;;;;;;;;;;;;;;;;;;;;;;如果您希望自动加载扩展程序,请使用以下命令;句法:;;扩展名=模块名.扩展名;;例如,在 Windows 上:;;扩展名=msql.dll;;...或在 UNIX 下:;;扩展名=msql.so;;...或使用路径:;;扩展名=/path/to/extension/msql.so;;如果您只提供扩展名,PHP 将在其;默认扩展目录.;;Windows 扩展;请注意,ODBC 支持是内置的,因此不需要 dll.;请注意,许多 DLL 文件位于 extensions/(PHP 4) ext/(PHP 5);扩展文件夹以及单独的 PECL DLL 下载 (PHP 5).;确保适当地设置 extension_dir 指令.;;扩展名=php_bz2.dll扩展名=php_curl.dll;扩展名=php_fileinfo.dll;扩展名=php_gd2.dll;扩展= p​​hp_gettext.dll;扩展=php_gmp.dll;扩展= p​​hp_intl.dll;扩展= p​​hp_imap.dll;扩展= p​​hp_interbase.dll;扩展=php_ldap.dll;扩展= p​​hp_mbstring.dll;扩展=php_exif.dll ;必须在 mbstring 之后,因为它取决于它扩展名=php_mysql.dll扩展名=php_mysqli.dll;扩展=php_oci8.dll ;与 Oracle 10gR2 即时客户端一起使用;扩展名=php_oci8_11g.dll ;与 Oracle 11gR2 即时客户端一起使用;扩展= p​​hp_openssl.dll;扩展= p​​hp_pdo_firebird.dll扩展名=php_pdo_mssql.dll扩展名=php_pdo_mysql.dll扩展名=php_pdo_oci.dll扩展名=php_pdo_odbc.dll;扩展=php_pdo_pgsql.dll;扩展=php_pdo_sqlite.dll;扩展=php_pgsql.dll;扩展= p​​hp_pspell.dll;扩展=php_shmop.dll;必须安装 PHP 发行版中可用的 MIBS 数据.;见 http://www.php.net/manual/en/snmp.installation.php;扩展= p​​hp_snmp.dll扩展名=php_soap.dll扩展名=php_sockets.dll扩展名=php_sqlite.dll扩展名=php_sqlite3.dll;扩展=php_sybase_ct.dll;扩展= p​​hp_tidy.dll;扩展=php_xmlrpc.dll;扩展=php_xsl.dll;扩展名=php_zip.dll;;;;;;;;;;;;;;;;;;;;模块设置;;;;;;;;;;;;;;;;;;;;[日期];定义日期函数使用的默认时区;http://php.net/date.timezone;日期.时区 =;http://php.net/date.default-latitude;date.default_latitude = 31.7667;http://php.net/date.default-longitude;date.default_longitude = 35.2333;http://php.net/date.sunrise-zenith;date.sunrise_zenith = 90.583333;http://php.net/date.sunset-zenith;date.sunset_zenith = 90.583333[筛选];http://php.net/filter.default;filter.default = unsafe_raw;http://php.net/filter.default-flags;filter.default_flags =[图标];iconv.input_encoding = ISO-8859-1;iconv.internal_encoding = ISO-8859-1;iconv.output_encoding = ISO-8859-1[国际];intl.default_locale =;该指令允许您在某些错误时产生 PHP 错误;发生在国际函数中.该值是产生的错误的级别.;默认值为 0,不会产生任何错误.;intl.error_level = E_WARNING[sqlite];http://php.net/sqlite.assoc-case;sqlite.assoc_case = 0[sqlite3];sqlite3.extension_dir =[原];PCRE 库回溯限制.;http://php.net/pcre.backtrack-limit;pcre.backtrack_limit=100000;PCRE 库递归限制.;请注意,如果您将此值设置为较高的数字,您可能会消耗所有;可用的进程堆栈并最终使 PHP 崩溃(由于达到;操作系统强加的堆栈大小限制).;http://php.net/pcre.recursion-limit;pcre.recursion_limit=100000[Pdo];是否池化 ODBC 连接.可以是严格"、放松"或放松"之一.或关闭";http://php.net/pdo-odbc.connection-pooling;pdo_odbc.connection_pooling=严格;pdo_odbc.db2_instance_name[Pdo_mysql];如果使用 mysqlnd:内部结果集缓存的缓存槽数;http://php.net/pdo_mysql.cache_sizepdo_mysql.cache_size = 2000;本地 MySQL 连接的默认套接字名称.如果为空,则使用内置;MySQL 默认值.;http://php.net/pdo_mysql.default-socketpdo_mysql.default_socket=[药房];http://php.net/phar.readonly;phar.readonly = 开;http://php.net/phar.require-hash;phar.require_hash = 开;phar.cache_list =[系统日志];是否定义各种系统日志变量(例如 $LOG_PID、;$LOG_CRON 等).关闭它在性能方面是一个好主意.在;运行时,您可以通过调用define_syslog_variables() 来定义这些变量.;http://php.net/define-syslog-variablesdefine_syslog_variables = 关闭【邮件功能】;仅适用于 Win32.;http://php.net/smtpSMTP = 本地主机;http://php.net/smtp-portsmtp_port = 25;仅适用于 Win32.;http://php.net/sendmail-from;sendmail_from = me@example.com;仅适用于 Unix.您也可以提供参数(默认值:sendmail -t -i").;http://php.net/sendmail-path;发送邮件路径=;强制添加指定参数作为额外参数传递;到 sendmail 二进制文件.这些参数将始终替换的值;mail() 的第 5 个参数,即使在安全模式下.;mail.force_extra_parameters =;添加 X-PHP-Originating-Script: 这将包含脚本的 uid,后跟文件名mail.add_x_header = 开;将记录所有 mail() 调用的日志文件的路径.日志条目包括;脚本的完整路径、行号、地址和标题.;mail.log =[SQL];http://php.net/sql.safe-modesql.safe_mode = 关闭[ODBC];http://php.net/odbc.default-db;odbc.default_db = 尚未实现;http://php.net/odbc.default-user;odbc.default_user = 尚未实现;http://php.net/odbc.default-pw;odbc.default_pw = 尚未实现;控制 ODBC 游标模型.;默认值:SQL_CURSOR_STATIC(默认值).;odbc.default_cursortype;允许或阻止持久链接.;http://php.net/odbc.allow-persistentodbc.allow_persistent = 开;在重用之前检查连接是否仍然有效.;http://php.net/odbc.check-persistentodbc.check_persistent = 开;最大持久链接数.-1 表示没有限制.;http://php.net/odbc.max-persistentodbc.max_persistent = -1;最大链接数(持久 + 非持久).-1 表示没有限制.;http://php.net/odbc.max-linksodbc.max_links = -1;LONG 字段的处理.将字节数返回给变量.0 表示;通路.;http://php.net/odbc.defaultlrlodbc.defaultlrl = 4096;二进制数据的处理.0 表示通过,1 原样返回,2 转换为字符.;有关说明,请参阅有关 odbc_binmode 和 odbc_longreadlen 的文档;odbc.defaultlrl 和 odbc.defaultbinmode;http://php.net/odbc.defaultbinmodeodbc.defaultbinmode = 1;birdstep.max_links = -1[MySQL];从 PHP 的角度来看,允许使用 LOAD DATA 语句访问本地文件;http://php.net/mysql.allow_local_infilemysql.allow_local_infile = On;允许或阻止持久链接.;http://php.net/mysql.allow-persistentmysql.allow_persistent = 开;如果使用 mysqlnd:内部结果集缓存的缓存槽数;http://php.net/mysql.cache_sizemysql.cache_size = 2000;最大持久链接数.-1 表示没有限制.;http://php.net/mysql.max-persistentmysql.max_persistent = -1;最大链接数(持久 + 非持久).-1 表示没有限制.;http://php.net/mysql.max-linksmysql.max_links = -1;mysql_connect() 的默认端口号.如果未设置,mysql_connect() 将使用;$MYSQL_TCP_PORT 或/etc/services 中的 mysql-tcp 条目或;MYSQL_PORT 定义的编译时值(按该顺序).Win32 只会看;在 MYSQL_PORT.;http://php.net/mysql.default-portmysql.default_port =;本地 MySQL 连接的默认套接字名称.如果为空,则使用内置;MySQL 默认值.;http://php.net/mysql.default-socketmysql.default_socket =;mysql_connect() 的默认主机(不适用于安全模式).;http://php.net/mysql.default-hostmysql.default_host =;mysql_connect() 的默认用户(不适用于安全模式).;http://php.net/mysql.default-usermysql.default_user =;mysql_connect() 的默认密码(不适用于安全模式).;请注意,将密码存储在此文件中通常是一个*坏*主意.;*任何*具有 PHP 访问权限的用户都可以运行 'echo get_cfg_var("mysql.default_password");并透露这个密码!当然,任何对此具有读取权限的用户;文件也将能够显示密码.;http://php.net/mysql.default-passwordmysql.default_password =;连接超时的最长时间(以秒为单位).-1 表示没有限制;http://php.net/mysql.connect-timeoutmysql.connect_timeout = 60;跟踪模式.当 trace_mode 处于活动状态 (=On) 时,表/索引扫描和;将显示 SQL 错误.;http://php.net/mysql.trace-modemysql.trace_mode = 关闭[MySQL];最大持久链接数.-1 表示没有限制.;http://php.net/mysqli.max-persistentmysqli.max_persistent = -1;从 PHP 的角度来看,允许使用 LOAD DATA 语句访问本地文件;http://php.net/mysqli.allow_local_infile;mysqli.allow_local_infile = On;允许或阻止持久链接.;http://php.net/mysqli.allow-persistentmysqli.allow_persistent = 开;最大链接数.-1 表示没有限制.;http://php.net/mysqli.max-linksmysqli.max_links = -1;如果使用 mysqlnd:内部结果集缓存的缓存槽数;http://php.net/mysqli.cache_sizemysqli.cache_size = 2000;mysqli_connect() 的默认端口号.如果未设置,mysqli_connect() 将使用;$MYSQL_TCP_PORT 或/etc/services 中的 mysql-tcp 条目或;MYSQL_PORT 定义的编译时值(按该顺序).Win32 只会看;在 MYSQL_PORT.;http://php.net/mysqli.default-portmysqli.default_port = 3306;本地 MySQL 连接的默认套接字名称.如果为空,则使用内置;MySQL 默认值.;http://php.net/mysqli.default-socketmysqli.default_socket =;mysql_connect() 的默认主机(不适用于安全模式).;http://php.net/mysqli.default-hostmysqli.default_host =;mysql_connect() 的默认用户(不适用于安全模式).;http://php.net/mysqli.default-usermysqli.default_user =;mysqli_connect() 的默认密码(不适用于安全模式).;请注意,将密码存储在此文件中通常是一个*坏*主意.;*任何*具有 PHP 访问权限的用户都可以运行 'echo get_cfg_var("mysqli.default_pw");并透露这个密码!当然,任何对此具有读取权限的用户;文件也将能够显示密码.;http://php.net/mysqli.default-pwmysqli.default_pw =;允许或阻止重新连接mysqli.reconnect = 关闭[mysqlnd];启用/禁用 mysqlnd 收集一般统计信息;用于调整和监控 MySQL 操作.;http://php.net/mysqlnd.collect_statisticsmysqlnd.collect_statistics = On;启用/禁用 mysqlnd 收集内存使用统计信息;用于调整和监控 MySQL 操作.;http://php.net/mysqlnd.collect_memory_statisticsmysqlnd.collect_memory_statistics = On;向 MySQL 发送命令时使用的预分配缓冲区的大小(以字节为单位).;http://php.net/mysqlnd.net_cmd_buffer_size;mysqlnd.net_cmd_buffer_size = 2048;用于读取服务器发送的数据的预分配缓冲区的大小;字节.;http://php.net/mysqlnd.net_read_buffer_size;mysqlnd.net_read_buffer_size = 32768[OCI8];连接:使用外部启用特权连接;凭据(OCI_SYSOPER、OCI_SYSDBA);http://php.net/oci8.privileged-connect;oci8.privileged_connect = 关闭;Connection:每个持续 OCI8 连接的最大数量;过程.使用 -1 表示没有限制.;http://php.net/oci8.max-persistent;oci8.max_persistent = -1;连接:进程允许的最大秒数;保持空闲的持久连接.使用 -1 表示空闲;持久连接将永远保持.;http://php.net/oci8.persistent-timeout;oci8.persistent_timeout = -1;连接:发出请求前必须经过的秒数;在 oci_pconnect() 期间 ping 以检查连接有效性.什么时候;设置为 0,每个 oci_pconnect() 都会导致 ping.使用 -1 禁用;ping 完全.;http://php.net/oci8.ping-interval;oci8.ping_interval = 60;连接:将此设置为用户选择的要使用的连接类;使用 Oracle 11g Database Resident 的所有池化服务器请求;连接池 (DRCP).要使用 DRCP,应将此值设置为;运行相同应用程序的所有 Web 服务器的相同字符串,;必须配置数据库池,连接字符串必须;指定使用池服务器.;oci8.connection_class =;高可用性:使用 On 让 PHP 接收快速应用程序;数据库节点发生故障时生成的通知 (FAN) 事件.这;数据库还必须配置为发布 FAN 事件.;oci8.events = 关闭;调整:此选项启用语句缓存,并指定如何;许多语句要缓存.使用 0 禁用语句缓存.;http://php.net/oci8.statement-cache-size;oci8.statement_cache_size = 20;调整:启用语句预取并设置默认数量;语句执行后将自动获取的行.;http://php.net/oci8.default-prefetch;oci8.default_prefetch = 100;兼容性.使用 On 意味着 oci_close() 不会关闭;oci_connect() 和 oci_new_connect() 连接.;http://php.net/oci8.old-oci-close-semantics;oci8.old_oci_close_semantics = 关闭[PostgreSQL];允许或阻止持久链接.;http://php.net/pgsql.allow-persistentpgsql.allow_persistent = On;始终使用 pg_pconnect() 检测断开的持久链接.;自动重置功能需要一些开销.;http://php.net/pgsql.auto-reset-persistentpgsql.auto_reset_persistent = 关闭;最大持久链接数.-1 表示没有限制.;http://php.net/pgsql.max-persistentpgsql.max_persistent = -1;最大链接数(持久+非持久).-1 表示没有限制.;http://php.net/pgsql.max-linkspgsql.max_links = -1;忽略 PostgreSQL 后端通知消息与否.;注意消息记录需要一些开销.;http://php.net/pgsql.ignore-noticepgsql.ignore_notice = 0;Log PostgreSQL backends Notice 消息与否.;除非 pgsql.ignore_notice=0,否则模块无法记录通知消息.;http://php.net/pgsql.log-noticepgsql.log_notice = 0[Sybase-CT];允许或阻止持久链接.;http://php.net/sybct.allow-persistentsybct.allow_persistent = 开;最大持久链接数.-1 表示没有限制.;http://php.net/sybct.max-persistentsybct.max_persistent = -1;最大链接数(持久 + 非持久).-1 表示没有限制.;http://php.net/sybct.max-linkssybct.max_links = -1;要显示的最低服务器消息严重性.;http://php.net/sybct.min-server-severitysybct.min_server_severity = 10;要显示的最低客户端消息严重性.;http://php.net/sybct.min-client-severitysybct.min_client_severity = 10;设置每个上下文超时;http://php.net/sybct.timeout;sybct.timeout=;sybct.packet_size;在返回失败之前等待连接尝试成功的最长时间(以秒为单位).;默认值:一分钟;sybct.login_timeout=;您声称要连接的主机的名称,由 sp_who 显示.;默认值:无;sybct.hostname=;允许您定义重试死锁的频率.-1 表示永远".;默认值:0;sybct.deadlock_retry_count=[bcmath];所有 bcmath 函数的十进制位数.;http://php.net/bcmath.scalebcmath.scale = 0

编辑

我正在使用 Mac 并检查上面的设置.我也安装了 php_mysql.dll 文件

extension=php_mysql.dll扩展名=php_mysqli.dll

这是我的phpinfo()页面

在我的页面上出现了 3 次 mysql.

编辑

好的,我有一个屏幕截图,显示了扩展目录的位置,但是当我去那里时,我没有看到任何扩展.macports 安装会损坏吗??

解决方案

mysql_query() 不是 PDO 的一部分,因此您正在检查的 DLL(这是 PDO 的用于 MySQL 支持的 dll)不是你应该检查的那个.您想检查 php_mysql.dll(Linux 服务器上的 .so).

但 PDO 绝对是访问 MySQL 的正确方式.它比使用 mysql_query() 好得多.

在此处阅读更多内容,在 PHP 的 PDO 页面.>

I wasn't able to find this issue on this site. when I load my page, i get the following error

Call to undefined function mysql_query() 

So my checked my phpinfo() file and I couldn't find the mysql extensions or any extensions at all. So I went into my php ini file and uncommented the extensions

extension=php_pdo_mssql.dll
extension=php_pdo_mysql.dll

I restarted my apache server and mysql and yet nothing changed and the extensions are not being recognized. I have mysql server running, i have apache running with php,but I am having a hard time getting extensions to load. so I checked my extension directory (the directory my phpinfo() specified and there is nothing there.) MacPorts installed everything except my extensions. what the heck ?? And is there anything else I am missing.

php.ini

;;;;;;;;;;;;;;;;;;;;;;
; Dynamic Extensions ;
;;;;;;;;;;;;;;;;;;;;;;

; If you wish to have an extension loaded automatically, use the following
; syntax:
;
;   extension=modulename.extension
;
; For example, on Windows:
;
;   extension=msql.dll
;
; ... or under UNIX:
;
;   extension=msql.so
;
; ... or with a path:
;
;   extension=/path/to/extension/msql.so
;
; If you only provide the name of the extension, PHP will look for it in its
; default extension directory.
;
; Windows Extensions
; Note that ODBC support is built in, so no dll is needed for it.
; Note that many DLL files are located in the extensions/ (PHP 4) ext/ (PHP 5)
; extension folders as well as the separate PECL DLL download (PHP 5).
; Be sure to appropriately set the extension_dir directive.
;
;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      ; Must be after mbstring as it depends on it
extension=php_mysql.dll
extension=php_mysqli.dll
;extension=php_oci8.dll      ; Use with Oracle 10gR2 Instant Client
;extension=php_oci8_11g.dll  ; Use with Oracle 11gR2 Instant Client
;extension=php_openssl.dll
;extension=php_pdo_firebird.dll
extension=php_pdo_mssql.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_pspell.dll
;extension=php_shmop.dll

; The MIBS data available in the PHP distribution must be installed. 
; See http://www.php.net/manual/en/snmp.installation.php 
;extension=php_snmp.dll

extension=php_soap.dll
extension=php_sockets.dll
extension=php_sqlite.dll
extension=php_sqlite3.dll
;extension=php_sybase_ct.dll
;extension=php_tidy.dll
;extension=php_xmlrpc.dll
;extension=php_xsl.dll
;extension=php_zip.dll

;;;;;;;;;;;;;;;;;;;
; Module Settings ;
;;;;;;;;;;;;;;;;;;;

[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
;date.timezone =

; http://php.net/date.default-latitude
;date.default_latitude = 31.7667

; http://php.net/date.default-longitude
;date.default_longitude = 35.2333

; http://php.net/date.sunrise-zenith
;date.sunrise_zenith = 90.583333

; http://php.net/date.sunset-zenith
;date.sunset_zenith = 90.583333

[filter]
; http://php.net/filter.default
;filter.default = unsafe_raw

; http://php.net/filter.default-flags
;filter.default_flags =

[iconv]
;iconv.input_encoding = ISO-8859-1
;iconv.internal_encoding = ISO-8859-1
;iconv.output_encoding = ISO-8859-1

[intl]
;intl.default_locale =
; This directive allows you to produce PHP errors when some error
; happens within intl functions. The value is the level of the error produced.
; Default is 0, which does not produce any errors.
;intl.error_level = E_WARNING

[sqlite]
; http://php.net/sqlite.assoc-case
;sqlite.assoc_case = 0

[sqlite3]
;sqlite3.extension_dir =

[Pcre]
;PCRE library backtracking limit.
; http://php.net/pcre.backtrack-limit
;pcre.backtrack_limit=100000

;PCRE library recursion limit.
;Please note that if you set this value to a high number you may consume all
;the available process stack and eventually crash PHP (due to reaching the
;stack size limit imposed by the Operating System).
; http://php.net/pcre.recursion-limit
;pcre.recursion_limit=100000

[Pdo]
; Whether to pool ODBC connections. Can be one of "strict", "relaxed" or "off"
; http://php.net/pdo-odbc.connection-pooling
;pdo_odbc.connection_pooling=strict

;pdo_odbc.db2_instance_name

[Pdo_mysql]
; If mysqlnd is used: Number of cache slots for the internal result set cache
; http://php.net/pdo_mysql.cache_size
pdo_mysql.cache_size = 2000

; Default socket name for local MySQL connects.  If empty, uses the built-in
; MySQL defaults.
; http://php.net/pdo_mysql.default-socket
pdo_mysql.default_socket=

[Phar]
; http://php.net/phar.readonly
;phar.readonly = On

; http://php.net/phar.require-hash
;phar.require_hash = On

;phar.cache_list =

[Syslog]
; Whether or not to define the various syslog variables (e.g. $LOG_PID,
; $LOG_CRON, etc.).  Turning it off is a good idea performance-wise.  In
; runtime, you can define these variables by calling define_syslog_variables().
; http://php.net/define-syslog-variables
define_syslog_variables  = Off

[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = localhost
; http://php.net/smtp-port
smtp_port = 25

; For Win32 only.
; http://php.net/sendmail-from
;sendmail_from = me@example.com

; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
; http://php.net/sendmail-path
;sendmail_path =

; Force the addition of the specified parameters to be passed as extra parameters
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail(), even in safe mode.
;mail.force_extra_parameters =

; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename
mail.add_x_header = On

; The path to a log file that will log all mail() calls. Log entries include
; the full path of the script, line number, To address and headers.
;mail.log =

[SQL]
; http://php.net/sql.safe-mode
sql.safe_mode = Off

[ODBC]
; http://php.net/odbc.default-db
;odbc.default_db    =  Not yet implemented

; http://php.net/odbc.default-user
;odbc.default_user  =  Not yet implemented

; http://php.net/odbc.default-pw
;odbc.default_pw    =  Not yet implemented

; Controls the ODBC cursor model.
; Default: SQL_CURSOR_STATIC (default).
;odbc.default_cursortype

; Allow or prevent persistent links.
; http://php.net/odbc.allow-persistent
odbc.allow_persistent = On

; Check that a connection is still valid before reuse.
; http://php.net/odbc.check-persistent
odbc.check_persistent = On

; Maximum number of persistent links.  -1 means no limit.
; http://php.net/odbc.max-persistent
odbc.max_persistent = -1

; Maximum number of links (persistent + non-persistent).  -1 means no limit.
; http://php.net/odbc.max-links
odbc.max_links = -1

; Handling of LONG fields.  Returns number of bytes to variables.  0 means
; passthru.
; http://php.net/odbc.defaultlrl
odbc.defaultlrl = 4096

; Handling of binary data.  0 means passthru, 1 return as is, 2 convert to char.
; See the documentation on odbc_binmode and odbc_longreadlen for an explanation
; of odbc.defaultlrl and odbc.defaultbinmode
; http://php.net/odbc.defaultbinmode
odbc.defaultbinmode = 1

;birdstep.max_links = -1



[MySQL]
; Allow accessing, from PHP's perspective, local files with LOAD DATA statements
; http://php.net/mysql.allow_local_infile
mysql.allow_local_infile = On

; Allow or prevent persistent links.
; http://php.net/mysql.allow-persistent
mysql.allow_persistent = On

; If mysqlnd is used: Number of cache slots for the internal result set cache
; http://php.net/mysql.cache_size
mysql.cache_size = 2000

; Maximum number of persistent links.  -1 means no limit.
; http://php.net/mysql.max-persistent
mysql.max_persistent = -1

; Maximum number of links (persistent + non-persistent).  -1 means no limit.
; http://php.net/mysql.max-links
mysql.max_links = -1

; Default port number for mysql_connect().  If unset, mysql_connect() will use
; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the
; compile-time value defined MYSQL_PORT (in that order).  Win32 will only look
; at MYSQL_PORT.
; http://php.net/mysql.default-port
mysql.default_port =

; Default socket name for local MySQL connects.  If empty, uses the built-in
; MySQL defaults.
; http://php.net/mysql.default-socket
mysql.default_socket =

; Default host for mysql_connect() (doesn't apply in safe mode).
; http://php.net/mysql.default-host
mysql.default_host =

; Default user for mysql_connect() (doesn't apply in safe mode).
; http://php.net/mysql.default-user
mysql.default_user =

; Default password for mysql_connect() (doesn't apply in safe mode).
; Note that this is generally a *bad* idea to store passwords in this file.
; *Any* user with PHP access can run 'echo get_cfg_var("mysql.default_password")
; and reveal this password!  And of course, any users with read access to this
; file will be able to reveal the password as well.
; http://php.net/mysql.default-password
mysql.default_password =

; Maximum time (in seconds) for connect timeout. -1 means no limit
; http://php.net/mysql.connect-timeout
mysql.connect_timeout = 60

; Trace mode. When trace_mode is active (=On), warnings for table/index scans and
; SQL-Errors will be displayed.
; http://php.net/mysql.trace-mode
mysql.trace_mode = Off

[MySQLi]

; Maximum number of persistent links.  -1 means no limit.
; http://php.net/mysqli.max-persistent
mysqli.max_persistent = -1

; Allow accessing, from PHP's perspective, local files with LOAD DATA statements
; http://php.net/mysqli.allow_local_infile
;mysqli.allow_local_infile = On

; Allow or prevent persistent links.
; http://php.net/mysqli.allow-persistent
mysqli.allow_persistent = On

; Maximum number of links.  -1 means no limit.
; http://php.net/mysqli.max-links
mysqli.max_links = -1

; If mysqlnd is used: Number of cache slots for the internal result set cache
; http://php.net/mysqli.cache_size
mysqli.cache_size = 2000

; Default port number for mysqli_connect().  If unset, mysqli_connect() will use
; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the
; compile-time value defined MYSQL_PORT (in that order).  Win32 will only look
; at MYSQL_PORT.
; http://php.net/mysqli.default-port
mysqli.default_port = 3306

; Default socket name for local MySQL connects.  If empty, uses the built-in
; MySQL defaults.
; http://php.net/mysqli.default-socket
mysqli.default_socket =

; Default host for mysql_connect() (doesn't apply in safe mode).
; http://php.net/mysqli.default-host
mysqli.default_host =

; Default user for mysql_connect() (doesn't apply in safe mode).
; http://php.net/mysqli.default-user
mysqli.default_user =

; Default password for mysqli_connect() (doesn't apply in safe mode).
; Note that this is generally a *bad* idea to store passwords in this file.
; *Any* user with PHP access can run 'echo get_cfg_var("mysqli.default_pw")
; and reveal this password!  And of course, any users with read access to this
; file will be able to reveal the password as well.
; http://php.net/mysqli.default-pw
mysqli.default_pw =

; Allow or prevent reconnect
mysqli.reconnect = Off

[mysqlnd]
; Enable / Disable collection of general statistics by mysqlnd which can be
; used to tune and monitor MySQL operations.
; http://php.net/mysqlnd.collect_statistics
mysqlnd.collect_statistics = On

; Enable / Disable collection of memory usage statistics by mysqlnd which can be
; used to tune and monitor MySQL operations.
; http://php.net/mysqlnd.collect_memory_statistics
mysqlnd.collect_memory_statistics = On

; Size of a pre-allocated buffer used when sending commands to MySQL in bytes.
; http://php.net/mysqlnd.net_cmd_buffer_size
;mysqlnd.net_cmd_buffer_size = 2048

; Size of a pre-allocated buffer used for reading data sent by the server in
; bytes.
; http://php.net/mysqlnd.net_read_buffer_size
;mysqlnd.net_read_buffer_size = 32768

[OCI8]

; Connection: Enables privileged connections using external
; credentials (OCI_SYSOPER, OCI_SYSDBA)
; http://php.net/oci8.privileged-connect
;oci8.privileged_connect = Off

; Connection: The maximum number of persistent OCI8 connections per
; process. Using -1 means no limit.
; http://php.net/oci8.max-persistent
;oci8.max_persistent = -1

; Connection: The maximum number of seconds a process is allowed to
; maintain an idle persistent connection. Using -1 means idle
; persistent connections will be maintained forever.
; http://php.net/oci8.persistent-timeout
;oci8.persistent_timeout = -1

; Connection: The number of seconds that must pass before issuing a
; ping during oci_pconnect() to check the connection validity. When
; set to 0, each oci_pconnect() will cause a ping. Using -1 disables
; pings completely.
; http://php.net/oci8.ping-interval
;oci8.ping_interval = 60

; Connection: Set this to a user chosen connection class to be used
; for all pooled server requests with Oracle 11g Database Resident
; Connection Pooling (DRCP).  To use DRCP, this value should be set to
; the same string for all web servers running the same application,
; the database pool must be configured, and the connection string must
; specify to use a pooled server.
;oci8.connection_class =

; High Availability: Using On lets PHP receive Fast Application
; Notification (FAN) events generated when a database node fails. The
; database must also be configured to post FAN events.
;oci8.events = Off

; Tuning: This option enables statement caching, and specifies how
; many statements to cache. Using 0 disables statement caching.
; http://php.net/oci8.statement-cache-size
;oci8.statement_cache_size = 20

; Tuning: Enables statement prefetching and sets the default number of
; rows that will be fetched automatically after statement execution.
; http://php.net/oci8.default-prefetch
;oci8.default_prefetch = 100

; Compatibility. Using On means oci_close() will not close
; oci_connect() and oci_new_connect() connections.
; http://php.net/oci8.old-oci-close-semantics
;oci8.old_oci_close_semantics = Off

[PostgreSQL]
; Allow or prevent persistent links.
; http://php.net/pgsql.allow-persistent
pgsql.allow_persistent = On

; Detect broken persistent links always with pg_pconnect().
; Auto reset feature requires a little overheads.
; http://php.net/pgsql.auto-reset-persistent
pgsql.auto_reset_persistent = Off

; Maximum number of persistent links.  -1 means no limit.
; http://php.net/pgsql.max-persistent
pgsql.max_persistent = -1

; Maximum number of links (persistent+non persistent).  -1 means no limit.
; http://php.net/pgsql.max-links
pgsql.max_links = -1

; Ignore PostgreSQL backends Notice message or not.
; Notice message logging require a little overheads.
; http://php.net/pgsql.ignore-notice
pgsql.ignore_notice = 0

; Log PostgreSQL backends Notice message or not.
; Unless pgsql.ignore_notice=0, module cannot log notice message.
; http://php.net/pgsql.log-notice
pgsql.log_notice = 0

[Sybase-CT]
; Allow or prevent persistent links.
; http://php.net/sybct.allow-persistent
sybct.allow_persistent = On

; Maximum number of persistent links.  -1 means no limit.
; http://php.net/sybct.max-persistent
sybct.max_persistent = -1

; Maximum number of links (persistent + non-persistent).  -1 means no limit.
; http://php.net/sybct.max-links
sybct.max_links = -1

; Minimum server message severity to display.
; http://php.net/sybct.min-server-severity
sybct.min_server_severity = 10

; Minimum client message severity to display.
; http://php.net/sybct.min-client-severity
sybct.min_client_severity = 10

; Set per-context timeout
; http://php.net/sybct.timeout
;sybct.timeout=

;sybct.packet_size

; The maximum time in seconds to wait for a connection attempt to succeed before returning failure.
; Default: one minute
;sybct.login_timeout=

; The name of the host you claim to be connecting from, for display by sp_who.
; Default: none
;sybct.hostname=

; Allows you to define how often deadlocks are to be retried. -1 means "forever".
; Default: 0
;sybct.deadlock_retry_count=

[bcmath]
; Number of decimal digits for all bcmath functions.
; http://php.net/bcmath.scale
bcmath.scale = 0

EDIT

I am using a mac and checking my settings above. I do also have the php_mysql.dll files installed as well

extension=php_mysql.dll
extension=php_mysqli.dll

This is my phpinfo() page

there is 3 occurrences of the word mysql on my page.

edit

ok i have a screenshot that shows where the extension dir is but when i go there, I don't see any extensions. could macports installation be corrupted ??

解决方案

mysql_query() is not part of PDO so the DLLs you're checking (which are PDO's dll for MySQL support) are not the one you should check. You want to check php_mysql.dll (.so on linux servers).

But PDO is definitely the right way to access MySQL. It is way much better than using mysql_query().

Read more over here, on PHP's PDO page.

这篇关于调用未定义的函数 mysql_query()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆