index.html Does Not Open!

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
rugved
Forum Newbie
Posts: 23
Joined: Tue Dec 03, 2013 12:33 am
Location: Cyber World

index.html Does Not Open!

Post by rugved »

Hello!

I am a rookie in PHP and have just started learning this technology a couple of days ago.

I have created As one of my first exercises, I have created a PHP website project in Dreamweaver CS6 which contains two pages, index.html and Awards.php. The index.html page is a simple html page which contains a simple <a href> link to Awards.php However when I run the index.html page (by clicking on "P. review in IExplore"), I don't see the link to the Awards.php page. Instead I see a page with the text, "It works!" in <h1> size heading. My PHP web project only contains these two pages (index.html and Awards.php) and I haven't created any such HTML page with the "It works!" message in my project.

Can anyone please tell me why exactly is this happening? Replies at the earliest will be highly appreciated. Thank you in advance.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: index.html Does Not Open!

Post by Celauran »

That's the default Apache index.html. Sounds like your documents are outside of the document root and/or you have not correctly configured your virtual host.
tiger0
Forum Newbie
Posts: 16
Joined: Mon Oct 28, 2013 12:19 am

Re: index.html Does Not Open!

Post by tiger0 »

I'd suggested that since it's a link attribute, it should work without the Apache server. So just try to open the file from its original folder (for example, desktop), if you see the link then your work is fine, otherwise I'd check the link tag to make sure the syntax is correct

Code: Select all

<a href=""></a>
User avatar
rugved
Forum Newbie
Posts: 23
Joined: Tue Dec 03, 2013 12:33 am
Location: Cyber World

Re: index.html Does Not Open!

Post by rugved »

Celauran wrote:That's the default Apache index.html. Sounds like your documents are outside of the document root and/or you have not correctly configured your virtual host.
Thank you very much for replying. :)

Could you exactly tell me what do you mean by "documents are outside of the document root"? I have created a PHP website project using Dreamweaver CS6 and have placed the documents on my local hard drive (C:\Users\<My username>\Documents\Dreamweaver CS6\<My Project name>) folder using this IDE. As far as I know, I don't think the problem exists with my virtual server host as I have installed XAMPP, created demo PHP projects using Aptana Studio 3 IDE, tested and run them successfully using Apache server and have got the desired output in the browser.
Eric!
DevNet Resident
Posts: 1146
Joined: Sun Jun 14, 2009 3:13 pm

Re: index.html Does Not Open!

Post by Eric! »

Celauran means that your "It Works!" page is coming up because Apache's document root is set to look in a different directory. I'm not familar with XAMPP or window's default setups, but I would guess you might find the document root in something like c:\xampp\htdocs where you'll find the "It Works!" example page.

You have two choices, move your files to this location.

Or reconfigure Apache to point to your desired directory. I think in windows you can find the httpd configuration file in
c:\XAMPP\apache\conf\httpd.conf

In there you'll see something like
[text] DocumentRoot C:/xampp/htdocs/
<Directory />
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>[/text]

Change the DocumentRoot location to your desired spot and RESTART apache.
User avatar
rugved
Forum Newbie
Posts: 23
Joined: Tue Dec 03, 2013 12:33 am
Location: Cyber World

Re: index.html Does Not Open!

Post by rugved »

Eric! wrote:Celauran means that your "It Works!" page is coming up because Apache's document root is set to look in a different directory. I'm not familar with XAMPP or window's default setups, but I would guess you might find the document root in something like c:\xampp\htdocs where you'll find the "It Works!" example page.

You have two choices, move your files to this location.

Or reconfigure Apache to point to your desired directory. I think in windows you can find the httpd configuration file in
c:\XAMPP\apache\conf\httpd.conf

In there you'll see something like
[text] DocumentRoot C:/xampp/htdocs/
<Directory />
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>[/text]

Change the DocumentRoot location to your desired spot and RESTART apache.
Bingo! :D The problem lied in the root path of Apache XAMPP. I moved my project folder in C:\xampp\htdocs\ and now it's now working perfectly.

The problem was that since I am a rookie in PHP, I was referring to online tutorials that taught how to create PHP website projects by installing other packages (WAMP/MAMP/...) and/or a different server (IIS/Tomcat) and/or other IDE (NetBeans/Eclipse/Aptana Studio/...) and/or OSs (Linux/Mac) whereas I had installed XAMPP for my Windows 8 machine, as mentioned in my first post. Just can't thank all of you enough for your help. You guys are great! Cheers. :)

I also wish to add something for other rookie PHP developers, who will visit this forum for help when they face a similar problem, and have the same configuration environment installed on their machines (Windows OS, XAMPP, Apache and Dreamviewer CS6). For an environment as similar as mine, I recommend you to follow this series of tutorials: http://www.adobe.com/devnet/dreamweaver ... p_php.html
Post Reply