Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP

Apache2 on Debian Linux

Hi,

I hope someone here has experience with Linux.

It appears though Apache is installed correctly. When I enter localhost in the browser URL bar I get a page that says:

Apache2 Debian Default Page
It works!
This is the default welcome page used to test the correct operation of the Apache2 server after installation on Debian systems. If you can read this page, it means that the Apache HTTP server installed at this site is working properly. You should replace this file (located at /var/www/html/index.html) before continuing to operate your HTTP server.

If I enter localhost//home/jeff/Websites/Rosebusch/jeff/Web_Testing/PHP/PHP-net/phpinfo.php (or any variation: localhost:// etc.) I get the message: Not Found The requested URL /home/jeff/Websites/Rosebusch/jeff/Web_Testing/PHP/PHP-net/phpinfo.php was not found on this server.

Now if I enter http://rosebusch.net/jeff/Web_Testing/PHP/PHP-net/phpinfo.php, which is my website at Godaddy, I get a page with the info for the PHP version on the server. Obviously the Apache server at Godaddy can find my php files nested in the directories. Do I need to supply a path in a config file?

Thanks, Jeff

The browser can't even find: /var/www/info.php at localhost//info.php. The content of the file is as follows: <?php phpinfo(); ?>

Did you installed PHP or just Apache?

3 Answers

Actually, none of you are correct. Just kidding, your'e all kinda correct. The directory on my system turned out to be /var/www/html/. If I put my .php files there everything seems to work. Now I have to figure out how to point Apache to my local website files, like a real website. I tried some symlinks in /var/www/html/ and restarting Apache but that still didn't work. Another day.

Thanks All, Jeff

You can use a Virtual Host, check the link:

Hosting multiple website with Apache2

I hope that helps.

Hi Jeff, i think i can help you with this. It seems that the files are stored in your home directory. Apache2 by default on Debian stores all the html and scripts documents under /var/www. If you want to use your home directory for serving pages, you will need to configure a Virtual Host. But for now, just copy the folder Websites to /var/www and visit the local page again.

Jim Hoskins
Jim Hoskins
Treehouse Guest Teacher

Juan Jose Cortes Guzman is correct here. When configuring Apache, you need to tell it where to find your files for your site. By default (on Debian/Ubuntu packages) the default place Apache looks for sites is in /var/www. So if you put hello.html in /var/www/hello.html then visiting http://localhost/hello.html would serve your page.

The reason you can't just do localhost/home/jeff/Websites/... is that would require your web directory to be the root of your filesystem "/". While technically possible, it would be an awful way to configure, as it would make your entire computer available to the internet.

Hi Juan,

Looks good, I'll take a better look tomorrow. I hope it's still relevant, I noticed the article is dated 2006.

Thanks, Jeff