0118 9352873    COMPUTER REPAIRS

   email: repairs@chephrenrepairs.com

 
line decor
COMPUTER FIXER BLOG  !CALL OUT CALCULATOR Ver1.1.4  !CONTACT US:  !RSS Feed:  ! Thursday, July 29th 2010
line decor

  Download Firefox to View Web Site

  

 

Internet Explorer 8 has a button Compatability

View, use it if this page is poorly displayed.
 

Welcome to the MySQL School Berkshire UK Here We Discuss How

Does MySQL Work, how to you use MySQL, How do you Connect to The MySQL Server

We Talk about How to install and configure MySQL, what Configuration is necessary

with a new MySQL Server ..How do you create new Databases..Whats a Schema!?

email: repairs@chephrenrepairs.com | page end | news Cost from £20.00 per / hr

Backingup and Recovery Hardware Faiure Problems with the Mail Broadband Setup Wireless Security Contact Us

Problems with the Mail

 

 

 

 

 

 

 

 

 

 

 

 

What to do if you write a php script and you go to connect to your my SQL Server and you run the web page and see a message that says:

Fatal call to undefined function mysql_connection() in c:Program files\Apache Group\Apache2\htdocs\yourwebsitename\yourphpscriptname.php

 

Effectrively, this is telling you that php does not recognise the function mysql_connection. why would this happen!? Well first things first..... If you write a web page using php and you run it and you see a blank page, the main reason why this may happen is because php is configured to show no error messages at all..... in fact many php versions are set up by default to do this, and therefore if php encounters a problem at run time, no message will be sent to the screen at all, and so you will not even see the message we mention above. In order to turn on error reporting for php you need to edit the php.ini file.

How to make php show all errors it encounters on the screen.

You can edit the php.ini file easily using note pad, you will find the php.ini file inside the directory called php.If you have installed php inside the directory Program Files, which a lot of people do! you will find php.ini here:

C:\Program Files\php\php.ini

go into the file and find the bit that says display_errors=Off

Now edit the file, here we show you what we did:-

; change this next line to display-errors = On Jb 13th 10/09
display_errors = On

Next Save the file, notice the bit starting with a semi colon is a comment, the bit starting display_errors = does the trick!

Once you have saved the file you should stop the apache web server running on your local machine then restart the apache web server, then reload the page in question.The Apache monitor is the place to do this, it should be seen in your task bar a a tiny white circle with a feather comming out of it and a little green arrow in the centre pointing to the right.

Why do you get "fatal call to undefined function mysql_connection()"

The most probable reason why you see the message on the screen saying there is a fatal call to undefined function mysql_connection() is that the version of php you currently do have installed does not have the associated libraries required to interperate mysql functions. this on the face of it is very annoying, you would imagine that all modern versions of php would install with all capacity to interface with a local mysql server fully built in....!! Well many 4 versions of php did have these libraries needed built in but many php versions 5 do not have these libraries at all. Look if you have installed php 5 correctly you may find that many php functions do work, but you may find that all functions that start with mysql_ or start mysqli_ do not work at all, it is not that there is an error in the php code, and it is not necessarily a problem with the local mySQL Server, it is that the appropriate library needed by PHP is completely missing.

What you really need to know is this does the version of php that you have downloaded from php.net actually have bundelled in it the necessary libraries to interface with a local mysql server?? You may possibly be able to work this out by reading the releace notes for the version you intend to download and install, but the releace notes just might not say?!!!. or if they do say it might be mentioned in an obscure and hard to find place.

How can I tell straight away if a particular version of PHP can connect to a local MySQL Server or in fact any MySQL Server//?

 

 

This is a tough question but a simple one, I can give you a few tips right here at www.chephrenrepairs.com find us at yell.com just type in what : Computer Repairs where: Reading GO!!!!   One way you get a clue it to download the zipped windows version of php then extract it to ( C: if it is version 4.x.x or extract to C:/php if it is php 5.x..x (create c:/php first)) Now look at the file called php.ini-dist,open it up using notepad, scroll down till you find the line that says:

;Windows Extensions

under that line there will be a load lines that start

;extension=php_mbstring.dll
;extension=php_bz2.dll
;extension=php_cpdf.dll
;extension=php_crack.dll
;extension=php_curl.dll
;extension=php_db.dll
;extension=php_dba.dll
;extension=php_dbase.dll

INBETWEEN THERE MAY BE A LINE THAT SAYS SOMETHING LIKE THIS;

;Note that MySQL and ODBC support is now built in, so no dll is needed for it.;

This is a good indicator that MySQL Functions will work, you need to follow a few fairly simple manual configuration steps of PHP, find sone help here; php4-installation-manual-configuration.php

 

 

 

I think that the files that you need in order to make mysql functions work are libmysql.dll and libmysqli.dll.

