473,805 Members | 1,972 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Fatal error: Call to undefined function mysql_connect()

28 New Member
Please can some one help with my problem; I am running Apache web server on my lap top, plus a mysql server and php. The version of php currently installed is 5.2.5.
when i write some php to connect to my mysql database server instead of it connecting i get :
Fatal error: Call to undefined function mysql_connect() in C:\Program Files\Apache Group\Apache2\h tdocs\chephrenr epairs\dataentr yprocess.php on line 16.

question 1 is this:
Is this happening because the version of php i have installed has no support for mysql bundled with it?

Question 2: Are there some versions of php 5 that have no support for mysql at all because it was removed by the php writters and if so which versions of php 5 do have mysql support built in to them that works properly?

I have looked on this forum and found that someone said that mysql support was removed in php 5, but it sdoes not say which version of php 5 it was removed from, neither does it hint as what to do to get php communicating twith the local mysql server??

if questions 1 and 2 have been answered in anther thread on this forum then please where???
Dec 28 '08
49 16299
Julian Bowler
28 New Member
as per the post by ak1dnar previous, i tried putting this line into php.ini
extension = php_mysql.dll
and then saving the file and stopping and then restarting Apache, but what happens is that Apache will not start, and instead we see a message on the screen that says:
PHP Startup: Unable to load dynamic library 'C|PHP5\ext\php _mysql.dll' - The specified procedure could not be found.

so please does any one know what this means and does it have any relavance to my problem which is that I can ot run a php script that simply calls the mysql_connect() function??? ?

What is missing ? Is php unable to run any mysql type function and is the reason possible to discover?
I come back to this question, what is needed in a php installation to be able to run all mysql functions to communicate with a local MySQL Server??
And which versions of php work with MySQL? Has Mysql support ben remved form some or all php 5 versions, I am sure I had it all working fine previously with a php 4 version!!?
is the next thing to try, removing php 5.0.2 and install a php 4 version?
Dec 30 '08 #21
Julian Bowler
28 New Member
many thanks for Dormilich response, yep i could try a WAMP Package but one thing that concerns me is are there any WAMP Packages that work reliably, and also if the WAMP Package does not work properly can it be uninstalled without messing up my computer.
Has anybody any experience of WAMP Packages that work well and are straight forward to install, of course i would need a WAMP Package for use on windows XP Home.....
Finally, would I need to uninstall Apache MySQL and PHP prior to installing a WAMP Package??? What set up of the MySQL part would be required, normally in My SQL you need t remove some default users, and create some new users to get MySQL Server to work I do believe.?
Dec 30 '08 #22
Dormilich
8,658 Recognized Expert Moderator Expert
@Julian Bowler
the path looks strange. I'd have expected something like 'C:\PHP\...'
@Julian Bowler
I have 5.2.8. working (through MDB2) and so do thousands of others.
Dec 30 '08 #23
Julian Bowler
28 New Member
PHP 5.2.8 working with MDB2, please tell me what is MDB2 is that a relational database like MySQL that can be ran on a web server? I have not herd of MDB2?
ta..
Dec 30 '08 #24
Dormilich
8,658 Recognized Expert Moderator Expert
in short MDB2 is a Database Abstraction Package provided through PEAR. see PEAR :: Package :: MDB2 (it makes working with databases easier)

note: MDB2 for MySQL uses PHP's mysql functions
Dec 30 '08 #25
Julian Bowler
28 New Member
many thanks for your reply, I am tomorrow going to remove php 5.0.2 and then try installing php version 4.4.7, this is the zipped win32 version. I will then attempt to configure this to work with MYSQL that is installed and running on my lap top. I have read on the internet that php 5 does not have MySQL Support built into it and that it has to be configured manually, but I have tried quite a few things so far and i still get the
Fatal error: Call to undefined function mysql_connect() in C:\Program Files\Apache Group\Apache2\h tdocs\chephrenr ep.....
every time i run the php script calling this function.

IF PHP 4.4.7 will not solve the problem I will most likely rebuild the entire Lap Top from scratch starting with using the original cd to put it back to how it was in the factory and then installing Apache, php 4.4.7 which i do hope will work, and then Mysql 4.1.

