I am new to php and trying to setup my dev environment. I have followed the documentation to install WAMP but unable to get php work with mysql.
My env details are:
Operating system : Windows 7
PHP version: 5.2.17
Web server : Apache 2.2
MySQL 5.1.56
* Running PHP as Apache module
Problem Description: http://localhost/test.php [ <?php phpinfo(); ?> ] is correctly showing me php details in the html page. It also shows mySQL and mySqli in its tabular form.
I believe this conforms that php is set up properly.
To test mysql access from php, i am using following php script: ( I have created a database "test" from mysql command line)
<?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 />';
}
?>
When I try to run this script http://localhost/mysql_test, it dumps me to error page:
The webpage at http://localhost/mysql_test.php might be temporarily down or it may have moved permanently to a new web address
I confirmed that mysql is running as a service, apache is running as a service. In apache log here is what i see:
[Wed Mar 23 00:38:29 2011] [notice] Parent: child process exited with status 255 -- Restarting.
[Wed Mar 23 00:38:30 2011] [notice] Apache/2.2.17 (Win32) PHP/5.2.17 configured -- resuming normal operations
[Wed Mar 23 00:38:30 2011] [notice] Server built: Oct 18 2010 01:58:12
[Wed Mar 23 00:38:30 2011] [notice] Parent: Created child process 1620
[Wed Mar 23 00:38:31 2011] [notice] Child 1620: Child process is running
[Wed Mar 23 00:38:31 2011] [notice] Child 1620: Acquired the start mutex.
[Wed Mar 23 00:38:31 2011] [notice] Child 1620: Starting 64 worker threads.
[Wed Mar 23 00:38:31 2011] [notice] Child 1620: Starting thread to listen on port 80.
[Wed Mar 23 00:45:02 2011] [error] [client 127.0.0.1] File does not exist: C:/Apache/htdocs/favicon.ico
[Wed Mar 23 00:45:17 2011] [error] [client 127.0.0.1] File does not exist: C:/Apache/htdocs/favicon.ico
[Wed Mar 23 00:45:43 2011] [error] [client 127.0.0.1] File does not exist: C:/Apache/htdocs/favicon.ico
[Wed Mar 23 00:45:58 2011] [error] [client 127.0.0.1] File does not exist: C:/Apache/htdocs/favicon.ico
[Wed Mar 23 01:02:35 2011] [notice] Parent: child process exited with status 255 -- Restarting.
[Wed Mar 23 01:02:36 2011] [notice] Apache/2.2.17 (Win32) PHP/5.2.17 configured -- resuming normal operations
[Wed Mar 23 01:02:36 2011] [notice] Server built: Oct 18 2010 01:58:12
[Wed Mar 23 01:02:36 2011] [notice] Parent: Created child process 2432
[Wed Mar 23 01:02:37 2011] [notice] Child 2432: Child process is running
[Wed Mar 23 01:02:37 2011] [notice] Child 2432: Acquired the start mutex.
[Wed Mar 23 01:02:37 2011] [notice] Child 2432: Starting 64 worker threads.
[Wed Mar 23 01:02:37 2011] [notice] Child 2432: Starting thread to listen on port 80
I have been trying all possible solution to make this work, I will appreciate if you can guide me toward the right solution.
Regards,
dbS
- Follow-Ups:
- Re: problem with php/mysql installation
- From: Philipp Schuler
- Re: problem with php/mysql installation
- Prev by Date: Can't build PHP 5.3.6 with MySQL 5.5.10
- Next by Date: Solaris 10/Apache/PHP compile
- Previous by thread: Can't build PHP 5.3.6 with MySQL 5.5.10
- Next by thread: Re: problem with php/mysql installation
- Index(es):