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

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

Related

Why my localhost is unable to recognize my htdocs in its directory?

I have a problem with my XAMPP server after uninstalling an old version for a new one. I have a problem with executing PHP codes because when I put "localhost/file.php" it says "Object not found" or put the PHP document despite having the Apache server on.
When I access the XAMPP directory from localhost, it's completely empty despite I stored the site in the htdocs folder. And if you ask, the xampp folder's location is C:/xampp/. And I did put an .htaccess file in my file's directory.
Here's a screenshot:
xampp -> apache -> config -> apache(httpd.conf) and search DocumentRoot and Directory.
see there what link is set.
Giving localhost in the browser address bar refers to htdocs folder.
As we can see the address as localhost/xampp i.e you are refering to htdocs/xampp
if you have stored your file in htdocs root folder, then give the address as localhost

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.

PHP localhost issue. Folder not opening when clicked inside 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 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

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

Yii "framework" sub-folder not visible from apache? [error 403]

I'm having quite a weird problem here.
I have just pasted the Yii folder into my htdocs folders and, for some reason, apache can't see one specific folder within the Yii folder, which is called "framework". I.e., when I type http://localhost/yii , apache correctly lists all sub-folder within the Yii folder except for the "framework" folder!
When I try to call this folder directly from the browser (i.e. writing http://localhost/yii/framework) I get a 403 Access forbidden error.
I'm at a loss here, why isn't apache listing one single folder? The folder which it cannot see is no different from the ones it can see.. I've even removed the read-only attribute from all folders within htdocs but to no avail.
P.S.: my OS is windows Vista sp2
I'm not sure why you are even trying to view the framework folder directly. It does have an .htaccess file in it which says "deny from all". Just make sure you have the correct path for the "yii.php" file inside the framework folder set in the index.php file in your web root.
PHP can include files that are inside "deny from all" folders but you can't browse them directly via a web browser.
Try working through one of tutorials from the start:
http://www.yiiframework.com/doc/guide/1.1/en/quickstart.first-app
http://www.larryullman.com/series/learning-the-yii-framework/

Categories