Sunday, December 30, 2007

Fatal error: Call to undefined function: mysql_connect()

Hello everybody!

I've finally got solved the splinter for me! Here are the steps to get rid of it.

What I did first was reinstalling php by a new way.

I have zipped version of php-5.0.2-Win32.

I created a new folder php on c: disk and put all the unzziped files into it.

I deleted files I had copied before from C:\windows\system32. libmysql.dll libmysqli.dll php5apache2.dll php5apache.dll php5ts.dll php_mysql.dll

In the Next step I opened a config. file 'httpd.conf' for apache (i have ver.2.0.52) and added this content into the bottom of the page.

LoadModule php5_module 'c:/php/php5apache2.dll'

AddType application/x-httpd-php .php

PHPIniDir 'C:/php'

1-st line indicates where the module needed for apache to load php is located

2-nd line indicates the type of php script whether it php or php3 e.t.c

3-d line indicates where your php.ini file is located (the path where apache is have to look for it) Saved and close it.

Restarted the apache.

After that I went to c:\php, located 'php.ini-recommended' file, made a copy of it and renamed the original one into php.ini. Since now my php started to work, but without mysql.

In the next step, I opened php.ini file, found a line extension_dir = './' and changed it for extension_dir = 'C:\php\ext' (to find it fast, press ctrl+f on your keyboard, make sure you have clicked your mouse at the start of the page, to make it search from the top.).

Then I found a line ;extension=php_mysql.dll and removed the semicolon in the begining. Saved the document. Restarted the apache.

After all, I ran the test.php file and finally got Mysql info. If you already got the page opened, don't click go button, refresh the page. I believe it will work with you too.

No comments: