Apache Windows 10 ,404 Not Found Error (Wamp) - php

I've installed php, mysql, apache with WAMP for windows 10. When I go to http://localhost there is not any problem, the appropriate page is shown. The server is up and running, but when I try to open http://localhost/test.php it gives me 404 not found error. By the way I've put the index.html and test.php into wamp64/bin/apache/apache2.4.46/htdocs. The server can access neither index.html in that directory nor test.php. Your help is welcome.

Like #Selim Achour said I looked to the error logs and I found that apache server wasp/ searching the test.php in a folder called wamp/www/test.php. When I move the test.php from htdocs/test.php to www/test.php it works perfectly. I was following instructions from a book that I'd been reading. In that book's instructions, it is clearly stated that you should move test.php into htdocs. That was what got me confused. Thank you all for your effort.
The error: Sat Sep 26 13:14:03.134587 2020] [php7:error] [pid 8220:tid 1204] [client ::1:6466] script 'C:/wamp64/www/test.php' not found or unable to stat

WAMPServer's DocumentRoot folder is C:\wamp64\www BUT You should NEVER place your scripts into that folder!!!
Make a subfolder and use that i.e. C:\wamp\www\test1 put your test.php in there and run using locahost/test1/test.php
Better still create a Virtual Host for all your test areas and development site folders. See THE NEED for VIRTUAL HOSTS and then WAMPServer 3 Create a Virtual Host, the easy way

Related

403 - Forbidden: Trying to get WordPress to Run on AWS

I am trying to get WordPress running on AWS, and I keep getting the following error.
403 - Forbidden:
You don't have permission to access / on this server.
I have installed PHP on the server, used Filezilla to add the files to AWS, and have gotten Apache to reference the proper location.
In terminal, I am getting this issue:
[Mon May 04 17:39:59.709131 2015] [authz_core:error] [pid 9239] [client 000.000.000.00:2935] AH01630: client denied by server configuration: /home/ubuntu/www/
I realize there are a lot of problems this could be caused by, but I'm wondering what it could potentially be because I have exhausted the options I am aware of.
I was getting a similar issue on a Beanstalk Wordpress. Following the AWS tutorial it would appear that your site would be accessible through the Elastic Beanstalk URL, but you had to add the full path [your Elastic Beanstalk URL]/wordpress-elasticbeanstalk.
Wordpress was accessible there. So maybe playing with copying your files to other location and trying to access that location.

Cant see or access Laravel's public folder

On Fedora 20 I created a folder named test then installed Laravel via composer create-project laravel/laravel into it. It ran successfully and now I try to view it in FireFox in the following URL:
http://localhost/~username/test/laravel/public/
But it throws the following error:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator at root#localhost to inform them of the time this error occurred, and the actions you performed just before this error.
More information about this error may be available in the server error log.
If I go to the parent folder, I can see that everything is there except the public folder. However if I ls in the terminal I can see that the folder is right over there. There is no problem with other PHP scripts only with this project. I tried to play with folder permission but no success. Why can't I see the folder in the browser and why does it throws an Error 500 when I try to access it?
Debugging
After I looked at /var/log/httpd/error_log I saw the following in the last line:
[Tue May 20 09:37:21.874443 2014] [core:alert] [pid 2897] [client ::1:55498]
/home/username/public_html/test/laravel/public/.htaccess:
Options not allowed here, referer: http://localhost/~username/test/
Make things work
So in my public folder I renamed the .htaccess file to .htaccess2 and now it works. Of course now I need to write index.php after public/ in the URL but at least it works. This also solved the invisible folder error, so if I go to the project root (the parent folder of public) in the browser it lists the public folder too.
Try to fix it
According to this answer configurations in the httpd.conf file can be overwritten by other extra files. You should search these files for a line containing AllowOverride like AllowOverride AuthConfig FileInfo and replace it with AllowOverride All.

Local host, apache, and Macintosh

