PHP localhost issue. Folder not opening when clicked inside localhost - php

I just installed WAMP server to start practicing PHP. I created a folder in www directory. However, when I try to run the file from localhost it does not run.
For ex, I created a folder "test" in www directory. I saved an HTML file called "test.html" inside the test folder. Basically I have saved it in www --> test --> test.html.
I started localhost in my browser. I found test folder there. But when I click that test folder, instead of opening as "localhost/test", it is opening as just "test/". How to make sure that the folder, when clicked inside localhost, should open as "localhost/<foldername" (in this case "localhost/test").
When I type as "localhost/test" in my browser, it works fine. But when I go to localhost and click on "test" folder it does not open.
Please help me to overcome this.
Thanks in advance.

You should type the file name and the extension to open the file from the local host as your file is not index.html
so you should go to "localhost/test/test.html" that would work
if you want your file to

Related

How to run a php project in localhost using XAMPP?

First of all, I'm using Kali Linux. I have a project, it's a folder with .php files. I want to run it to see it on the browser, so it needs to be localhost. Folder name is "CMSsite". I moved the folder to /opt/lampp/htdocs folder to access it through typing on the browser localhost/CMSsite. When I open the browser and type localhost/CMSsite/ I see the message "The requested URL was not found on the server"
enter image description here
How can I solve this problem?

Not opening folder in localhost

I just installed WAMP server to start practicing PHP. I created a folder in www directory. However, when I try to run the file from localhost it does not run.
For ex, I created a folder "test" in www directory. I saved an php file called "test.php" inside the test folder. Basically I have saved it in www --> test --> test.php.
I started localhost in my browser. I found test folder there. But when I click that test folder, instead of opening as "localhost/test", it is opening as just "test/". How to make sure that the folder, when clicked inside localhost, should open as "localhost/
When I type as "localhost/test" in my browser, it works fine. But when I go to localhost and click on "test" folder it does not open.
Please help me to overcome this.
Thanks in advance
Just create new virtual host in wamp using your current directory path to test directory.

localhost does not render website, only index of, using mamp

Using mamp, I have my document root set to htdocs folder. Inside that folder I have the folder with the contents for the site. When I connect to localhost, the page that renders is "Index of /" and then a bullet point with the name of the folder within htdocs.
How can I get the full page to render? What am I doing wrong?
A request to localhost looks for files in the htdocs folder. If it doesn't find an index file (html,php,etc) it displays all the folders in the directory. If your website lives at htdocs/mywebsite then you need can view the website at localhost/mywebsite.
Otherwise you can move the entire contents of mywebsite into the htdocs folder itself.
it sounds to me that you have put your files in a folder in the htdocs
so to access you need to point your browser to the folder
instead of localhost/mywebsite
you would need to type localhost/mywebsite/thenameofyourfolder
In MAMP preferences, have you set the root folder to the folder you are attempting to serve?
Ensure your httpd and hosts files are configured correctly too!
nano /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf

Browser shows 404 Resource not found error even after pasting php file in htdocs folder in xampp folder

I have installed xampp and configured the browser to listen to port 8000.I saved the file using a .php extension selecting the all files option while saving and saved it in the htdocs folder.Still when I use localhost\mypage.php it shows the resource not found error.
Copied the code into notepad and placed the file in htdocs folder and opened it in netbeans and it was working fine.

xampp is not showing .php files saved in htdocs folder

I am using windows 7 and just installed xampp server to "E:\xampp" in my laptop to learn php. Now the problem is whenever I start xampp server by starting "xampp_start" in xampp folder and start Apache and MySQL from "xampp-control" and type localhost in my browser it automatically gets converted into "localhost/xampp/" and display a default page instead of displaying the .php file which I created in htdocs folder. Another problem is when I created a folder in htdocs folder and saved a index.php and another .php file which was created by me, it is not showing that folder too. I know this question has been asked before but I didn't get any solution from there because I started xampp_start from xampp folder and Apache & MySQL from xampp-control. So please help. Thanks in advance.
This is the default picture which is being displayed:
Thing is if you create any .php file in htdocs folder, you have to run that file as "localhost/filename.php" but if you created any folder in htdocs, for example folder name is "work" then you have to type "localhost/work/" and then it will show file contained in that folder.
First copy the files of htdocs and paste on any drive and delete the htdocs folder then create another folder and paste the files in this folder and restart the server.
First make sure you go to Local Disk (C:), then go to xampp -> htdocs-> and create your folder.
Hi Guys Here Iam Gonna Show You How You Can Fix This Error
Follow me
Don't worry ! If xampp is not showing .php files in htdoc/folder OK:
Just change the name of that file which is not showing and refresh or reopen the localhost directory it will-be show
Your file
If this method work or not comment below
Good luck and keep it up.
#gamerinc

Categories