| Author | 
  | 
yickoCN
 
 
  Joined: 09 Nov 2006 Posts: 8 Location: China
  | 
 Posted: Thu 09 Nov '06 15:04    Post subject: apache2.2.3+php5.2.0+mysql5.1.12+WinxpSp2  Error! | 
     | 
 
  | 
 
Fatal error: Call to undefined function mysql_connect() in D:\PHP\WebSite\index.php on line 4
 
my index.php :
 
<html>
 
<body>
 
<h1>
 
<?php
 
    $link=mysql_connect('localhost','root','123456');
 
    if(!$link) echo "fail"; 
 
    else echo "success";
 
    mysql_close();
 
?>
 
</h1>
 
    <? echo phpinfo(); ?>
 
</body>
 
</html>
 
if modify my index.php
 
 
<html>
 
<body>
 
    <? echo phpinfo(); ?>
 
</body>
 
</html>
 
 
 
will correct run | 
 
  | 
| Back to top | 
 | 
James Blond Moderator
  
  Joined: 19 Jan 2006 Posts: 7443 Location: EU, Germany, Next to Hamburg
  | 
 Posted: Thu 09 Nov '06 15:06    Post subject:  | 
     | 
 
  | 
 
| Sure that you enabled php_mysql.dll in php.ini ? | 
 
  | 
| Back to top | 
 | 
yickoCN
 
 
  Joined: 09 Nov 2006 Posts: 8 Location: China
  | 
 Posted: Thu 09 Nov '06 15:22    Post subject: Yes! | 
     | 
 
  | 
 
 	  | James Blond wrote: | 	 		  | Sure that you enabled php_mysql.dll in php.ini ? | 	  
 
 
 
Yes ! I sure
 
 
extension=php_mssql.dll
 
extension=php_msql.dll
 
extension=php_mysql.dll | 
 
  | 
| Back to top | 
 | 
Steffen Moderator
 
  Joined: 15 Oct 2005 Posts: 3131 Location: Hilversum, NL, EU
  | 
 Posted: Thu 09 Nov '06 16:02    Post subject:  | 
     | 
 
  | 
 
Maybe you can give first a try the mysqlinfo.zip at the download page here. It is PHP script for testing your MySQL PHP-extension installation.
 
 
Steffen | 
 
  | 
| Back to top | 
 | 
yickoCN
 
 
  Joined: 09 Nov 2006 Posts: 8 Location: China
  | 
 Posted: Thu 09 Nov '06 16:18    Post subject:  | 
     | 
 
  | 
 
 	  | Steffen wrote: | 	 		  Maybe you can give first a try the mysqlinfo.zip at the download page here. It is PHP script for testing your MySQL PHP-extension installation.
 
 
Steffen | 	  
 
 
 
The result is :
 
 
php MySQL extension not loaded !! 
 
 
Check in php.ini if extension=php_mysql.dll is enabled, and that the extension_dir = is pointing to your php/ext folder. 
 
 
Copy libmySQL.dll from your Mysql/bin folder to c:/windows.[/img] | 
 
  | 
| Back to top | 
 | 
Steffen Moderator
 
  Joined: 15 Oct 2005 Posts: 3131 Location: Hilversum, NL, EU
  | 
 Posted: Thu 09 Nov '06 16:26    Post subject:  | 
     | 
 
  | 
 
| Check also at the top of phpinfo() where PHP is finding your php.ini (Configuration File (php.ini) Path) | 
 
  | 
| Back to top | 
 | 
yickoCN
 
 
  Joined: 09 Nov 2006 Posts: 8 Location: China
  | 
 Posted: Fri 10 Nov '06 1:39    Post subject:  | 
     | 
 
  | 
 
 	  | Steffen wrote: | 	 		  | Check also at the top of phpinfo() where PHP is finding your php.ini (Configuration File (php.ini) Path) | 	  
 
 
 
I don't understand!?
 
 
What? | 
 
  | 
| Back to top | 
 | 
pnllan
 
 
  Joined: 05 Dec 2005 Posts: 221
 
  | 
 Posted: Fri 10 Nov '06 7:26    Post subject:  | 
     | 
 
  | 
 
Steffen is talking about the information displayed from phpinfo.  You should observe in the top table of information that there is a row with Configuration File (php.ini) Path.  He is asking if the path agrees with where you actually installed PHP.
 
 
I believe your problem is that Apache/PHP cannot find the file libmysql.dll.  You can copy this file from the MySQL BIN folder to one of the following locations depending on how you setup Apache and PHP:
 
 
a)  PHP folder (overwrite existing file)
 
