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

Where is mysql_connect()?

P: n/a
I'm running PHP5 on Windows Vista with mysql 5.2. I have a simple php
file with

<?
$dbc = mysql_connect ();
?>

When I run the file, I get this error:
Fatal error: Call to undefined function mysql_connect() in E:\www
\mysite\connecttest.php on line 2

PHP seems to be installed correctly. What could I be doing wrong?

Mar 4 '07 #1
Share this Question
Share on Google+
14 Replies


P: n/a
Am 4 Mar 2007 11:21:30 -0800 schrieb brett:
PHP seems to be installed correctly. What could I be doing wrong?
Is it *configured* correctly? Especially: Did you load the mysql extension?
Mar 4 '07 #2

P: n/a
On Mar 4, 11:23 am, Simon Stienen <n...@news.slashlife.orgwrote:
Am 4 Mar 2007 11:21:30 -0800 schrieb brett:
PHP seems to be installed correctly. What could I be doing wrong?

Is it *configured* correctly? Especially: Did you load the mysql extension?
I only installed mysql and created a database. There are a few
problems. I'd like to move the database but don't know how and am not
sure how to tell mysql where it is to allow connections.

There isn't a mysql odbc in the odbc administrator tools.

I just downloaded the extension listed here: http://dev.mysql.com/downloads/connector/php/.
They talk about modifying a php.ini file. However, I don't have that
file. The closest files I have are:

- php.ini-dist
- php.ini-recommended

Does all of that sound correct? Thanks.

Mar 4 '07 #3

P: n/a
Am 4 Mar 2007 12:45:12 -0800 schrieb brett:
The closest files I have are:

- php.ini-dist
- php.ini-recommended

Does all of that sound correct? Thanks.
Those two are actually php.ini templates.

HTH,

simon Stienen

(I just noticed that I've got to configure my quote lines to be English
again... I hate reinstalling software.)
Mar 4 '07 #4

P: n/a
brett wrote:
I'm running PHP5 on Windows Vista with mysql 5.2. I have a simple php
file with

<?
$dbc = mysql_connect ();
?>

When I run the file, I get this error:
Fatal error: Call to undefined function mysql_connect() in E:\www
\mysite\connecttest.php on line 2

PHP seems to be installed correctly. What could I be doing wrong?
What does phpinfo() bring up? If you can't see MySQL in there then it needs
to be installed/configured.
Mar 4 '07 #5

P: n/a
brett wrote:
I'm running PHP5 on Windows Vista with mysql 5.2. I have a simple php
file with
RTFM. Mysql support was dropped by default in the upgrade from PHP4 to PHP5.
Get the php_mysql.dll library, put it in the appropiate place, and check
that it is loaded (see php.ini).

--
----------------------------------
Iván Sánchez Ortega -ivansanchez-algarroba-escomposlinux-punto-org-

Todo conocimiento comienza por los sentimientos.- Leonardo da Vinci.
Mar 4 '07 #6

P: n/a
On Mar 4, 12:43 pm, PDannyD <dan1...@scenicplace.freeserve.co.uk>
wrote:
brett wrote:
I'm running PHP5 on Windows Vista with mysql 5.2. I have a simple php
file with
<?
$dbc = mysql_connect ();
?>
When I run the file, I get this error:
Fatal error: Call to undefined function mysql_connect() in E:\www
\mysite\connecttest.php on line 2
PHP seems to be installed correctly. What could I be doing wrong?

What does phpinfo() bring up? If you can't see MySQL in there then it needs
to be installed/configured.
I've installed the extensions and configured php.ini. I renamed php-
recommended to php.ini since one didn't exist. I set the
externsion_dir to my "ext" path but phpinfo() keeps showing it as c:
\PHP5, which doesn't exist. Any idea why that is happening?

Thanks.

Mar 4 '07 #7

P: n/a
brett wrote:
I'm running PHP5 on Windows Vista with mysql 5.2. I have a simple php
file with

<?
$dbc = mysql_connect ();
?>

When I run the file, I get this error:
Fatal error: Call to undefined function mysql_connect() in E:\www
\mysite\connecttest.php on line 2

PHP seems to be installed correctly. What could I be doing wrong?
Brett,

Your MySQL extension is not configured correctly.
Form what I gather from the replies on this thread, you managed to
download the extension and modify php.ini file (to load and mysql
extension). So I assume those steps are complete.

If you are running IIS, PHP is configured to search for php.ini in (as I
recall, CMIIW) your windows directory and your php installation dir.
Again, from what I gather your current installation uses php.ini from
c:\PHP5 dir. You should modify that file instead. Restart your IIS

If you are running apache however, you need to add
PHPIniDir "C:\php5"
to your apache config file (where c:\php5 is where you put your php.ini)
Restart Apache.

If you don't see any result (ie. mysql still not loaded), then your php
is still not configured correctly.

Hope that helps,

Hendri Kurniawan
Mar 4 '07 #8

P: n/a
On 2007-03-04 23-50-08, Hendri Kurniawan wrote:
If you are running apache however, you need to add
PHPIniDir "C:\php5"
to your apache config file (where c:\php5 is where you put your php.ini)
Restart Apache.
You don't _need_ to add this line. It's still possuble to put the ini file
into one of the classic locations:
a) c:\windows
b) apaches base directory (the one /bin, /conf, /log, ... are located in)
c) the directory the sapi dll is located in (iirc, not absolutely positive
on this one)

