Hi everyone-
I have installed PHP 5.2.17, MySQL Server 5.5.24 and Apache 2.2.22 on my windows 7 home. All programs are working fine with PHP and Apache however, I receive following error when I try to connect to MySQL through the PHP program.
(Fatal error: Call to undefined function mysql_connect() in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\db_ch03-1.php on line 10)
I can login to MySQL from command line.
My php program-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>moviesite database</title>
</head>
<body>
<?php
$db = mysql_connect('localhost','root', '---------');
$query = 'CREATE DATABASE moviesite';
mysql_query($query, $db);
mysql_select_db('moviesite', $db) or die(mysql_error($db));
$query = 'CREATE TABLE movie(
movie_id integer unsigned NOT NULL AUTO_INCREMENT,
movie_name varchar(255) NOT NULL,
movie_type tinyint NOT NULL DEFAULT 0,
movie_year smallint unsigned NOT NULL DEFAULT 0,
movie_leadactor integer unsigned NOT NULL DEFAULT 0,
movie_director integer unsigned NOT NULL DEFAULT 0,
PRIMARY KEY (movie_id),
KEY movie_type(movie_type, movie_year)
) engine = MyISAM';
mysql_query($query, $db) or die(mysql_error($db));
echo 'movie database successfully created';
?>
</body>
</html>
phpinfo()-
PHP Version 5.2.17
System Windows NT NIVI0211-PC 6.1 build 7601
Build Date Jan 6 2011 17:26:08
Configure Command cscript /nologo configure.js "--enable-snapshot-build" "--enable-debug-pack" "--with-snapshot-template=d:\php-sdk\snap_5_2\vc6\x86\template" "--with-php-build=d:\php-sdk\snap_5_2\vc6\x86\php_build" "--with-pdo-oci=D:\php-sdk\oracle\instantclient10\sdk,shared" "--with-oci8=D:\php-sdk\oracle\instantclient10\sdk,shared" "--without-pi3web"
Server API Apache 2.0 Handler
Virtual Directory Support enabled
Configuration File (php.ini) Path C:\Windows
Loaded Configuration File C:\PHP\php.ini
Scan this dir for additional .ini files (none)
additional .ini files parsed (none)
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.*
php.ini file is attached
php_mysql.dll exist in c:\PHP\ext
libmysql.dll and php.ini exist in C:\PHP
libmysql.dll and php_mysql.dll also exist in c:\Windows\System32
My Environment variables are set as-
PATH C:\Program Files (x86)\Apache Software Foundation\Apache2.2\bin ;C:\Program Files\MySQL\MySQL Server 5.5\bin ;C:\PHP
PHPRC C:\PHP
httpd.conf file is also attached
I have been working on this for long time and have read many threads on the internet without any success. Any help on this is greatly appreciated. I have tried to give as much information as possible. Thanks
php.zip httpd.zip