We are running php version 5.2.10 inside our php.ini file we have this line;

extension_dir ="C:\Program Files\PHP\ext

this tells us that any php exstensions we have will be located there, infact it also tells php to look there for any extensions that php needs to load when it starts up... so thats usefull...... but if we look in the php directory we find no directory called ext, it is simply is not there!

Infact we think that all you might need is the file libmysql.dll it should be placed we think in the directory called ext which is in the directory called php. As well as having this file in place you need a line in php.ini saying:

extension=libmysql.dll

theres a bit more to this once you have placed the file in the correct place and have edited php.ini, you must save php.ini, then you must stop the apache web server and then restart the apache web server, then you should reload your web page that calls the mysql_connection() function

We tried all of the above, we found the file libmysql inside a directory on our hard disk.

where was the libmysql.dll file; we explain; as well as downloading the php version we wanted as an installer and installing it, we also decided to download the zipped version of the php version we wanted. thus, we found the libmysql.dll file inside the directory we unzipped into.

i;ll explaine; i used an unzipping progra to unzipp the php folder into another follder I called php5210. then we simply looked in that folder.

Now I have already said that many versions of php 5 do not come with support to connect to mysql and use functions that interface with the mysql server. So I am unsure why this file libmysql.dlll was even to be found inside this folder at all.??

but even when all this was done we still got the same message fatal call to undefined function mysql_connection() so we assummed that either we need more .dll files or we need more dll files and something else..... we are investigating..... i have definately had previously php versions 4. something that have not caused this problem at all......

we have more questions than answers:

Q1 do all versions of php 5. anything all not have suppoort for mysql?

Q2 which php versions 4 work when you call mysql functions?

Q3 is there a way of installing php5 manually, i.e not using a msi installer or infact any installer that will work with a local mysql server?

Q4 which versions of php expressley say that the have full mysql support inbuilt into them, and why would mysql support be missing with any version of php...>?

Q5 does anybody keep an up to date list of which versions of php will definatelly allow you to connect to mysql server and run all mysql type functions? and if not why not?

I am not sure why php does not seem to recognise mysql_connect(), but I can tell you it is not working on my lap top right now. The thing that gives that away is the writing in the web page loaded that says Fatal call to undefined function mysql_connection() The solution I propose, is to remove php 5.2.10 completely, and at the same time edit the config file within the Apache web server I am running, then to unzip a new php version 4.4.9, and to manually configure this to work. This will involve quite a few steps and of course I am not using any php msi installer or any php installer, I am instead just using a program to unzip the download version of php I downloaded from php.net, the file i have downloaded off the web i got from php.net and i downloaded it, so it ended up in my downloads folder, as this file php-4.4.9-Win32.zip

First things first: here I show you what lines I remove from the apache configuration file. you will find the apache configuration file located here: C:/Program Files/Apache Group/Apache2/conf/httpd.conf you can edit using notepad an you find that from start all programs accessories notepad.

Remmember that at the moment we are running apache web server 2.0.63 and php version 5.2.10. inside the configuration file i mention above : C:/Program Files/Apache Group/Apache2/conf/httpd.conf there are the following lines at the bottom;

#BEGIN PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL
PHPIniDir "C:/Program Files/PHP/"
LoadModule php5_module "C:/Program Files/PHP/php5apache2.dll"
#END PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL

Just remove the middle two of these, the other two lines are comments and will do no harm, so for speed leave the two lines starting with #. once you have done this just save the file and then stop and start the apache web server... how... use the apache services monitor in your task bar. notice when apache restarts it will say apache 2.0.63 (win32) at the bottom, and no php 5.2.10 part, its gone, why because the module that makes Apache recognise php is now not loaded when Apache starts up! Note: you may need to close down the monitor and open it one more time to see the php bit dissapear!

There is no uninstaller for php, so instead we just remove the entire contents of the directory it is in and that directory. previously we installed php in Program Files/php, so we delete everything there and the directory, and php is gone! For crying out loud do not delete C:/Program Files Lastly we make sure that we have created a directory in the root of our hard drive called php, i.e c:/php this is where the new php installation will sit. Well infact this last statement depends on what you are doing.... i'll explaine, normally php 5 would be placed in C:/php so you will need a directory called php in the root of you hard drive, but if you intend to install php 4 which is what we are going to do you will unzip the folder straight in to C: and the unzipping process will create a folder in which php will live!

If you are going to uninstall or effectively remove php5, you must delete the files the it comprises of + delete the directory it lives in and also edit the main configuration file for Apache, i.e. C:/Program Files/Apache Group/Apache2/conf/httpd.conf

The main configuration file for Apache is as far a I know always httpd.conf, it is worth keeping a back up of this in case you muff up editing it and need to replace it with a file that you know works!!

 


Installing & configuring manually PHP 4.4.9