b)  Apache BIN folder
 
c) C:\WINDOWS
 
or
 
d)  C:\WINDOWS\system32
 
 
That should fix you up. | 
 
  | 
| Back to top | 
 | 
yickoCN
 
 
  Joined: 09 Nov 2006 Posts: 8 Location: China
  | 
 Posted: Fri 10 Nov '06 8:17    Post subject:  | 
     | 
 
  | 
 
I had copy  "libmysql.dll"  to 
 
 
a) PHP folder (overwrite existing file) 
 
b) Apache BIN folder 
 
c) C:\WINDOWS 
 
or 
 
d) C:\WINDOWS\system32
 
 
but... Error !~
 
 
www.apachelounge.com 
 
 
 
 
php MySQL extension not loaded !! 
 
 
Check in php.ini if extension=php_mysql.dll is enabled, and that the extension_dir = is pointing to your php/ext folder. 
 
 
Copy libmySQL.dll from your Mysql/bin folder to c:/windows.
 
 
 
 
PHP Version 5.2.0 
 
 
System  Windows NT CUNPENG 5.1 build 2600  
 
Build Date  Nov 2 2006 11:50:55  
 
Configure Command  cscript /nologo configure.js "--enable-snapshot-build" "--with-gd=shared"  
 
Server API  Apache 2.0 Handler  
 
Virtual Directory Support  enabled  
 
Configuration File (php.ini) Path  C:\WINDOWS  
 
PHP API  20041225  
 
PHP Extension  20060613  
 
Zend Extension  220060519  
 
Debug Build  no  
 
Thread Safety  enabled  
 
Zend Memory Manager  enabled  
 
IPv6 Support  enabled  
 
Registered PHP Streams  php, file, data, http, ftp, compress.zlib  
 
Registered Stream Socket Transports  tcp, udp  
 
Registered Stream Filters  convert.iconv.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, zlib.*  
 
 
 This program makes use of the Zend Scripting Language Engine:
 
Zend Engine v2.2.0, Copyright (c) 1998-2006 Zend Technologies | 
 
  | 
| Back to top | 
 | 
pnllan
 
 
  Joined: 05 Dec 2005 Posts: 221
 
  | 
 Posted: Fri 10 Nov '06 10:31    Post subject:  | 
     | 
 
  | 
 
MySQL 5.1 is still in BETA, so I will setup a test-bed using it instead of MySQL 5.0 to see if that might be the issue.  My past experience has been that MySQL ALPHA and BETA releases can be problematic when it comes to integrating PHP.
 
 
For your reference, I setup WAMP as I have written in the following link:
 
 
http://www.apachelounge.com/viewtopic.php?t=570
 
 
That setup strictly adheres to PHP standards and advice written in the PHP manual. | 
 
  | 
| Back to top | 
 | 
yickoCN
 
 
  Joined: 09 Nov 2006 Posts: 8 Location: China
  | 
 Posted: Fri 10 Nov '06 10:51    Post subject:  | 
     | 
 
  | 
 
Sorry , my MySql ver is 5.0
 
 
 
I modify my httpd.conf  ,
 
 
insert     PHPIniDir = "D:/PHP/php/php.ini"
 
 
new Error
 
 
  | 
 
  | 
| Back to top | 
 | 
yickoCN
 
 
  Joined: 09 Nov 2006 Posts: 8 Location: China
  | 
 Posted: Fri 10 Nov '06 11:04    Post subject:  | 
     | 
 
  | 
 
Success!!
 
 
Thanks for your help!
 
 
I come from China , My english is very poor! 
 
 
I want to study english, do you help me? | 
 
  | 
| Back to top | 
 | 
James Blond Moderator
  
  Joined: 19 Jan 2006 Posts: 7443 Location: EU, Germany, Next to Hamburg
  | 
 Posted: Fri 10 Nov '06 12:14    Post subject:  | 
     | 
 
  | 
 
Come to your new IRC channel 
 
server apachelounge
 
chanel #Lounge
 
 
   | 
 
  | 
| Back to top | 
 | 
yickoCN
 
 
  Joined: 09 Nov 2006 Posts: 8 Location: China
  | 
 Posted: Fri 10 Nov '06 13:16    Post subject:  | 
     | 
 
  | 
 
What is "IRC channel" ?
 
 
How can I join the channel? | 
 
  | 
| Back to top | 
 | 
Steffen Moderator
 
  Joined: 15 Oct 2005 Posts: 3131 Location: Hilversum, NL, EU
  | 
 | 
| Back to top | 
 |