Suscriber with us



Receive HTML?

Syndicate

MySQL functions PDF Print E-mail

PHP MySQL Introduction

The MySQL functions allows you to access MySQL database servers.

Installation

For the MySQL functions to be available, you must compile PHP with MySQL support.

For compiling, use --with-mysql=DIR (the optional DIR points to the MySQL directory).

Note: For full functionality of MySQL versions greater than 4.1., use the MySQLi extension instead.
If you would like to install both the mysql extension and the mysqli extension you should use the
same client library to avoid any conflicts.

Installation on Linux Systems

PHP 5+: MySQL and the MySQL library is not enabled by default. Use the --with-mysql=DIR
configure option to include MySQL support and download headers and libraries from www.mysql.com.

Installation on Windows Systems

PHP 5+: MySQL is not enabled by default, so the php_mysql.dll must be enabled inside of php.ini.
Also, PHP needs access to the MySQL client library. A file named libmysql.dll is included in the
Windows PHP distribution, and in order for PHP to talk to MySQL this file needs to be available
to the Windows systems PATH.

To enable any PHP extension, the PHP extension_dir setting (in the php.ini file)
should be set to the directory where the PHP extensions are located. An example extension_dir value is c:\php\ext.

Note: If you get the following error when starting the web server: "Unable to load dynamic library
'./php_mysql.dll'", this is because php_mysql.dll or libmysql.dll cannot be found by the system.

Runtime Configuration

The behavior of the MySQL functions is affected by settings in the php.ini file.

MySQL configuration options:

MySQL configuration options:

Name

Default

Description

Changeable

mysql.allow_persistent

"1"

Whether or not to allow persistent connections
 

PHP_INI_SYSTEM

mysql.max_persistent

"-1"

The maximum number of persistent connections per process
 

PHP_INI_SYSTEM

mysql.max_links

"-1"

The maximum number of connections per process (persistent connections included)
 

PHP_INI_SYSTEM

mysql.trace_mode

"0"

Trace mode. When set to "1", warnings and SQL-errors will be displayed. Available since PHP 4.3
 

PHP_INI_ALL

mysql.default_port

NULL

The default TCP port number to use
 

PHP_INI_ALL

mysql.default_socket

NULL

The default socket name to use. Available since PHP 4.0.1
 

PHP_INI_ALL

mysql.default_host

NULL

The default server host to use (doesn't apply in SQL safe mode)
 

PHP_INI_ALL

mysql.default_user

NULL

The default user name to use (doesn't apply in SQL safe mode)
 

PHP_INI_ALL

mysql.default_password

NULL

The default password to use (doesn't apply in SQL safe mode)
 

PHP_INI_ALL

mysql.connect_timeout

"60"

Connection timeout in seconds
 

PHP_INI_ALL




Last Updated ( Thursday, 03 April 2008 )
 
< Prev   Next >

Polls

Which is the best Scripting language?