Jump to content

Recommended Posts

Hi,

      I have php version 5.2.5; MySQL version 5.0.51a-community-nt.

I installed php with MySQL support. I placed test function mysql_connect()  to connect to MySQL db and received an error. 

"Fatal error: Call to undefined function mysql_connect() in H:\website\install\test\MySQLTest.php on line 5

"

    I read instructions in php.net that I must compile php with flag --with-mysql. Compilation gave me a lot of errors.

Is there some walkaround to enable php to connect to MySQL database?

 

Any help greatly appreciated.

Thanks.

agzis.

Link to comment
https://forums.phpfreaks.com/topic/90813-php-and-mysql/
Share on other sites

The Windows php binary is already complied with support for all the official language extensions.

 

This is from the php manual for the mysql functions -

 

Installation on Windows Systems

 

PHP 5+

MySQL is no longer enabled by default, so the php_mysql.dll 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. See the FAQ titled "How do I add my PHP directory to the PATH on Windows" for information on how to do this. Although copying libmysql.dll to the Windows system directory also works (because the system directory is by default in the system's PATH), it's not recommended.

 

As with enabling any PHP extension (such as php_mysql.dll), the PHP directive extension_dir should be set to the directory where the PHP extensions are located. See also the Manual Windows Installation Instructions. An example extension_dir value for PHP 5 is c:\php\ext

Link to comment
https://forums.phpfreaks.com/topic/90813-php-and-mysql/#findComment-465537
Share on other sites

Check your web server log for errors to help pinpoint what is wrong.

 

Either the .dll is missing, the path to the extension dll's is wrong in php.ini, the path to your php installation is not in the Windows path statement, you did not reboot your computer after making any changes to the Windows path statement, the php.ini that you are using is not the same one that php is using, the line in php.ini to load the php_mysql.dll is commented out, you did not stop and start the web server after making changes to php.ini, and probably a few more things that are mentioned in the installation instructions that I don't recall off of the top of my head.

Link to comment
https://forums.phpfreaks.com/topic/90813-php-and-mysql/#findComment-465592
Share on other sites

I read instructions in php.net that I must compile php with flag --with-mysql. Compilation gave me a lot of errors.

Is there some walkaround to enable php to connect to MySQL database?

 

Why did you recompile PHP? PHP does not need recompiling on Windows.

 

Also please read the following FAQ

Link to comment
https://forums.phpfreaks.com/topic/90813-php-and-mysql/#findComment-466074
Share on other sites

BTW, all php extensions do not work (php_iisfunc, php_mssql, php_mysql) but they were installed correctly. They(dlls) located at ext folder of php installation. There are entries at the end of php.ini file like

[php_MS_SQL]

extension=php_mssql.dll

[php_MYSQL]

extension=php_mysql.dll

and so on. But all these entries added during gui install.

Link to comment
https://forums.phpfreaks.com/topic/90813-php-and-mysql/#findComment-466223
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.