Discussion:
[PHP-INSTALL] problem with php/mysql installation
Satish
2011-03-23 08:06:53 UTC
Permalink
Hi

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
Philipp Schuler
2011-05-31 15:07:10 UTC
Permalink
Post by Satish
Hi
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.
....
When I try to run this script http://localhost/mysql_test, it dumps me
 The webpage at http://localhost/mysql_test.php might be temporarily
down or it may have moved permanently to a new web address
Regards,
dbS
I think your test script is in the wrong place/folder and apache doesnt
even find it.

You have to put it in the webroot folder or subfolder.

Or you can add a vhost to apache configuration + an entry to your
systems hosts file. Thereby you can set any folder on your pc as
another webroot

Loading...