Solved

Apache PHP Not Loading Outside of Localhost

Posted on 2013-11-19
10
496 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

This article discusses how to create an extensible mechanism for linked drop downs.
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.

617 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