For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > January 2006 > Fatal error: Call to undefined function mysql_connect()









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Fatal error: Call to undefined function mysql_connect()
mclai@mail.com

2005-12-01, 7:01 pm

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 w 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

J2be

2005-12-01, 7:01 pm


<mclai@mail.com> wrote in message
news:1133412962.339061.273720@o13g2000cwo.googlegroups.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)


Connector5

2005-12-01, 7:01 pm

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.googlegroups.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 w 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
>



mclai@mail.com

2005-12-02, 8:53 pm

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.

mclai@mail.com

2005-12-02, 8:53 pm

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

Jim Michaels

2006-01-16, 3:55 am

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.googlegroups.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 w 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
>



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com