473,387 Members | 1,650 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Where is mysql_connect()?

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
14 7680
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
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
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
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
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
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
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
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
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

23
by: ian justice | last post by:
Before i post actual code, as i need a speedyish reply. Can i first ask if anyone knows off the top of their head, if there is a likely obvious cause to the following problem. For the moment i've...
10
by: Alvaro G Vicario | last post by:
I need that my script retrieves data from two different databases so I use mysql_connect() to open two connections. I have only one server, user and password, just two different databases....
4
by: Andrew Clark | last post by:
Hello, I am having trouble connecting to my server with mysql_connect(). I can connect via the command line on the server and with phpMyAdmin over our network, but not though mysql_connect()....
2
by: Sugapablo | last post by:
I have a small test script connecting to a MySQL database. It seems to work, unless I try to use the resource link identifier returned by mysql_connect(); This works and returns all the rows in...
19
by: Michael | last post by:
Hi, I'm trying to do something which should be very simple - connect to the MySQL database. Here is the call, followed by the error msg. $conn = mysql_connect("localhost", "root", ""); ...
7
by: avenpace | last post by:
Hi, I got error when using mysql_connect function in my php script. If i set the db host to localhost, it give me that error altough all the user and password that I wrote is true(I can login...
6
by: GD | last post by:
Hi All, I've got MySQL 5.0.21 running on Windows Server 2003, and php running on Apache on a Linux box (Fedora Core 4). Previously when the pages were running on an IIS server the connection...
3
by: DaedalusShadow | last post by:
I've got a piece of script that works that looks like this: ___________________________________________________________ $username="daedalus_admin"; $password="test"; $database="daedalus_db"; ...
2
by: Ralf Seliger | last post by:
Hi, I hope someone here has a clue as to what is going on since I am completely baffled by the following: I'm working with a PHP/MySQL-web application called Moodle. When this application is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.