Fatal error: Call to undefined function mysql_connect()

This is a discussion on Fatal error: Call to undefined function mysql_connect() within the alt.comp.lang.php forums, part of the PHP Programming Forums category; I am new to PHP and I have trouble to make a db connection when the php script runs on ...


Go Back   Usenet Forums > PHP Programming Forums > alt.comp.lang.php

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 12-01-2005
mclai@mail.com
 
Posts: n/a
Default Fatal error: Call to undefined function mysql_connect()

I am new to PHP and I have trouble to make a db connection when the php
script runs on a browser. It is fine when it runs at a shell/command
prompt.

I have tried a number of settings suggested by several users posted on
the Web about how they resolved this problem but none works for me.

It seems that MySQL is not supported when I run the script over a Web
browser but it works well when it is at command prompt, because I
cannot see "MySQL Support enabled" when phpinfo() reports over a
browser. It is clear to see that "MySQL Support => enabled" when the
script for phpinfo() is running at a command prompt.

My system is Windows 2003 with IIS 6.
PHP 5.1 and MySQL 5.0.13

Inside the php.ini, the followings are set as instruction:
extension_dir = "c:\php\ext"
extension=php_mysql.dll

The system environment PATH variable has included the PHP
install-directory "c:\php".

ISAPI is set for IIS 6 pointing to php5isapi.dll and the Web Service
Extension at IIS 6 for accessing php5isapi.dll is created with "Allow"
status. I have also checked that .cgi extension is included in the
Mappings tab of each Application Configuration.

I can run the php script over the browser to create directory, open and
delete files but I cannot do anything with the database access. But
the db actions are working fine when I do it at the command prompt.

I have been working on this for almost a week and tried everything I
can but I am still unable to make a connection to the database over
HTTP. I wish that someone here who can give me some pointers or
insight. I will deeply appreciate. Thanks.

Punkin

Reply With Quote
  #2 (permalink)  
Old 12-01-2005
J2be
 
Posts: n/a
Default Re: Fatal error: Call to undefined function mysql_connect()


<mclai@mail.com> wrote in message
news:1133412962.339061.273720@o13g2000cwo.googlegr oups.com...
>I am new to PHP and I have trouble to make a db connection when the php
> script runs on a browser. It is fine when it runs at a shell/command
> prompt.
>
>...
> My system is Windows 2003 with IIS 6.
> PHP 5.1 and MySQL 5.0.13
>
> Inside the php.ini, the followings are set as instruction:
> extension_dir = "c:\php\ext"
> extension=php_mysql.dll
>
> The system environment PATH variable has included the PHP
> install-directory "c:\php".
>
>...
>


Probably during the installation you've not installed all the necessary
files.
For mysql you've to copy libmysql.dll to c:\windows
open snapshot.txt to read the dependency informations for each module that
you want to use.

I hope that this can solve your problem.


Cheers

--
----
Leonardo Armando Iarrusso
J2be - It Services for your Business
P. IVA: 01319360622
Via S. Spirito, 19
82100 Benevento (BN) - Italy
Tel/Fax: +39 0824 22887
Mobile: +39 349 1482304
e-mail: info[at]J2Be.com
www: http://www.J2Be.com
Skype: j2be_it (info[at]J2Be.com)


Reply With Quote
  #3 (permalink)  
Old 12-01-2005
Connector5
 
Posts: n/a
Default Re: Fatal error: Call to undefined function mysql_connect()

Search your computer and make sure you dont have two copies of php.ini
present.



