Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have created a php script and saved it as script.php, located in the /var/www directory. I also have index.html file which has a form which requires the user to enter a value and submit with the code

<html><body><form action="script.php" method="post">
name<input type="text name="fname"">
<input type="submit">
</form>
</body></html>

for testing purposes, i have set my script.php file to be like

<?php
echo "Could not read name";
?>

When i enter the url on the browser, i get the form and on clicking submit, it responds by saying the url http://localhost/script.php was not found. i would like to know the reason why this is so. The question extends to why i can run the php script on its own when i move it from /var/www to home folder and run it as php -f script.php yet when i paste the url http://localhost/script.php , it reports that the url has not been found

share|improve this question
    
check the error log in /var/log/apache2 –  Gerald Schneider Sep 2 '13 at 13:34
1  
@GeraldSchneider what should i check for –  sosytee Sep 2 '13 at 13:35
1  
anything related to "script.php" –  Gerald Schneider Sep 2 '13 at 13:36
add comment

1 Answer 1

up vote 1 down vote accepted

Hi this what I have done and I have got success with your Idea.

here this is what I have done ,

script.php

<html>
<body>
<?php
echo " welcome "

?>
</body>
</html>

clickhere.html

<html><body><form action="script.php" method="post">
name<input type="text name="fname"">
<input type="submit">
</form>
</body></html>

I have placed that code with sudo gedit and written that code and saved at the location of /var/www/.

Then I have opened my browser ,and typed in my browser as 127.0.0.1/clickhere.html

then I have got it enter image description here

and then I have clicked at that button enter image description here

share|improve this answer
    
I am using Ubuntu server, sorry i did not clarify, therefore i have used vi editor, does that create a problem –  sosytee Sep 2 '13 at 13:56
    
No editor is not at all a problem.give a try with chmod 755 /var/www/script.php and chmod 755 /var/www/clickhere.html and then try again. –  AgentCool Sep 2 '13 at 13:58
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.