Posts Tagged ‘MySQL’

Fatal Error: Call to undefined function mysql_connect() – PHP5 doesn’t support MySQL by default??!!

April 1, 2008 12 comments

This is a follow-up of the post below. I boot up my computer today and tried logging into my PHP site. Nothing appears. Uh, uh. What could be the problem this time? Yesterday it was OK.

So I checked the Apache error log, and found this: “PHP Fatal error: Call to undefined function mysql_connect()”. What the….

Googled the problem, and it turns out that PHP 5 does not enable MySQL support by default. Uh uh.. what are they thinking? Why do they don’t automatically enable it like the previous PHP version? Do they think they own PHP? Uh uh.. oh well yes they do.. [Anyway here’s the link to the reasons why they decide not to enable and bundle MySQL by default].

So here’s what I did to remedy the problem, hope it will be of help to anyone out there.

  1. Tried adding the MySQL function through PHP’s Windows Add/Remove programs, but it seems the PHP installer doesn’t have this feature. So it seems the easiest is to uninstall PHP, and reinstall PHP back with the MySQL feature.
  2. So I run PHP installer, and choose to install all MySQL related function/libraries.
  3. Don’t forget to point Apache’s configuration file correctly (httpd.conf) when asked. Mine resides in “I:\Program Files\Apache Software Foundation\Apache2.2\conf”
  4. Complete the installation and restart your computer as suggested by the installer. That’s it.

Alhamdulillah, thank God. My PHP + MySQL + Apache works perfectly well now.

The only thing I hate is, usually all this kind of ‘small’ but annoying and important stuff tends to take a long time to be fixed. (I mean all the installing and uninstalling and restarting the computer part…)


Speed Up My PC 3.5 broke PHP?

March 31, 2008 2 comments

My PHP + Apache + MySQL program was working perfectly well, until I installed and run Speed Up My PC 3.5 which is supposed to, well, speed up my pc..

I then run my PHP site which has session enabled, but unfortunately it returns an error. Dang! Must be the Speed Up My software, since right before I installed that software, my site was running smoothly.

So I ended up uninstalling the software. And to make things sure, I also uninstalled and completely reinstalled PHP and Apache. I choose to install the newer PHP 5, as previously I was using PHP 4. And then my site starts working perfectly again…

*Some time ago I used a quite similar ‘optimization’ software, but it also ended up giving problems to my developed applications.. it seems that all this ‘optimization’ software is not for us programmers at all.

I posted my experience here, just in case somebody else faced similar problem.

p/s: For some reason, my site works OK only at this time. After I restarted my computer, problems came out again..[Please refer to the post just above this for detailed post about it.]