By pants on
I am trying to install Drupal 4.6 on Windows 2000 server using IIS with MySQL and PHP5.0.4 and having this issue:
Fatal error: Call to undefined function mysql_connect() in D:\Web\GAP2\drupal-4.6.0\includes\database.mysql.inc on line 31
I've read the posts and tried many different things but nothing has worked so far.
Any help on this will be greatly appreciated.
thanks,
Pants
Comments
The error is pretty
The error is pretty straight-forward... basically it can't find the MySQL functions because they aren't installed properly. Try Googling "php mysql iis" or try this thread: http://www.webmasterworld.com/forum88/8035.htm
thanks
Thanks for the info Foofy. I'll go try it now and if its resolved, I'll let you know.
cheers
basics
telnet to localhost 3306 to see if you get a response. Make sure that the version of php you installed is compiled with MySQL support (google phpinfo).
These http://drupal.org/node/9407 are for Drupal 4.4 but the basics are the same. I will try and get them updated to 4.6 in the next week or two, but don't hold your breath (work deadlines and my son's two year old birthday are looming near and take precedence).
-sp
---------
Test site...always start with a test site.
Drupal Best Practices Guide
-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide
Common error
You don't get the option of compiling with mysql support in Win2k. You need to edit your php.ini file and uncomment (remove the ";" from) the line:
extension=php_mysql.dll
then move, or copy php_mysql.dll from your php/ext/ directory to your php/ directory (one level up)
If you haven't already, right click My Computer, then click Properties>Advanced>Environment Variables, under "System Variables" click Path, then Edit (or just double-click Path) and add this to the end of that:
;C:\mysql\bin;C:\php
If you have PHP installed under something like "Program Files", you need to move it to a directory with no spaces in the name - as pointed out in php/install.txt - be sure to change the path statement above to reflect the true location on your machine (for mysql as well).
If you had to change the Path variable, you'll need to reboot. If not, just restart IIS. This problem should have gone away.
Reason for error is required tweaking and missing DLL files
The reason it happens is because PHP5 does not provide built-in support for MySql (like PHP4 and below did). As a result there are a few DLL files missing from the original installer.
Here's a webpage with a fix for the problem.
http://www.siteinaweek.com/installphp5/howto.php
The page offers tweaking tips and and missing DLL files as free downloads.
I have copied and pasted from the page below.
But the clickable links don't work, so better visit the above URL directly.
--------------------------------------------------------------------
Why the error happens:
PHP4 (and below) has MySQL support included by default; the functions are embedded into the core of PHP. But PHP5 has removed embedded support for MySQL and requires MySQL to be loaded as an add-in module, in the same way you have to support anything else. More info can be found the PHP5 Migration FAQ and the Database Issues FAQ.
--------------------------------------------------------------------------------
If you are using Windows XP with IIS
After downloading and installing the PHP 5.0.4 installer ...
1. Open the php.ini file and make the following changes to its contents (php.ini is a text file and resides in C:\WINNT)
Change this : ;extension=php_mysql.dll
to : extension=php_mysql.dll
(the semicolon at the start is removed)
Then give the correct path to the extensions directory
extension_dir = "C:\Program_Files\php\morephp"
(in my case I created a directory called 'morephp' to store all the extensions. If your directory is called 'extensions' the line would be
extension_dir = "C:\Program_Files\php\extensions")
--------------------------------------------------------------------------------
2) Then copy the following files in to the morephp directory (as I have mentioned above, morephp is a name I gave to a directory into which I dump all the extensions):
php_mysql.dll
php_mysqli.dll
The 2 files are available for download here
And... you should live happily ever after!
Remember to restart IIS before viewing pages.
--------------------------------------------------------------------------------
3) Should you still face problems try this. Copy the following files
libmysql.dll
libmysqli.dll
in to
c:\windows\system32
The 2 files are available for download here
--------------------------------------------------------------------------------
4) Still does not work? Try this slightly radical step.
Here is a dump of all the dll files you would possibly need for PHP5 installation. Simply copy all the files from this directory in to your morephp directory.
--------------------------------------------------------------------------------
If your php files simply do not show up on IIS, then check out this tutorial for installing php in IIS, and see what tweaking you need to do. The tutorial is about PHP4, but the fundamentals are the same.
--------------------------------------------------------------------------------
If you are using Windows XP with Apache
If you are using Apache instead of IIS, copy the following files
php5apache2.dll
php5ts.dll
php_mysql.dll
libmysql.dll
libmysqli.dll
in to
c:\windows\system32
The 5 files are available for download here
Restart Apache before you view the pages.
Here is another tutorial for installing Php5 in XP and Apache.
--------------------------------------------------------------------
PHP installation for dummies
An all time classic tutorial by Gerardo
http://www.siteinaweek.com/installphp5/how_to_install_php_on_iis.php