seanhalley
04-16-2011, 10:51 AM
Hi all,
I have a Windows 7 64-bit machine running Apache 2.2, PHP 5.2 and MySQL 5.5.
I've been following the steps on this site to get them all working together: http://www.bicubica.com/apache-php-mysql/index.php.
I get the PHP "It works!" page, and I can also create and query a table in command line SQL.
The problem is getting PHP and MySQL to work together.
I have added the following to the php.ini file:
LoadModule php5_module "c:/php/php5apache2_2.dll"
AddHandler application/x-httpd-php .php
# configure the path to php.ini
PHPIniDir "c:/windows"
extension=php_mysql.dll to the php.ini
extension_dir = "C:\php\ext"
session.save_path = "C:\WINDOWS\temp"
I have also added C:\php and C:\php\ext to my PATH system variable (tried adding it at the beginning AND at the end of the existing value).
I know I'm editing the correct php.ini file because I tested by changing the register_globals variable, restarting Apache and viewing info.php.
Here is what my Apache error log says:
[Sat Apr 16 10:39:10 2011] [notice] Parent: Received restart signal -- Restarting the server.
[Sat Apr 16 10:39:10 2011] [notice] Child 3084: Exit event signaled. Child process is ending.
PHP Warning: PHP Startup: Unable to load dynamic library 'C:\\php\\ext\\php_mysql.dll' - The specified module could not be found.\r\n in Unknown on line 0
[Sat Apr 16 10:39:11 2011] [notice] Apache/2.2.17 (Win32) PHP/5.2.17 configured -- resuming normal operations
[Sat Apr 16 10:39:11 2011] [notice] Server built: Oct 18 2010 01:58:12
[Sat Apr 16 10:39:11 2011] [notice] Parent: Created child process 6612
PHP Warning: PHP Startup: Unable to load dynamic library 'C:\\php\\ext\\php_mysql.dll' - The specified module could not be found.\r\n in Unknown on line 0
<br />
<b>Warning</b>: PHP Startup: Unable to load dynamic library 'C:\php\ext\php_mysql.dll' - The specified module could not be found.
in <b>Unknown</b> on line <b>0</b><br />
[Sat Apr 16 10:39:11 2011] [notice] Child 6612: Child process is running
[Sat Apr 16 10:39:11 2011] [notice] Child 6612: Acquired the start mutex.
[Sat Apr 16 10:39:11 2011] [notice] Child 3084: Released the start mutex
[Sat Apr 16 10:39:11 2011] [notice] Child 6612: Starting 64 worker threads.
[Sat Apr 16 10:39:12 2011] [notice] Child 3084: All worker threads have exited.
[Sat Apr 16 10:39:12 2011] [notice] Child 3084: Child process is exiting
[Sat Apr 16 10:39:13 2011] [notice] Child 6612: Starting thread to listen on port 8080.
[Sat Apr 16 10:39:18 2011] [error] [client 127.0.0.1] PHP Fatal error: Call to undefined function mysql_connect() in C:\\Apache\\htdocs\\mysql_test.php on line 9
I've read loads of posts, and tried many solutions but I still can't get rid of that error. By the way, here is the page I'm trying to load:
<?php
# Define MySQL Settings
define("MYSQL_HOST", "localhost");
define("MYSQL_USER", "root");
define("MYSQL_PASS", "password");
define("MYSQL_DB", "test");
$conn = mysql_connect("".MYSQL_HOST."", "".MYSQL_USER."", "".MYSQL_PASS."") or die(mysql_error());
mysql_select_db("".MYSQL_DB."",$conn) or die(mysql_error());
$sql = "SELECT * FROM test";
$res = mysql_query($sql);
while ($field = mysql_fetch_array($res))
{
$id = $field['id'];
$name = $field['name'];
echo 'ID: ' . $field['id'] . '<br />';
echo 'Name: ' . $field['name'] . '<br /><br />';
}
?>
Grateful any help!
Cheers
Sean
I have a Windows 7 64-bit machine running Apache 2.2, PHP 5.2 and MySQL 5.5.
I've been following the steps on this site to get them all working together: http://www.bicubica.com/apache-php-mysql/index.php.
I get the PHP "It works!" page, and I can also create and query a table in command line SQL.
The problem is getting PHP and MySQL to work together.
I have added the following to the php.ini file:
LoadModule php5_module "c:/php/php5apache2_2.dll"
AddHandler application/x-httpd-php .php
# configure the path to php.ini
PHPIniDir "c:/windows"
extension=php_mysql.dll to the php.ini
extension_dir = "C:\php\ext"
session.save_path = "C:\WINDOWS\temp"
I have also added C:\php and C:\php\ext to my PATH system variable (tried adding it at the beginning AND at the end of the existing value).
I know I'm editing the correct php.ini file because I tested by changing the register_globals variable, restarting Apache and viewing info.php.
Here is what my Apache error log says:
[Sat Apr 16 10:39:10 2011] [notice] Parent: Received restart signal -- Restarting the server.
[Sat Apr 16 10:39:10 2011] [notice] Child 3084: Exit event signaled. Child process is ending.
PHP Warning: PHP Startup: Unable to load dynamic library 'C:\\php\\ext\\php_mysql.dll' - The specified module could not be found.\r\n in Unknown on line 0
[Sat Apr 16 10:39:11 2011] [notice] Apache/2.2.17 (Win32) PHP/5.2.17 configured -- resuming normal operations
[Sat Apr 16 10:39:11 2011] [notice] Server built: Oct 18 2010 01:58:12
[Sat Apr 16 10:39:11 2011] [notice] Parent: Created child process 6612
PHP Warning: PHP Startup: Unable to load dynamic library 'C:\\php\\ext\\php_mysql.dll' - The specified module could not be found.\r\n in Unknown on line 0
<br />
<b>Warning</b>: PHP Startup: Unable to load dynamic library 'C:\php\ext\php_mysql.dll' - The specified module could not be found.
in <b>Unknown</b> on line <b>0</b><br />
[Sat Apr 16 10:39:11 2011] [notice] Child 6612: Child process is running
[Sat Apr 16 10:39:11 2011] [notice] Child 6612: Acquired the start mutex.
[Sat Apr 16 10:39:11 2011] [notice] Child 3084: Released the start mutex
[Sat Apr 16 10:39:11 2011] [notice] Child 6612: Starting 64 worker threads.
[Sat Apr 16 10:39:12 2011] [notice] Child 3084: All worker threads have exited.
[Sat Apr 16 10:39:12 2011] [notice] Child 3084: Child process is exiting
[Sat Apr 16 10:39:13 2011] [notice] Child 6612: Starting thread to listen on port 8080.
[Sat Apr 16 10:39:18 2011] [error] [client 127.0.0.1] PHP Fatal error: Call to undefined function mysql_connect() in C:\\Apache\\htdocs\\mysql_test.php on line 9
I've read loads of posts, and tried many solutions but I still can't get rid of that error. By the way, here is the page I'm trying to load:
<?php
# Define MySQL Settings
define("MYSQL_HOST", "localhost");
define("MYSQL_USER", "root");
define("MYSQL_PASS", "password");
define("MYSQL_DB", "test");
$conn = mysql_connect("".MYSQL_HOST."", "".MYSQL_USER."", "".MYSQL_PASS."") or die(mysql_error());
mysql_select_db("".MYSQL_DB."",$conn) or die(mysql_error());
$sql = "SELECT * FROM test";
$res = mysql_query($sql);
while ($field = mysql_fetch_array($res))
{
$id = $field['id'];
$name = $field['name'];
echo 'ID: ' . $field['id'] . '<br />';
echo 'Name: ' . $field['name'] . '<br /><br />';
}
?>
Grateful any help!
Cheers
Sean