webserver don't recognize .php
Posted by: joseph (60.50.175.---)
Date: January 22, 2006 07:10AM

Good day, i am a newbie in php. I have some problems regarding to php5, apache2 and mysql. For your information, after i install the wamp5, i have created one html file and one php file such as below:

<html>
<form action="b.php" method="post">
<p>Name<input name="box1" type="text" value="Default"></p>
<p>ID<input name="box2" type="text" value="0000"></p>
<input type=submit>
</form>
</html>\
------------------------------------------------------------------------
<?php
//echo '<p>=Data Detail=</p>';
//echo '<p>Name: '.$_POST['box1'].'</p>';
//echo '<p>ID: '.$_POST['box2'].'</p>';
$user="root";
$pass="sn00ker1";
$db="try";
$name=$_POST['box1'];
$id=$_POST['box2'];
mysql_connect(localhost,$user,$pass)
or die(mysql_error());
@mysql_select_db($db)
or die(mysql_error());
$query = "INSERT INTO tryin VALUES ('$name','$id')";
mysql_query($query);
mysql_close();
?>

I just want to test whether data can be inserted into mysql from web browser. But when i click the submit button, there will have one pop-up form asking me whether i want to open, save or cancel the b.php.
I got asked people what is the problems. People said it is because the web server didn't recognized the php file. They asked me to reinstall the wamp5. I have reinstalled so many times but the result is still the same. The webserver still didn't recognized php file.
Could anyone out there help me to figure out how to solve the problem.

Options: ReplyQuote
Re: webserver don't recognize .php
Posted by: Joe (---.ppp.onetel.net.uk)
Date: January 22, 2006 10:40AM

Hi,

First thing, you might want to take your password out of the $pass variable. Second, are you sure it's going in your WWW directory? And are you sure WAMP5 is actually turned on (it looks like a white semicircle in your task bar. If it is any other colour, let us know).

Hope that helps,

Joe

Options: ReplyQuote
Re: webserver don't recognize .php
Posted by: joseph (210.186.209.---)
Date: January 22, 2006 01:23PM

For the 'are you sure it's going in your WWW directory?' statement, is it meaning that there are some settings that need to be configured in order the apache to reach the (html , php) file or just for the file to be stored at www directory? (I have confirmed all .htm and .php file are stored at www directory). I also have the wamp5 turned on (all services running). After removing the "sn00ker1", i clicked the submit button but i still get the same pop-up form asking me to open/save/cancel.

I would like to ask...is there any setting that need to change/add after installing wamp5?
For example, adding 'libmysql.dll' , 'php5apache2.dll' , 'php_mysql.dll' , ' libmysqli.dll' , 'php5ts.dll' into win/system32. or adding
(AddType application/x-httpd-php .php)
(AddType application/x-httpd-php-source .phps)
(LoadModule php5_module "c:/php/php5apache2.dll"winking smiley
(SetEnv PHPRC d:/wamp/php)
(AddType application/x-httpd-php .htm) at the bottom of httpd.conf.

Please help me to solve the problem.

Options: ReplyQuote
Re: webserver don't recognize .php
Posted by: Joe (---.ppp.onetel.net.uk)
Date: January 22, 2006 04:54PM

I don't think you can edit your own threads on this - sorry! As for the WWW thing, it should already be configured:

1) Download WAMP5
2) Run the installer
3) Place files in your www directory to begin

It should work like that. Did you change any of the files after you installed it (by files I mean httpd.conf, etc.)?

Oh, and when you ran the installer, I _think_ it asks you where your default directory should be. What did you choose then? The PHP files should be going in there.

Options: ReplyQuote
Re: webserver don't recognize .php
Posted by: hiung (60.50.167.---)
Date: January 22, 2006 07:38PM

-uninstall wamp5, delete folder wamp, delete all 5 dll in system32, restart computer.
-put 5 dll in windows/system32, install wamp5, check the checkbox "auto start", without setting mysql pswd, create db, clicked "install service" for both mysql and apache, changed <? to <?php, changed "sn00ker1" to "", test=>worked.
-uninstall wamp5, delete folder wamp, delete all dll, restart computer.
-install wamp. check the checkbox "auto start", without setting mysql pswd, create db, changed <? to <?php, changed "sn00ker1" to "", test=>worked.
-set mysql password to "sn00ker1", change coding "" to "sn00ker1", test=>worked.
-uninstall wamp5, delete folder wamp, restart computer.
-install wamp5, dont check the checkbox "auto start", without setting mysql password, create db, test=>worked.

now i'm confused again... what a trial and error.

Options: ReplyQuote
Re: webserver don't recognize .php
Posted by: Kyrin (---.houston.res.rr.com)
Date: January 23, 2006 06:28AM

Your Coding is wrong also.

<?php
//echo '<p>=Data Detail=</p>';
//echo '<p>Name: '.$_POST['box1'].'</p>';
//echo '<p>ID: '.$_POST['box2'].'</p>';
$user="root";
$pass="sn00ker1";
$db="try";
$name=$_POST['box1'];
$id=$_POST['box2'];
mysql_connect(localhost,$user,$pass)
or die(mysql_error());
@mysql_select_db($db)
or die(mysql_error());
$query = "INSERT INTO tryin VALUES ('$name','$id')";
mysql_query($query);
mysql_close();
?>

try this

<?php
/******************************
* process.php
*
*******************************/
require("config.php"winking smiley;

print("<p>Data Detail</p>
<p>Name: '$_POST['box1']</p>
<p>ID: '$_POST['box2']</p>"winking smiley;
$name = $_POST['box1'];
$id = $_POST['box2'];

$q = "INSET INTO tryin VALUES ('$name', '$id')";
mysql_query($q);
?>

<?php
/**************************************
* config.php
*
*
***************************************/
$host = '';
$user = '';
$pass = '';
$db = '';

$connect = mysql_connect($host, $user, $pass) or die(mysql_error());
mysql_select_db($db, $connect) or die(mysql_error());

?>


Options: ReplyQuote
Re: webserver don't recognize .php
Posted by: Henriette (---.elisa-laajakaista.fi)
Date: January 23, 2006 03:48PM

... did you call the form as [localhost]...? If you didn't, you didn't use apache.

Options: ReplyQuote
Re: webserver don't recognize .php
Posted by: joseph (210.186.209.---)
Date: January 23, 2006 04:06PM

I have solved the problem.....there are some extensions file missing during the installation of wamp5. After i installed those extensions file manually, everything works perfect.

Thanks for your suggestions....

Options: ReplyQuote
Re: webserver don't recognize .php
Posted by: Xajel (193.188.105.---)
Date: January 23, 2006 04:13PM

another vote for Henritte note.. You MUST accesss you www folder by using [localhost] not the normal C:\wamp\www path

and another vote for Kyrin your code has some mistakes. but even the Kyrin's correction has some mistakes I think, as he must remove the single quote ( ' ) located just before the $_POST arrays... I don't know if there's other mistakes or even this was not a mistake as I didn't read all the code...

Options: ReplyQuote
Re: webserver don't recognize .php
Posted by: Kyrin (---.houston.res.rr.com)
Date: January 23, 2006 09:20PM

yeah it had a mistake i put ' and it don't need to be there

Options: ReplyQuote


Sorry, only registered users may post in this forum.