PHP not running scripts for 2nd pc
Posted by: Apokalupsis (---.sd.sd.cox.net)
Date: February 27, 2012 06:38PM

I've successfully installed WAMP on my desktop pc. I get the green light, it's currently "Online".

I can create and run PHP files/scripts on my desktop (where WAMP is installed) just fine. These are simple scripts used for a PHP college class, nothing fancy (50-100 lines of code). However, I'd like to use my laptop to do the same, by accessing the WAMP installation on the desktop.

I have shared the wamp/www directory with the Homegroup. My laptop can navigate to this directory and run html files. However, when it comes to processing the .php scripts, it just prints out the comments, echo/print statements and even small bits of the code. This doesn't happen at all on the desktop where the script runs perfectly (and it is likewise, verified to run perfectly on shared servers I operate).

It's like PHP isn't running when I access it from the 2nd pc (the laptop), even though I'm connected through Homegroup and have read/write permissions. Why would it work on the desktop and not laptop?

I don't recall any option in the install to enable for networks or to use a particular IP (which I'm not entirely sure which to use, so I just ran the default install settings), so I'm not sure if that's the trouble.

Any help would be appreciated, thanks.

PS I don't need the 2nd pc to access phpmyadmin or WAMP settings or anything fancy. I just need it to run the scripts that I'm creating, and do so from the primary pc (desktop where WAMP is installed).

Would this be needing to setup a virtual host or something? If so, are there simple instructions to follow?



Edited 1 time(s). Last edit at 02/27/2012 06:46PM by Apokalupsis.

Options: ReplyQuote
Re: PHP not running scripts for 2nd pc
Posted by: bondies (122.150.201.---)
Date: February 28, 2012 04:08AM

Sounds like you are trying to open the file by browsing to the directory in windows. As PHP is a server side script this won't work.

What you need to do is access the webserver to browse the files by the 1st PCs IP address (or virtual host if you want it name based). This doesn't have anything to do with the sharing of directories or being on the same homegroup. You will need to ensure that both computers are on the same subnet and behind the same firewall otherwise things get even more tricky.

On the PC with WAMPSERVER installed go Start --> Run --> cmd --> ipconfig
This should give you the IP address & subnet of the web server.

On your Laptop go Start --> Run --> cmd --> ipconfig and ensure that the subnets are the same for both.

Now on your laptop open your web browser and go to the IP address of the web server.

You will probably get a 'FORBIDDEN' error as by default Apache's httpd.conf file is very restrictive will only allow the local machine to browse it, an error is a good start though it shows that there are no firewalls restricting access. If you get a "The connection has timed out" or "Page Unavailable" error and you have confirmed that the server is on and working (ie you can browse it on your 1st PC) then there is a network issue somewhere (Firewall, Internet security, or Routing Issue). If it is a network issue you will need to rectify that first.

To fix the 'FORBIDDEN' error open http.conf in a text edit and look for where it says:
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>

If you edit that to (assuming that 192.168.1 is the base of your local IP address) otherwise modify that line to match the first 3 pairs in your IP address (should be the same for your laptop & server):
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Allow from 127.0.0.1
Allow from 192.168.1.
Deny from all
</Directory>

Restart apache and try browsing again. Best of luck :-D

Options: ReplyQuote
Re: PHP not running scripts for 2nd pc
Posted by: Apokalupsis (---.sd.sd.cox.net)
Date: February 28, 2012 06:31AM

It was a network issue. WIndows Firewall was blocking incoming connections from the Laptop. I was using IE and FF on the laptop (obviously).

I disabled the firewall for private networks, and I was able to connect and run the scripts perfectly, no problem (I made the changes in httpd.conf file as well).

However, I can't seem to figure out a way to re-enable the private network firewall on the desktop (where WAMP is installed) and still allow access to the laptop. I've gone through the Incoming Connections troubleshooter, and there doesn't seem to be anything there (unless I'm doing it wrong).

So it seems as if I just have to disable firewall on the desktop, for private networks, or enable it and not connect via the laptop.

Any firewall (or networking) tips on how to allow both the laptop access to WAMP directory and private network firewall?

Options: ReplyQuote
Re: PHP not running scripts for 2nd pc
Posted by: Apokalupsis (---.sd.sd.cox.net)
Date: February 29, 2012 04:56PM

Anyone have any ideas?

Options: ReplyQuote


Sorry, only registered users may post in this forum.