473,796 Members | 2,621 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 #1
49 16296
Dormilich
8,658 Recognized Expert Moderator Expert
short answers:
1. probably

2. that depends on the distributors of the according PHP build. I think the PHP 5 source code has general support, may it be enabled by default or not.

long answers:
I'm not aware that MySQL support has been cancelled on PHP 5. nevertheless, you can get proof of that by looking at the phpinfo() page. just on top should be the configure commands (the ones that tell you with what preferences your PHP was build). if you can't find the option '--with-mysql=/$path' ($path is the path to PHP's mysql files)(or alternatively there is the option '--without-mysql') what I suspect from the error message, then you have to either get another PHP build or you have to build it yourself...

to avoid reinstalling you can try the MDB2 PEAR package (at PEAR :: The PHP Extension and Application Repository)

regards
Dec 28 '08 #2
pbmods
5,821 Recognized Expert Expert
Heya, Julian.

Check out this page for more information:
PHP: Installation - Manual
Dec 29 '08 #3
Julian Bowler
28 New Member
thanks to the two people that have replied, pbmods and dormilich!
I have ran phpinf() and looked at the resulting page, Under Apache environment is says in the PATH Section
C:\Program Files\PHP\;C:\W INDOWS\system32 ;C:\WINDOWS;C:\ WINDOWS\System3 2\Wbem;C:\Progr am Files\MySQL\MyS QL Server 4.1\bin;"C:\Pro gram Files\Symantec\ Norton Ghost 2003\"
also in the environment section and th php variable section there is MySQL mentioned!
So i do not know what this means unfortunately, I have managed to download some other versions of php 5, so I am going to remove my present version of php completely and leave the configuration file for Apache alone and then install a different version of php on the laptop?
The question becomes which version of php will definitely have Mysql support bundled in it ?? I do not know, is there a place where i can simply answer this question please?? thanks inadvance Julian
Dec 29 '08 #4
Julian Bowler
28 New Member
Before I do try what i said in my previous post about trying a different version of php 5 i am going to follow the advice that pbmods said which essentially points to some helpful information on installing php I am essentially going to try to manually reconfigure php to recognise the mysql local server correctly and my results will be posted latter on here in this thread julian
Dec 29 '08 #5
Julian Bowler
28 New Member
I Read on the php site that in order for mysql support to be working that the file php-mysql.dll must be enabled inside the php.ini configuration file. inside the php.ini file i can find no reference to php-mysql.dll

Also, there is no file with the name php-mysql.dll inside the php directory anywhere at all...... does this mean then that php 5.2.5 simply does not have any MySQL Support??? ??
Dec 29 '08 #6
Dormilich
8,658 Recognized Expert Moderator Expert
@Julian Bowler
Maybe it's not in the PHP folder but the MySQL folder, try searching all folders of the PATH variable. the $PATH section clearly denotes, that MySQL can be used (otherwise, why putting the MySQL path in?).

Alas, since I run PHP on a Mac I can only guess further.....
Dec 29 '08 #7
ak1dnar
1,584 Recognized Expert Top Contributor
in a windows installation, all the extensions goes to a directory named <php-installtion-path>/ext

there you need to add this line in php.ini to load the extensions from that dir. make sure it is already there.
Expand|Select|Wrap|Line Numbers
  1. ; Directory in which the loadable extensions (modules) reside.
  2. extension_dir ="C:\Program Files\PHP\ext"
  3.  
If the php_mysql.dll is available on the /ext dir, you can load it to the php environment like this.
Expand|Select|Wrap|Line Numbers
  1. [PHP_MYSQL]
  2. extension=php_mysql.dll
  3.  
If you have used a .msi file for the installation, just try to reinstall it and select a custom installation from there. you can then enable relevant extensions from "extras" menu of the installer.
Dec 30 '08 #8
Julian Bowler
28 New Member
many thanks for reply from ak1dnar. i have tried a few things that did not work, not i hasten to add. the thing you wrote about in you post to this thread..
yesterday I removed the old folder containing php 5.2.5, and it seems that removing the php directory is the way to uninstall php!!! Then i found a CD rom in a book called Sams Teach Yourself PHP, MySQL and Apache. This CD has on it PHP 5.0.2 in fact,and also a program that unzips all the files to C:/PHP5. so i did that.
than i found the file inside this directory called php.ini-recommended and renamed it php.ini.
then i copied this file called php.ini into the windows directory.
then i copied the file php5ts.dll into C:\windows\syst em. then i went to the apache configuration file called httpd.conf and did some editing, here is what i did;
at the end of the section where you see lots of lines saying Loadmodule..... ..
I added:
LoadModule php5-module c:/php5/php5apache2.dll
this line above must be exactly as is above otherwise Apache will not be able to start
then i found section starting
#
# AddType allows you to add or overide

and i added this line:
AddType application /x-httpd.php .php .phtml .html .php3
then i saved the apache configuration file and then restarted apache
This seems to have worked..... but i am still trying to understand exactly why??
I am putting up some stuff About this at my web site which will appear at:
chephrenrepairs .com - Home
i do want to understand more about how php and mysql interact, it seems to me that some php versions do simply have inbuilt MySQL support and some do not have this inbuilt???
Dec 30 '08 #9
Julian Bowler
28 New Member
ok... i am looking at your post ak1dnar, and i notice that with my new installation of php which is as i say version 5.0.2, inside the directory C:\PHP5 there is another directory called /ext.
Inside this directory there are lots of .dll files and amongst them there is php_mysql.dll and php_mysqli.dll
Also i am looking inside the new php.ini file that now resides inside C:\windows.
and in this file i find these lines:
;extension=php_ msql.dll
;extension=php_ mysql.dll

i find these lines in the part of the file where it starts:
;Windows Extensions
;Note that ODBC support is built in, so no dll is needed for it.
;


is it correct that if lines in php.ini start with a ; that they are in fact turned into comments and hence ignored???
therefore both these lines will be ignored, so i do not at the moment understand, what is it that actually allows php to be able to run successfully code to connect to a mysql server along with of course lots of other mysql type functions ???
Dec 30 '08 #10

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

Similar topics

1
9984
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
15344
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
9997
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
2380
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
4167
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
5266
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
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
9531
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
10237
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
10187
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,...
1
7553
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6795
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
5446
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
5578
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.