Server/port noob here. I just downloaded the latest Apache for my Mac OS X Lion. When I type in http: //localhost/ (no space), it comes up with a web page that says "It works." However, I can't get any other web page to open. I'm trying to get it to read a PHP document for a mobile web application, but it keeps 404ing and saying the document doesn't exist (the only document it has read thus far is the index.html document that says "It works"). I have tried things like http: //local host/User/directoryofthemobileapp/index.php, and all sorts of things like that, then I tried dropping a copy of the mobile app into the folder with the "It works" html doc, and it still failed to recognize it. The path of the "It works" doc is /Library/WebServer/Documents/index.html.en, but this information hasn't helped me yet. I have tried a lot of different URLs to access documents on my Mac, but to no avail.
Thanks in advance! Help is appreciated!
change the contents of index.html.en
put this in it
<?php
phpinfo();
?>
if that works, it should tell you that php is indeed setup correctly and where all your directories are
If you're looking to do some PHP development I recommend setting yourself up with what's known as a MAMP Stack. It stands for Mac, Apache, PHP, MySQL.
There's a great (free) program here that lets you set it all up easily:
http://www.mamp.info/en/index.html
From MAMP's easy interface you can set the Apache document root manually to any location on your Mac so you can start serving files locally.
Once you feel a bit more comfortable with the configuration and the server side technologies, I can't recommend Vagrant enough (http://www.vagrantup.com). It allows you to set up and provision virtual servers. I do all of my PHP development on a LAMP stack and I have total control. It's a great learning experience. Using a provisioning tool like Puppet and Chef you can deploy your development environment on any machine.
The default document root for apache on Mac OSX (Lion + atleast) is
/Library/WebServer/Documents/
You will need to put your documents here to be able to access them from a browser or change the apache configuration to point the document root to the appropriate directory on your machine.
You must also make sure that the webserver has permission to read the files you are trying to serve over the internet. For example the following directory structure represents my Mac's /Library/WebServer/Documents/ directory:
-rw-r--r-- 1 root wheel 31958 Jun 20 2012 PoweredByMacOSXLarge.gif
-rw-r--r-- 1 root wheel 3726 Jun 20 2012 PoweredByMacOSX.gif
-rw-r--r-- 1 root wheel 44 Jul 31 13:53 index.html.en
-rw-r--r-- 1 root wheel 44 Jan 7 16:00 index.php
Since apache is running as Root on my machine (bad practice by the way, apache should not be running as a priveledged user, however my webserver is not exposed to the internet so there is little risk in my case) it can read all of the files in the directory, and when i point my browser to http:// localhost/index.php I see the contents of index.php:
<?php
echo '<h1>This also works</h1>';
?>

I'm not able to access localhost on my linux m/c running Apache/2.2.14 (Ubuntu)

Accessing http://localhost or http://127.0.0.1 gives me a 404 URL not found error. This is in spite of me having apache 2.2.14 running on my PC (the apache process is started). Any help in this regard will be appreciated. Thank you!
If you're getting a 404 not found it means that the server is running but can't find the document you're looking for.
If you look in your Apache config file you'll find a setting for "document root". Place a file called "index.html" in that directory.
This usually defaults to /var/www on Ubuntu.
For more info you can check the Ubuntu community site

PHP adding new .dll makes Apache server unable to start

I am trying to add an extension to my PHP. I have the file - libssh2.dll - in the appropriate directory (as listed in my php.ini file) and made sure the extension=libssh2.dll. I also copied the .dll file to system and system32 folders as other threads have suggested. When I try to start my Apache server I get the following windows error:
Apache HTTP Server has encountered a problem and needs to close. We are sorry for the inconvenience.
and Apache Monitor error:
The requested operation has failed!
I check the log to see this:
[Tue Jul 26 16:43:06 2011] [warn] pid file C:/Program Files/Apache/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
I have tried to go in this direction but am completely stumped at this point. Hoping someone out there can help me and so I can figure out what's wrong. Thanks in advance guys!
Cheers
I think that it is telling you that you need to remove just the previous pid file. Each time that you run apache a http.pid file is created in apache's bin folder. It contains the apache pid.
I solved it by upgrading to 5.3. Somehow with the same settings it automagically worked. Closing the issue now.

Categories