Access XAMPP from my local network

There was a quite similar Q here years ago, but it's not getting me to where I need to go.

I have XAMPP 5.6.14 with Control Panel v3.2.1 on Windows 7 Enterprise here at work, and I have a demo to do for my boss on Friday.
I need to get this working on his desktop.  The network is open w/in our domain.

I have a fair amount of PHP and javascript in DIRs that I need to have accessed, but with the methods I've tried all I get is the HTML.
(Apparently.)

-- -- --

I modified apache config httpd-xampp.conf file's location match two ways, same result.
A)  I commented it all out, and
B) I commented out "Require local" and inserted (above "ErrorDocument 403 ..."),  "Allow from XX.YYY" where those are my higher bytes.

#
# New XAMPP security concept
#
<LocationMatch "^/(?i:(?:xampp|security|licenses|phpmyadmin|webalizer|server-status|server-info))">
#        Require local
         Allow from XX.YYY
	ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var

</LocationMatch>

Open in new window


I get the raw index.html to show, but no jQuery works to populate the DIVs.

I have the standard XAMPP install w/in C:/ DIR.

Thanks!
RalphAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dave BaldwinFixer of ProblemsCommented:
Since C:/DIR is not under the 'web root', you need to create an 'alias' to display it's contents.  Here's one I use.  You can insert this into your main 'conf' file or 'include' it from a separate file.
Alias /Pinc/ "c:/Pinc/" 

<Directory "c:/Pinc/">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride all
        Order allow,deny
    Allow from all
</Directory>

Open in new window

Dave BaldwinFixer of ProblemsCommented:
And you should probably restore your original version of httpd-xampp.conf because your changes have nothing to do with it.
RalphAuthor Commented:
Hi Dave,

Sorry, I don't quite follow  your suggestion.  Consider me not quite savvy enough please.

I've been accessing everything fine via
http://localhost/Cell_Modems/public_html, but when using my IP vs "localhost" I'm just getting the html.
http://10.139.164.191/Cell_Modems/public_html/
XAMPP has been in C:/ all along.

Your Pinc = ?
Put this alias definition where?     httpd-xampp.conf, or httpd.conf?

Thank you.
Become a CompTIA Certified Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

Dave BaldwinFixer of ProblemsCommented:
Never mind, I think I misunderstood what you were doing.  Forget the Alias.  And Always use the IP address for anything you want to be accessed remotely.  'localhost' has a number of limitations.

http://10.139.164.191/Cell_Modems/public_html/ should be showing the same thing as http://localhost/Cell_Modems/public_html .  ??

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
RalphAuthor Commented:
I made a simple PHP file containing:
<?php
echo "HELLO" ;
?>
<script type="text/javascript">
alert("Howdy!");
</script>

Open in new window

and if I access it via http://10.139.164.191/Cell_Modems/PHP/
it works!

But my index.html is bare bones.
<!DOCTYPE html>

<html>
  <head>
    <title>index page</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" type="text/css" href="http://localhost/Cell_Modems/CSS/PopulateTables.css">
    
    <script type="text/javascript" src="http://localhost/Cell_Modems/javascripts/script.js"></script>
    <script type="text/javascript" src="https://code.jquery.com/jquery-1.12.0.min.js"></script>
    
    <script type="text/javascript">
      $(document).ready(Main);
    </script>
    
    
  </head>
  <body>
    
    <div class="header-container">
      <div class="header"> 
        <div ID="AjaxSearches"></div>
        <div ID="AjaxResults"></div> 
        <a href="../PHP/parse_form.php">Test Me</a><br>
      </div>
    </div>
    
    <div class="content" >
      
      <div class="left" ID="left_margin"></div>
      <div class="center" ID="center_body"></div>
      <div class="right" ID="right_margin"></div>
      
    </div>  <!-- CONTENT -->
        
  </body>
</html>

Open in new window


Below C:\XAMPP\htdocs\Cell_Modems I have the following DIRs.
CSS, images, javascripts, PHP, public_html, and a couple others.

Looking at XAMPP's Apache access log it looks like it's accessing every page it needs, but I still get a bare bones page.
The error.log file has nothing timely/relevant in it.

