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
/var/log/apache2