473,796 Members | 2,708 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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\connect test.php on line 2

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

Mar 4 '07 #1
14 7713
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.slas hlife.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\connect test.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...@scenic place.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\connect test.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\connect test.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.slas hlife.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

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

23
5687
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 reduced my form request to a simple text string entry, instead of my desired optional parameters. As i have been stuck with a single unfathomable glitch for over a year. Basically, if i enter queries such as ; "select * from table" "select * from...
10
5126
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. Simplified, it'd be: $con1=mysql_connect($server, $user, $pass); mysql_select_db($database1, $con1); $res1=mysql_query($sql1, $con1); $con2=mysql_connect($server, $user, $pass);
4
5781
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(). This is my script: <?php $host = '192.168.100.5'; $user = 'root'; $pass = <password>;
2
2838
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 the table: <?php include("../config.php"); $dbi = mysql_connect($dbhost,$dbuname,$dbpass);
19
8114
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", ""); Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13) in /var/www/html/buildhw.php on line 13
7
5418
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 using that username/passwd using mysql console), but when I change the db host into 127.0.0.1 mysql_connect will work. Beside of that I can't make my php script to do I/O operation on dir/file in the apache /var/www though the permision already own...
6
3365
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 was succesful, now I get: Can't connect to MySQL server on 'SERVER' (13)
3
1348
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"; mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "Unable to select database");
2
2028
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 started from a web browser, one of the first things to happen is a call to mysql_connect which succeds without any problems. One component of moodle is a so called chat daemon which is just another
0
9685
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10239
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10190
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10019
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9057
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6796
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5447
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5579
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2928
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.