Regards,

Simon Stienen
Mar 4 '07 #9

P: n/a
On Mar 4, 3:28 pm, Simon Stienen <n...@news.slashlife.orgwrote:
On 2007-03-04 23-50-08, Hendri Kurniawan wrote:
If you are running apache however, you need to add
PHPIniDir "C:\php5"
to your apache config file (where c:\php5 is where you put your php.ini)
Restart Apache.

You don't _need_ to add this line. It's still possuble to put the ini file
into one of the classic locations:
a) c:\windows
b) apaches base directory (the one /bin, /conf, /log, ... are located in)
c) the directory the sapi dll is located in (iirc, not absolutely positive
on this one)

Regards,

Simon Stienen
As mentioned earlier, I don't have a "c:\php5" folder on this machine
and I'm running Windows Vista. Placing the php.ini folder in the
windows folder doesn't help. After restarting IIS, I get a blank
white page. So I put the file back in my php folder, restart IIS and
it works again but PHP is still pointing to the wrong extension_dir
and the mysqlconnect() isn't recognized.

Thanks.

Mar 5 '07 #10

P: n/a
brett wrote:
On Mar 4, 12:43 pm, PDannyD <dan1...@scenicplace.freeserve.co.uk>
wrote:
>brett wrote:
>>I'm running PHP5 on Windows Vista with mysql 5.2. I have a simple php
file with
<?
$dbc = mysql_connect ();
?>
When I run the file, I get this error:
Fatal error: Call to undefined function mysql_connect() in E:\www
\mysite\connecttest.php on line 2
PHP seems to be installed correctly. What could I be doing wrong?
What does phpinfo() bring up? If you can't see MySQL in there then it needs
to be installed/configured.

I've installed the extensions and configured php.ini. I renamed php-
recommended to php.ini since one didn't exist. I set the
externsion_dir to my "ext" path but phpinfo() keeps showing it as c:
\PHP5, which doesn't exist. Any idea why that is happening?

Thanks.
Are you using the correct php.ini? phpinfo() will tell you.

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

P: n/a
On Mar 4, 5:56 pm, "brett" <acco...@cygen.comwrote:
As mentioned earlier, I don't have a "c:\php5" folder on this machine
and I'm running Windows Vista. Placing the php.ini folder in the
windows folder doesn't help. After restarting IIS, I get a blank
white page. So I put the file back in my php folder, restart IIS and
it works again but PHP is still pointing to the wrong extension_dir
and the mysqlconnect() isn't recognized.

Thanks.
In your php.ini, do you have:

extension_dir = "./ext"

?

Mar 5 '07 #12

P: n/a
In your php.ini, do you have:
>
extension_dir = "./ext"

?
No, but I can change it. I do see the phpinfo() is saying the
configuration file is in c:\windows. Not sure why. So I moved it
from my php folder into the windows folder. Now I get a blank white
page when I browse to the php file. View source shows my php code. At
the least, phpinfo() should still execute. Any idea what is wrong?

Thanks,
brett

Mar 5 '07 #13

P: n/a
brett wrote:
>In your php.ini, do you have:

extension_dir = "./ext"

?

No, but I can change it. I do see the phpinfo() is saying the
configuration file is in c:\windows. Not sure why. So I moved it
from my php folder into the windows folder. Now I get a blank white
page when I browse to the php file. View source shows my php code. At
the least, phpinfo() should still execute. Any idea what is wrong?

Thanks,
brett

Well, that means the correct php.ini location should be in c:\windows
folder.

There is something wrong with the php.ini file that caused php to crash,
which in turn did not process the script properly.

What I suspect (best guessing here), that one of the php extension is
in conflict with php. I suggest that you comment all the extension
loading line php have in the php.ini.

Check if PHP (phpinfo()) works again. If it does, then you have found
your bug. To further isolate which extension actually crash PHP,
un-comment the extension one-by-one and try phpinfo() each time.

If it still does not work, I can't help you any further, coz I have
**very** limited knowledge on ISS + PHP.

Hendri
Mar 6 '07 #14

P: n/a
On Mar 5, 3:48 pm, Hendri Kurniawan <ask...@email.comwrote:
brett wrote:
In your php.ini, do you have:
extension_dir = "./ext"
?
No, but I can change it. I do see the phpinfo() is saying the
configuration file is in c:\windows. Not sure why. So I moved it
from my php folder into the windows folder. Now I get a blank white
page when I browse to the php file. View source shows my php code. At
the least, phpinfo() should still execute. Any idea what is wrong?
Thanks,
brett

Well, that means the correct php.ini location should be in c:\windows
folder.

There is something wrong with the php.ini file that caused php to crash,
which in turn did not process the script properly.

What I suspect (best guessing here), that one of the php extension is
in conflict with php. I suggest that you comment all the extension
loading line php have in the php.ini.

Check if PHP (phpinfo()) works again. If it does, then you have found
your bug. To further isolate which extension actually crash PHP,
un-comment the extension one-by-one and try phpinfo() each time.

If it still does not work, I can't help you any further, coz I have
**very** limited knowledge on ISS + PHP.

Hendri- Hide quoted text -

- Show quoted text -
I've commented out all of the extensions, restarted IIS and still a
blank white page. Thanks.

Mar 6 '07 #15

This discussion thread is closed

Replies have been disabled for this discussion.