By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,640 Members | 2,597 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,640 IT Pros & Developers. It's quick & easy.

PHP not supporting MySQL

P: n/a
My PHP version is obviously not compiled with MySQL support,
consequently I get the following message:-

Fatal error: Call to undefined function mysql_connect() in
C:\http-dir\board\connect.php on line 3

Question:- How do I instruct PHP to support MySQL?

Please note:-

extension=php_mysql.dll
extension=php_pdo_mysql.dll

in php.ini are enabled, and php.ini is located in the php root directory.

Thank you.
Feb 7 '07 #1
Share this Question
Share on Google+
7 Replies


P: n/a
be sure libmysql.dll is available to the systems PATH.

from php.net:

Go to Control Panel and open the System icon (Start -Settings ->
Control Panel -System, or just Start -Control Panel -System for
Windows XP/2003)

Go to the Advanced tab

Click on the 'Environment Variables' button

Look into the 'System Variables' pane

Find the Path entry (you may need to scroll to find it)

Double click on the Path entry

Enter your PHP directory at the end, including ';' before (e.g. ;C:\php)

Press OK and restart your computer


hope this helps

Siegfreed schreef:
My PHP version is obviously not compiled with MySQL support,
consequently I get the following message:-

Fatal error: Call to undefined function mysql_connect() in
C:\http-dir\board\connect.php on line 3

Question:- How do I instruct PHP to support MySQL?

Please note:-

extension=php_mysql.dll
extension=php_pdo_mysql.dll

in php.ini are enabled, and php.ini is located in the php root directory.

Thank you.
Feb 7 '07 #2

P: n/a
Siegfreed wrote:
My PHP version is obviously not compiled with MySQL support,
consequently I get the following message:-

Fatal error: Call to undefined function mysql_connect() in
C:\http-dir\board\connect.php on line 3

Question:- How do I instruct PHP to support MySQL?

Please note:-

extension=php_mysql.dll
extension=php_pdo_mysql.dll

in php.ini are enabled, and php.ini is located in the php root directory.

Thank you.
First of all, there's no need to change the registry if you have your
php.ini file in the right place.

Secondly, there are three extensions you could be interested in.

extension=php_mysql.dll // (older) mysql_xxx interface
extension=php_mysqli.dll // (newer) mysqli_xxx objects
extension=php_pdo_mysql.dll // (newest) PDO interface for MySQL
extension=php_pdo.dll // also required for PDO

(note: the last, PHP Data Objects, is an abstraction layer for data
access. It's relatively new, so you probably won't see much existing
code using it.

Most sites use the mysql_xxx interface, while there are some going to
the mysqli_interface.

And the interfaces are quite compatible - you can load all three and
pick whichever one you want to use in your code.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Feb 7 '07 #3

P: n/a

"Siegfreed" <si**@freed.orgwrote in message
news:45***********************@news.optusnet.com.a u...
My PHP version is obviously not compiled with MySQL support, consequently
I get the following message:-

Fatal error: Call to undefined function mysql_connect() in
C:\http-dir\board\connect.php on line 3

Question:- How do I instruct PHP to support MySQL?

Please note:-

extension=php_mysql.dll
extension=php_pdo_mysql.dll

in php.ini are enabled, and php.ini is located in the php root directory.

Thank you.
Along with the previous advice to add PHP dir to your system path, from the
top of my head

1) Run phpinfo() and see if the report displays the correct path to your
php.ini
2) Uncomment extension_dir in php.ini and set it to the appropriate folder

Something along the lines of
extension_dir = "C:\PHP\ext\"
p.s I do hope you installed PHP from the binary zip, not the installer, as
the second one doesn't include mysql support to my knowledge
Denis Gerina
Feb 7 '07 #4

P: n/a
I copied "libmysql.dll", and "php.ini" to the system PATH, and the
"fatal error" message disappeared. I will modify the system PATH (as
you suggested) if for some reason I need the "php.ini" in the in the
"php" directory.

Thank you.

Vincent wrote:
be sure libmysql.dll is available to the systems PATH.

from php.net:

Go to Control Panel and open the System icon (Start -Settings ->
Control Panel -System, or just Start -Control Panel -System for
Windows XP/2003)

Go to the Advanced tab

Click on the 'Environment Variables' button

Look into the 'System Variables' pane

Find the Path entry (you may need to scroll to find it)

Double click on the Path entry

Enter your PHP directory at the end, including ';' before (e.g. ;C:\php)

Press OK and restart your computer

hope this helps