<mclai@mail.com> wrote in message
news:1133412962.339061.273720@o13g2000cwo.googlegr oups.com...
> I am new to PHP and I have trouble to make a db connection when the php
> script runs on a browser. It is fine when it runs at a shell/command
> prompt.
>
> I have tried a number of settings suggested by several users posted on
> the Web about how they resolved this problem but none works for me.
>
> It seems that MySQL is not supported when I run the script over a Web
> browser but it works well when it is at command prompt, because I
> cannot see "MySQL Support enabled" when phpinfo() reports over a
> browser. It is clear to see that "MySQL Support => enabled" when the
> script for phpinfo() is running at a command prompt.
>
> My system is Windows 2003 with IIS 6.
> PHP 5.1 and MySQL 5.0.13
>
> Inside the php.ini, the followings are set as instruction:
> extension_dir = "c:\php\ext"
> extension=php_mysql.dll
>
> The system environment PATH variable has included the PHP
> install-directory "c:\php".
>
> ISAPI is set for IIS 6 pointing to php5isapi.dll and the Web Service
> Extension at IIS 6 for accessing php5isapi.dll is created with "Allow"
> status. I have also checked that .cgi extension is included in the
> Mappings tab of each Application Configuration.
>
> I can run the php script over the browser to create directory, open and
> delete files but I cannot do anything with the database access. But
> the db actions are working fine when I do it at the command prompt.
>
> I have been working on this for almost a week and tried everything I
> can but I am still unable to make a connection to the database over
> HTTP. I wish that someone here who can give me some pointers or
> insight. I will deeply appreciate. Thanks.
>
> Punkin
>



Reply With Quote
  #4 (permalink)  
Old 12-02-2005
mclai@mail.com
 
Posts: n/a
Default Re: Fatal error: Call to undefined function mysql_connect()

Thanks for the advice. I tried it but it still doesn't work for me.
Indeed, copying libmysql.dll into the WINDOWS directory is no longer
necessary for PHP 5+ as long as the PATH environment variable includes
php install-directory since libmysql.dll is inside that directory:
(look at the PHP 5+ section) http://us2.php.net/mysql. This probably
is good for an easy upgrade in the future. Of course, if everything
works, I don't mind to make another copy to WINDOWS directory.
Unfortunately, I tried again but it is still not working :(

I am not sure if it is the problem on w2k3/IIS 6.0 or the compatible
issues between php 5.1 and mysql 5.x. It seems that a lot of people
having the similar problem when they set up php with mysql on w2k3.

I may try some other options to see if I can find a solution.

Thanks for the reply.

Reply With Quote
  #5 (permalink)  
Old 12-02-2005
mclai@mail.com
 
Posts: n/a
Default Re: Fatal error: Call to undefined function mysql_connect()

There is only one copy of php in the system;so is the php.ini file.

Reply With Quote
  #6 (permalink)  
Old 01-16-2006
Jim Michaels
 
Posts: n/a
Default Re: Fatal error: Call to undefined function mysql_connect()

the call to mysql_connect should look like
$link=mysql_connect("server", "username", "password");

but I don't think that matters now. it sounds to me like PHP itself can't
find this function in the extension. So maybe the extension is not working
like it should. this is bizarre.

do you have two different versions of PHP around, or did you upgrade? I am
curious if an old DLL file is sticking around. sometimes installers won't
replace a file if it already exists - it depends on how they configured it.

<mclai@mail.com> wrote in message
news:1133412962.339061.273720@o13g2000cwo.googlegr oups.com...
>I am new to PHP and I have trouble to make a db connection when the php
> script runs on a browser. It is fine when it runs at a shell/command
> prompt.
>
> I have tried a number of settings suggested by several users posted on
> the Web about how they resolved this problem but none works for me.
>
> It seems that MySQL is not supported when I run the script over a Web
> browser but it works well when it is at command prompt, because I
> cannot see "MySQL Support enabled" when phpinfo() reports over a
> browser. It is clear to see that "MySQL Support => enabled" when the
> script for phpinfo() is running at a command prompt.
>
> My system is Windows 2003 with IIS 6.
> PHP 5.1 and MySQL 5.0.13
>
> Inside the php.ini, the followings are set as instruction:
> extension_dir = "c:\php\ext"
> extension=php_mysql.dll
>
> The system environment PATH variable has included the PHP
> install-directory "c:\php".
>
> ISAPI is set for IIS 6 pointing to php5isapi.dll and the Web Service
> Extension at IIS 6 for accessing php5isapi.dll is created with "Allow"
> status. I have also checked that .cgi extension is included in the
> Mappings tab of each Application Configuration.
>
> I can run the php script over the browser to create directory, open and
> delete files but I cannot do anything with the database access. But
> the db actions are working fine when I do it at the command prompt.
>
> I have been working on this for almost a week and tried everything I
> can but I am still unable to make a connection to the database over
> HTTP. I wish that someone here who can give me some pointers or
> insight. I will deeply appreciate. Thanks.
>
> Punkin
>



Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 11:28 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0