Solved

Apache PHP Not Loading Outside of Localhost

Posted on 2013-11-19
10
483 Views
Last Modified: 2013-11-25
I have an apache 2.2 webserver running on a windows machine. The php files load correctly from localhost without any issue. When trying to load the same site on a machine on the LAN it does not load. Non PHP files load without any issues.

Any ideas?

Thanks
0
Comment
Question by:fred2k3
  • 5
  • 5
10 Comments
 
LVL 43

Expert Comment

by:Chris Stanyon
ID: 39659742
How are you loading the pages (are you calling them with a URL - if so, what is it). Is your DNS setup correctly (HOSTS file on Windows)

You can open any HTML file in any browser and it will work, but that doesn't mean the server is 'serving' it. PHP has to be served by a server - you can't just open your files and expect them to work.
0
 

Author Comment

by:fred2k3
ID: 39659769
We are loading the pages using a web browser by referring to the machines local IP address. E.g. http://10.0.0.10/index.php
0
 
LVL 43

Expert Comment

by:Chris Stanyon
ID: 39659816
OK. You say it doesn't load - what do you mean? Does it time out / do you get an error etc.

Do you have a firewall in place / if so, have you opened up port 80?

If you call http://10.0.0.10/index.html you say it works fine, but not if you change the filename to index.php
0
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 

Author Comment

by:fred2k3
ID: 39660013
Thanks Chris,

Yes, the page (on IE) times out with "This page can't be displayed".

There are no firewalls on the machine running apache.

Calling index.html works fine without any issue.
0
 
LVL 43

Expert Comment

by:Chris Stanyon
ID: 39660049
Hmmmm. All the obvious stuff seems to be checked. If you simply rename your index.html file to index.php does it still hang. (i.e it hangs on a php file even if they is no PHP in it?)

Try a simple PHP file containing something very basic:

<?php echo "PHP File"; ?>

What happens if you call http://10.0.0.10/index.php on the server itself.
0
 

Author Comment

by:fred2k3
ID: 39660083
Unfortunately it still doesnt work when using a basic file.

When calling http://10.0.0.10/index.php on the server itself, it redirects to http://127.0.0.01/index.php and loads?
0
 
LVL 43

Expert Comment

by:Chris Stanyon
ID: 39660104
Right - it shouldn't redirect - it should just load the page from 10.0.0.10

Maybe that's where the problem lies. If you call 10.0.0.10 on a remote computer and it tries to redirect to 127.0.0.1 then it'll never get served. Now just to figure out what's causing the redirect.

Do you have any .htaccess files in your folder? If you do, remove them.

Maybe time to have a look at your http.conf file - particularly the virtual hosts section as well, to make that's configured correctly.
0
 

Author Comment

by:fred2k3
ID: 39660194
Thanks, yes we do have htaccess files in your folder - they are there by default for the Magento installation. Removing them didnt resolve the issue.

I couldnt see a section about virtual hosts in the http.conf, only comments about it. We havent altered the file, so it out of the box so to speak. Any section i should look at?
0
 
LVL 43

Accepted Solution

by:
Chris Stanyon earned 500 total points
ID: 39660250
Ahhhh right!

Magento is a complex system and is configured to run on a specific server. The base_url of your installation is stored in the database (in the core_config_data table). I'm guessing you have yours set up to be 127.0.0.1 and not 10.0.0.10!! If you want to access your Magento app over your network then you can't use 127.0.0.1

As for your virtual hosts, it may be in a different file. Look for a line like this:

Include conf/extra/httpd-vhosts.conf

If it's not commented out (i.e it doesn't start with a semi-colon) then that's the file that contains details of your virtual hosts.

If you want to do simple tests, then you will need to remove all the files related to magento from your folder (including htaccess!!). Once done, put a simple file in there and try and access it.

A better setup wold be to use 'named virtual hosts' - that's more complicated but would allow you to serve several different websites from the same server.
0
 

Author Closing Comment

by:fred2k3
ID: 39676474
Many thanks for your help.
0

Featured Post

Create the perfect environment for any meeting

You might have a modern environment with all sorts of high-tech equipment, but what makes it worthwhile is how you seamlessly bring together the presentation with audio, video and lighting. The ATEN Control System provides integrated control and system automation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question