Siegfreed schreef:
>My PHP version is obviously not compiled with MySQL support,
consequently I get the following message:-

Fatal error: Call to undefined function mysql_connect() in
C:\http-dir\board\connect.php on line 3

Question:- How do I instruct PHP to support MySQL?

Please note:-

extension=php_mysql.dll
extension=php_pdo_mysql.dll

in php.ini are enabled, and php.ini is located in the php root directory.

Thank you.
Feb 9 '07 #5

P: n/a
Jerry Stuckle wrote:
Siegfreed wrote:
>My PHP version is obviously not compiled with MySQL support,
consequently I get the following message:-

Fatal error: Call to undefined function mysql_connect() in
C:\http-dir\board\connect.php on line 3

Question:- How do I instruct PHP to support MySQL?

Please note:-

extension=php_mysql.dll
extension=php_pdo_mysql.dll

in php.ini are enabled, and php.ini is located in the php root directory.

Thank you.


First of all, there's no need to change the registry if you have your
php.ini file in the right place.

Secondly, there are three extensions you could be interested in.

extension=php_mysql.dll // (older) mysql_xxx interface
extension=php_mysqli.dll // (newer) mysqli_xxx objects
extension=php_pdo_mysql.dll // (newest) PDO interface for MySQL
extension=php_pdo.dll // also required for PDO

(note: the last, PHP Data Objects, is an abstraction layer for data
access. It's relatively new, so you probably won't see much existing
code using it.

Most sites use the mysql_xxx interface, while there are some going to
the mysqli_interface.

And the interfaces are quite compatible - you can load all three and
pick whichever one you want to use in your code.
I think you are right in saying: "there's no need to change the registry
if you have your php.ini file in the right place". By moving the
"php.ini" to "c:\windows", the "fatal error" message was eliminated.

In addition, I copied "libmysql.dll" to "c:\windows", it appears to work
fine so far.

Thank you.
Feb 9 '07 #6

P: n/a
I think you are right in saying: "there's no need to change the registry
if you have your php.ini file in the right place". By moving the
"php.ini" to "c:\windows", the "fatal error" message was eliminated.

In addition, I copied "libmysql.dll" to "c:\windows", it appears to work
fine so far.
I knew some would get around to saying they copied files into C:
\WINDOWS.

There is no reason to place ANYTHING in C:\windows.

No reason to modify the registry (I don't consider ENV VARS registry,
yes I know, that's where it lives, but...)

go to

http://web.torres.ws/walters_way

I have complete docs that explain how to set up Apache and PHP without
doing on of this "windows-centric" stuff.

In fact, I had to replace my OS drive last week. Took my 2 hours to
reinstall XP Pro and the drivers and the like.

It took my 10 minutes to "reinstall" Apache, mySQL, Perl, PHP and
SSH2, along with 90% of linux command line tools.

See if that method helps you.

Walter

Feb 9 '07 #7

P: n/a
ot*******@gmail.com wrote:
>I think you are right in saying: "there's no need to change the registry
if you have your php.ini file in the right place". By moving the
"php.ini" to "c:\windows", the "fatal error" message was eliminated.

In addition, I copied "libmysql.dll" to "c:\windows", it appears to work
fine so far.

I knew some would get around to saying they copied files into C:
\WINDOWS.

There is no reason to place ANYTHING in C:\windows.
That's one opinion. I happen to keep certain configuration files there.
No reason to modify the registry (I don't consider ENV VARS registry,
yes I know, that's where it lives, but...)
Changing the environment *is* changing the registry. And environment
changes are applied to every program loaded, not just the one process
reading the configuration file. My environment is already 3K long -
without adding unnecessary things to it.
go to

http://web.torres.ws/walters_way

I have complete docs that explain how to set up Apache and PHP without
doing on of this "windows-centric" stuff.
There is nothing wrong with making use of the tools at hand.
In fact, I had to replace my OS drive last week. Took my 2 hours to
reinstall XP Pro and the drivers and the like.
Good for you. I lost my hard drive. It took me 4 days to reinstall
Windows 2K, apply all of the patches and restore from backup. Next step
is a better backup program.
It took my 10 minutes to "reinstall" Apache, mySQL, Perl, PHP and
SSH2, along with 90% of linux command line tools.
Didn't even take me that long. Once the OS was restored, it was a
simple matter to restore the rest of the system (about 40GB).
See if that method helps you.

Walter


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Feb 9 '07 #8

This discussion thread is closed

Replies have been disabled for this discussion.