Again, Thanks.
access.log
Dave BaldwinFixer of ProblemsCommented:
Get rid of 'http://localhost/' in those links.  When you access the site with an IP address, they will Not work.  The remote computer can not access 'localhost' on the web server.  'localhost' only works on the computer you're on.
RalphAuthor Commented:
Ahh, so in all my headers your saying.
Makes sense!

What's the best way then to keep it portable, since it won't ultimately be on my box?
A global change (via netbeans)?

Thanks!!!
Dave BaldwinFixer of ProblemsCommented:
I would make them 'relative' links like below.  They will work with whatever the address of the main page is.
<link rel="stylesheet" type="text/css" href="Cell_Modems/CSS/PopulateTables.css">
    
<script type="text/javascript" src="Cell_Modems/javascripts/script.js"></script>

Open in new window

RalphAuthor Commented:
Hi Dave,

The relative links like you suggested should work fine, but...
I'm using a lot of JQuery and it doesn't like the options I've tried.
e.g.: Trying this approach,
function Main() 
{
  
  $( "#left_margin ").load("Cell_Modems/public_html/MarginLeft/left_margin.html") ;
  $( "#center_body" ).load("Cell_Modems/public_html/view_forms/modem_config_and_activity_table.html") ;
  $( "#right_margin ").load("Cell_Modems/public_html/MarginRight/right_margin.html") ;
  
  $.ajaxPrefilter(function( options, originalOptions, jqXHR ) {
    options.async = true ;
});
}

Open in new window

Gives me (grabbing the middle browser log message):
Failed to load resource: the server responded with a status of 404 (Not Found) (10:10:12:073 | error, network)
  at http://localhost/Cell_Modems/public_html/Cell_Modems/public_html/view_forms/modem_config_and_activity_table.html

If I try substituting http://myIP/Cell_Modems/public_html/view_forms/modem_config_and_activity_table.html
I get a notice that it assumes I'm crossing domains, (at least that's how I interpret it.  It's definitely over my head at the moment.)
XMLHttpRequest cannot load http://10.139.164.191/Cell_Modems/public_html/MarginLeft/left_margin.html. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost' is therefore not allowed access. (10:13:37:709 | error, javascript)
  at public_html/index.html

Open in new window


So for the immediate time being I'm back to http://localhost..., but I've got to get this solved.

Do you suggest I reframe my question and resubmit it to the masses here?

Ralph
Dave BaldwinFixer of ProblemsCommented:
You can Not solve it using 'localhost'.  A remote computer can Not access your computer at 'localhost' because their 'localhost' will be their computer.  You have to get rid of 'localhost'.  This is a well known problem.  Do Not use 'localhost' in any site that needs to be accessed from another computer.
RalphAuthor Commented:
I KNOW!
Dave BaldwinFixer of ProblemsCommented:
Then why are you saying "I'm back to http://localhost..." ???
RalphAuthor Commented:
jQuery loading of pages fails when I use relative links, like you suggested,
AND when I use http://10.139.164.191/Cell_Modems/public_html/DIR/file.
See my 10:20 AM reply today.

Really frustrating.
Dave BaldwinFixer of ProblemsCommented:
Your error means that your jQuery is not on the same IP address as your page.  How are you getting to the main page?  It needs to be at  http://10.139.164.191/ .
RalphAuthor Commented:
Well, the ONE thing is working right today!

I have the hard-coded full IP path everywhere now, and it's working.
Why I thought it wasn't before is because even though I now do not have "localhost" anywhere in the project, Chrome puts it there when I 'run' in netbeans.  Once I replace that w/ the IP all works fine.
jQuery and AJAX.

So I'm good Dave.  MANY thanks!

Now if only I can get one of my AJAX calls to not put the cart before the horse, I'd be totally pleased.
http://www.experts-exchange.com/questions/28929029/AJAX-function-is-succeeding-but-not-posting-correctly.html

Again, thank you,
Ralph
Dave BaldwinFixer of ProblemsCommented:
You're welcome, glad to help.
Chrome puts it there when I 'run' in netbeans
Other IDE's have that same problem.  I don't use any of them.  Just a code editor and a real web server... or two or 12.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Apache Web Server

From novice to tech pro — start learning today.