Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Apache PHP Not Loading Outside of Localhost

Posted on 2013-11-19
10
Medium Priority
?
506 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 44

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 44

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
Connect further...control easier

With the ATEN CE624, you can now enjoy a high-quality visual experience powered by HDBaseT technology and the convenience of a single Cat6 cable to transmit uncompressed video with zero latency and multi-streaming for dual-view applications where remote access is required.

 

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 44

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 44

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 44

Accepted Solution

by:
Chris Stanyon earned 2000 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

722 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