All replies to this thread have been very helpful.... intend to add to this thread tomorrow
Dec 30 '08 #26
ak1dnar
1,584 Recognized Expert Top Contributor
Sorry guys, I was quite busy with my works last day. :(

Ok, back to the questions. My first recommendation is do not revert back to Php 4.x.x as now we have Php 5.x.x which is more powerful and stable.

Your problem is some what strange to me. may be as "Dormilich" said, you have used some corrupted version of php installer.

Still I suggest you to install MySQL, Php, Apache as separate installations. Doesn't matter if you happy with WAMP also, it a good tool. But I still like to configure them individually.

If you need to do it from scarch here we go !

Uninstall Php, MySQL, apache from your system.and restart your pc.

Install Apache
Download apache_2.2.11-win32-x86-openssl-0.9.8i.msi and install it with the default settings.

Install MySQL
Download and install mySQL from here MySQL 5.1 and install it with default settings

Install Php
Now get thePhp 5.x.x from php.net, PHP 5.2.8 installer is better.

When Installing select the Apache Version 2.2.x as your target web server.

Provide the apache configuration dir when asking.
ex: C:\Program Files\Apache Software Foundation\Apac he2.2\conf\

Then you can select the Extensions > MySQL and enable it. (Do not select all the extensions as it will brake the configuration)

Restart the Apache or your PC.

Now create a test script ( phpconfigtest.p hp ) with these lines of code and put it to Apache Doc Root. (Hope you know where it is)
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. phpinfo();
  3. ?>
  4.  
exceute the page as http://localhost/phpconfigtest.php
you will see the Php confuguration info in detail in the page. find the "mySQL" details area. if it is there and if mysql support enabled, you are good to go with Php-MySQL.

Happy coding.
--ak1dnar
Dec 31 '08 #27
Julian Bowler
28 New Member
very helpful response from ak1dnar,many thanks... yep it is possible that some file or files are corrupted it does actually happen!! As to uninstalling Apache, well it appears in the add and remove programs feature of Control Panel, so i guess can be removed using that. also PHP 5.2.2 also appears in add and remove programs, but is is not there as i removed its directory before, that is bizarre and plan bonkers!!

Hence i will try to remove Apache using add and remove programs and do the same with MySQL and MySQL Query Browser and MySQL Administrator. then i will remove the current php directory and remove all the files i copied to C:/Windows and to C:/Windows/system and then finally start again with the pieces of software recommended by ak1dnar.

just to be clear, you can test whether or not php is working by writing a program like:
<?php

phpinfo():
?>
and running it and you will see a blue page, but you can not test a php connection to a MySQL database unless you write some specific functions to connect and to use a database etc, and to do this you need of course an actual database and a user to actually exist first, and probably a table in that database would be also very useful me thinks......
Dec 31 '08 #28
Dormilich
8,658 Recognized Expert Moderator Expert
@Julian Bowler
jepp.

@Julian Bowler
correct, the phpinfo() tells you whether PHP correctly recognized its MySQL part. testing the mysql functions indeed requires a database, user, ... which are usually unknown to php.ini
Dec 31 '08 #29
Julian Bowler
28 New Member
I have now installed all recommended by ak1dnar, and it has all installed fine,but when i run the mysql _connect function in a web page, i get a blank page, absolutely nothing, white screen.....
I have checked that in php .ini
and there is in it
error_reporting = E_ALL
and
display_errors = On, and i restarted the Apache server,
so what is going on why will it apparently not work. what should i try to do next??
Jan 1 '09 #30

Sign in to post your reply or Sign up for a free account.

Similar topics

1
9985
by: BT | last post by:
Hi .. a newbie question. I get the following error: Fatal error: Call to undefined function: mysql_connect() in /var/www/html/index.php on line 3. I have the following RPMS installed on RH7.2 MySQL-client-4.0.14-0 I would really appreciate it. MySQL-shared-4.0.14-0 MySQL-server-4.0.14-0 MySQL-devel-4.0.14-0
4
15347
by: gc | last post by:
I'm a PHP and MySQL newbie. I have a feeling a lot of you may have seen this before. I'm teaching myself PHP/MySQL and trying to setup a guestbook. I'm running latest versions of Apache, PHP and MySql on WIN 2000. PHP is installed from the zip file. When serving php docs (code snippets below) I get the messages: "Fatal error: Call to undefined function mysql_connect() " "Fatal error: Call to undefined function mysql_pconnect() "
8
9998
by: Tim Tyler | last post by:
I'm getting fatal errors when executing code - and my error handler is failing to trap them - so I get no stack backtrace :-( The error I am getting is: "Fatal error: Call to a member function fetchRow() on a non-object." What are the available options here? Am I supposed to check I have a real object whenever I perform
1
13671
by: Mike | last post by:
Last weekend I decided to install Apache 2.0.53-win32-x86-no_ssl PHP 5.0.3 Smarty 2.6.7 MySQL essential-4.1.10-win32 I have Apache up (Port 80 blocked at the router and firewall!) and I have got Smarty working. I haven't got around to installing MySQL. I am now in chapter 8 'Error and Exception Handling' of
2
2382
by: inonzuk | last post by:
why strange you ask? here goes: I have been working with Php and Mysql for a week without any problems. Today I tried executing a php page that connects to mysql and creates a new database, I got this error: "Fatal error: Call to undefined function mysql_connect() in C:\Program Files\Apache Group\Apache2\test\_debug_tmp.php on line 3". I did some reading on the net and checked all my configuration, and it
2
2003
by: Frobinrobin | last post by:
I am running Win2k3 Server and when I try to use the mysql_connect function I am getting an error: Fatal error: Call to undefined function mysql_connect() in C:\Inetpub\wwwroot\programs\index.php on line 8 Now, I def know I've configured my php.ini correctly (its literally the same as my XP machine) and I know that mysql works fine with PHP as I can run it from the command line :D I've got the files (tried in multiple places - but...
5
4168
by: Grant Nosbush | last post by:
I have searched the newsgroups and the web trying to solve this problem and just can't get it. Maybe someone will be able to help. I am getting the following error when I try to view a test page in my browser. This test page just reads a table in mysql and outputs the results. Fatal error: Call to undefined function: mysql_connect() in /var/web/public/test.php on line 2 I'm using:
5
2783
by: awdsites | last post by:
Hi, I'm a noob with a server so keep that in mind :) Been trying to connect with php to mysql and all I get is: "Fatal error: Call to undefined function: mysql_connect()" I've read and read and can't figure out what is wrong. My current set up is:
9
5268
by: java | last post by:
Hey there, I just removed an elderly PHP4-Installation from my Windows-Box and installed PHP 5.2.1. I used the PHP4-Module as local batchfile- interpreter by E:\ersDHCP>php ./extractLog.php which was perfectly alright and worked well. But now PHP5 fails to run the same script without any modification!
0
9716
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
9596
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10607
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10359
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...
0
10104
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
9182
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
6875
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
5541
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...
3
3007
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.