Page 1 of 1

How can I run a page? [Solved]

PostPosted: 10. October 2012 02:02
by mendy
How can I run a simple html page with some php?

I already have the page and everything. Where can I find it?

Re: How can I run a page?

PostPosted: 10. October 2012 03:02
by JonB

Re: How can I run a page?

PostPosted: 10. October 2012 03:13
by mendy
Yeah so I set up a puplic_html and everything. I have my page, But the PHP doesn't show. I have <?PHP echo 'test' ?> Nothing shows?

Re: How can I run a page?

PostPosted: 10. October 2012 15:53
by Altrea
What did you type in your browsers address bar and where is the file saved?

Re: How can I run a page?

PostPosted: 16. November 2012 20:37
by PaulRuth2009
Jumping in as I have the same question.
Saved the frontpage.html file in /opt/lampp/web and typed http://localhost/opt/lampp/web/frontpage.html into the browser.
The error I get is:
Object not found!

The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.

If you think this is a server error, please contact the webmaster.
Error 404
localhost
Apache/2.4.3 (Unix) OpenSSL/1.0.1c PHP/5.4.7

Help!

Re: How can I run a page?

PostPosted: 18. November 2012 15:56
by JonB
Probably because you should be putting the files under 'htdocs', unless you created an Alias or changed the DocumentRoot in httpd.conf

Good Luck
:)


ysf

Re: How can I run a page?

PostPosted: 19. November 2012 20:16
by PaulRuth2009
I double-checked the httpd.conf file, and /opt/lampp/htdocs is the DocumentRoot. I moved the files I'm trying to run over to that directory as well. Still no luck.
Thanks for your help,
Ruth

Re: How can I run a page?

PostPosted: 19. November 2012 23:20
by JonB
A. what are the exact filenames and URL's you are using?

B: Did you change the ownership of the files to nobody:root? (as root via su or sudo)
chown -R nobody:root /opt/lampp/htdocs/your_folder_name

C: Are you still getting a 404 after you change the ownership?

:shock:

Re: How can I run a page?

PostPosted: 19. November 2012 23:57
by Nobbie
PaulRuth2009 wrote:Saved the frontpage.html file in /opt/lampp/web and typed http://localhost/opt/lampp/web/frontpage.html into the browser.


A "DocumentRoot" means, that this directory on your local PC is the Root Directory / from the view of your Apache server. That means, all documents in /opt/xampp/htdocs/ are mapped to the root of Apache, what results in http://localhost/ (and nothing more!).

If you have a file in your DocumentRoot like test.html, the full path on your local PC is /opt/lampp/htdocs/test.html - but from the view of Apache it is http://localhost/test.html

Finally, if you enter http://localhost/opt/lampp/htdocs/test.html, this yields to the local path /opt/lampp/htdocs/opt/lampp/htdocs/test.html - what is nonsense as you easily can see. That is the idea of having a DocumentRoot, that you do not have to enter the full local path, as the root already yields to /opt/lampp/htdocs

Re: How can I run a page?

PostPosted: 25. November 2012 03:48
by PaulRuth2009
Success!
Thank you thank you thank you...
Now I can get back to working on my final project...
Ruth
:D