November 29, 2020, 04:55:39 PM

Author Topic: Win 10 update knocks out access to php on remote server ?  (Read 1339 times)

Offline cpsmith0191

  • Jr. Member
  • **
  • Posts: 73
    • caroleandcarl
Win 10 update knocks out access to php on remote server ?
« on: December 11, 2019, 10:22:26 PM »
Has anybody else experienced problems with remote apache server access since the December 10 win10 upgrade?
My apache server runs on one computer to which I load php scripts, I then access them from a remote computer for testing before uploading.
If I run the scripts from the machine with the apache server on (vista) the scripts work fine.
But from today (11/12) when I run the scripts on the remote system (win10) I get the uninterpreted script.
Before the upgrade the scripts all ran from the remote computer (win 10). All scripts are installed on the server on the vista machine.
I can remember back in he mists of time going into a config file in the windows directory on each machine to name the apache server, something like : localhost = myservername.local but I can't find this documented and can't remember what I did.
My browser can open a file on the remote computer which is fine for http but no good for php.  http etc myservername.local  or myservername.local gives me a blank page.
Does anybody have any clue as to the name of the config file I have to find to let my remote computer know the name of my apache server ? Have fun cps.
PS I know, document config changes (lesson learned, I hope) and it could be a coincidence. But: working fine, attempted shut down, upgrade interrupts shutdown, started up next day and not working fine.
 

Offline Derron

  • Hero Member
  • *****
  • Posts: 3265
Re: Win 10 update knocks out access to php on remote server ?
« Reply #1 on: December 12, 2019, 09:00:28 AM »
Am not on Windows - used "XAMPP" to setup all my stuff (on XP) when I did >10 years ago.

If you placed a "index.html" (with some "hello world") in the htdocs and access that via "myotherdomain.local" does it get displayed or not? If yes, then the PHP stuff needs to get repaired. If not, then your issues are something else.

Regarding hosts file: this is where windows looks first if you enter a domain name. That way you could block  / redirect stuff like licence validation servers, adware servers ... or you could redirect stuff like "example.local" to your local IP of the server.

Assume your working computer is 192.168.0.5 and your server is running 192.168.0.4.

On your working computer you now edit the hosts file to relay "example.local" to 192.168.0.4
Your server does not need this adjustments.


@ PHP execution
Apache2 (I assume you are running the v2) hase multiple configs.

If you installed PHP properly, you should be able to execute it from commandline ("php").


edit Apache2's confhttpd.conf and load the php(5 or 7 or whatever you installed) module:
LoadModule php5_module "c:/path/to/php/php5apache2_2.dll"
AddType application/x-httpd-php .php
PHPIniDir "C:/path/to/php"

AddType is there so the server knows it wants to handle .php files, the module is there ... yeah to provide the functionality, and the inidir is there to allow setting the php.ini (aka what modules to load).

Afterwards you need to restart your apache (httpd -t)


If you are not firm with this stuff, think about using XAMPP
https://www.apachefriends.org/index.html


bye
Ron

Offline Qube

  • Administrator
  • Hero Member
  • *****
  • Posts: 2566
  • I mostly code at night... Mostly.
    • SyntaxBomb - Indie Coders
Re: Win 10 update knocks out access to php on remote server ?
« Reply #2 on: December 13, 2019, 05:52:40 AM »
Not really sure what you are after but does this help?

If not can you provide a detailed example of what you're trying to achieve. I'm not sure if you are testing a website / scripts via a url like thismachine.local/ubersite/coolstuff.php or trying to execute actual php scripts on a remote server via commands on your local PC.
Mac mini ( 2018 / 2020 ), 3 GHz 6-Core Intel Core i5, 16 GB 2667 MHz DDR4, 1TB NVMe, eGPU Radeon Pro 580 8 GB, LG Ultragear 27GL83A-B 27 Inch
Commodore VIC-20, 1.1Mhz MOS 6502 CPU, 5KB RAM, VIC ( 6560 ) GPU

Until the next time...

Offline cpsmith0191

  • Jr. Member
  • **
  • Posts: 73
    • caroleandcarl
Re: Win 10 update knocks out access to php on remote server ?
« Reply #3 on: December 19, 2019, 10:30:44 PM »
Many thanks for the feedback. I will digest over the next few days when seasonal commitments allow.
But a quick response : My php scripts in htdocs and its subdirectories on the vista system with the apache server (xampp) installed, work fine (are interpreted) when run from the system the apache sever is installed on (vista).
Yes I can run php from the command line on the vista system (that's the system with the apache,xampp server installed on).
Its only the remote access from the win10 system that is giving problems (outputs the uninterpreted script since 10/12).
I have since fired up my mac and a win xp system and they still run the php scripts as they should (they give the interpreted output).
I'm sure I had to include something on each local system to enable access to my local server (which is on the vista system) but I can't remember what or even which file I fiddled with, hopefully one of the pointers you provided will provide illumination.
Thanks again, I will get back on line once I've exhausted your ideas. Seasons greetings!! have fun cps.

Offline cpsmith0191

  • Jr. Member
  • **
  • Posts: 73
    • caroleandcarl
Re: Win 10 update knocks out access to php on remote server ?
« Reply #4 on: January 08, 2020, 10:27:05 PM »
Seasons merriment over and I've found the file I was looking for, it was:
windows\system32\drivers\etc\hosts and it was changed/saved on the 10/11 !!
Problem still remains, even though the IP of my apache server is still there as is the server name.
Just to clarify I'm trying to execute php scripts on a remote server via a local PC through a web page on a local PC.
I'll get into the guts of what you have provided and will post as soon as I've solved the problem, have fun cps.

Offline Derron

  • Hero Member
  • *****
  • Posts: 3265
Re: Win 10 update knocks out access to php on remote server ?
« Reply #5 on: January 08, 2020, 10:56:36 PM »
Just to summarize:

- localPC1 and localPC2 exist
- localPC2 stores somewhere "script.php" and runs an Apache server
- localPC1 runs an Apache server
- you want to run "localPC2's script.php" from within localPC1's Apache
??
Or where is "remote server" ?

There are security concerns which should restrict you from running remote files ...  you might need to adjust your php.ini to tackle that:
https://www.php.net/manual/en/filesystem.configuration.php#ini.allow-url-include
(but it is a reeeaalllly bad habit!)


If the file is on the same lan you also might just need create an SMB share of that folder on localPC2. Connect that share as network drive (so z: symlinks to that smb share). In your localPC1's Apache config you can then make a virtual folder for this network drives folder. That virtual folder could then be reached accordingly from localPC1 - or any other device which can reach localPC2 (worldwide via portforwarding or simply local ...)


@ hosts
hosts is - as I wrote - useful to give the local computers "domain names".
You can reach them via their network name ("//ronnypc") or ip ("//192.168.0.123") but sometimes you want to use example.com (this is not a really used domain and it is allowed to use them for such stuff) so you add it to the hosts file.


bye
Ron

Offline cpsmith0191

  • Jr. Member
  • **
  • Posts: 73
    • caroleandcarl
Re: Win 10 update knocks out access to php on remote server ?
« Reply #6 on: January 08, 2020, 11:12:20 PM »
Thanks for the reply sorry my description has been vague, so to clarify:
Local PC1 runs an apache server(xampp) with a named server (sub directory) in htdocs.
I write my php script on local PC2 and save it to the named sever on local PC1
I then run the scripts I have created and saved to local PC1 from a web page on local PC2.
IE The named server on local PC1 imitates the WWW and enables me to test PHP/HTTP without having to upload each page to my web site on the WWW, or at least it did until 11/12. (and still does if I access local PC1 from a web page on my mac)
Hope I have explained things in a clearer manner.
Maybe I was still affected by the seasons festivities, hope you enjoyed yours. Have fun cps.

Offline Derron

  • Hero Member
  • *****
  • Posts: 3265
Re: Win 10 update knocks out access to php on remote server ?
« Reply #7 on: January 08, 2020, 11:19:29 PM »
so in short:

you access http://localpc2/mywebsite.php from localpc2
mywebsite.php somehow includes (eg. require_once) "http://localpc1/otherscript.php" ?

This requires what I have written above: a php.ini modification to allow this insecure behaviour of including remote files.


Or is this happening:
you access http://localpc2/folderLinkingToLocalPC1/otherscript.php
and Apache on your localpc2 should link "folderLinkingToLocalPC1" to a folder from localPC1 ? Then see my post above: smb share... should do.



bye
Ron

Offline cpsmith0191

  • Jr. Member
  • **
  • Posts: 73
    • caroleandcarl
Re: Win 10 update knocks out access to php on remote server ?
« Reply #8 on: January 08, 2020, 11:35:52 PM »
Maybe you created a typo but
I access http://localPC1/mywebsite.php from localPC2
I run a .htm file on localPC2 which has a link to http://localPC1/mywebsite.php
I see where you are going with require_once but I'm not using the .php file on localPC1 as a collection of functions that I want to access from a .php file on localPC2.
Thanks again for your input. I'm only just getting back into this hiccup but I suspect the answer lies somewhere in this thread, have fun cps.



Offline Qube

  • Administrator
  • Hero Member
  • *****
  • Posts: 2566
  • I mostly code at night... Mostly.
    • SyntaxBomb - Indie Coders
Re: Win 10 update knocks out access to php on remote server ?
« Reply #9 on: January 09, 2020, 01:27:48 AM »
I access http://localPC1/mywebsite.php from localPC2
I run a .htm file on localPC2 which has a link to http://localPC1/mywebsite.php
I'm amazed you were even able to do that at some point :o

If you want to execute a PHP file on localPC1 and show the output on localPC2 ( be it a full webpage or just plain text ) then you could use PHP's cURL and DOM features.
Mac mini ( 2018 / 2020 ), 3 GHz 6-Core Intel Core i5, 16 GB 2667 MHz DDR4, 1TB NVMe, eGPU Radeon Pro 580 8 GB, LG Ultragear 27GL83A-B 27 Inch
Commodore VIC-20, 1.1Mhz MOS 6502 CPU, 5KB RAM, VIC ( 6560 ) GPU

Until the next time...

Offline Derron

  • Hero Member
  • *****
  • Posts: 3265
Re: Win 10 update knocks out access to php on remote server ?
« Reply #10 on: January 09, 2020, 07:28:59 AM »
his htm file is just redirecting to the website - as if you would call it directly from within your browser (at least I understood that way).

So what happens if you directly call
http://localPC1/mywebsite.php
from your localPC2 ?

It should not work too (so the same as calling it from within a html file / redirect / iframe).
So in other words, the Apache server on localPC1 is not executing the php script.
It displays the "<?php".... stuff or nothing at all?
If you are using the short opening tags ("<? ...") instead of the long ones ("<?php ...") then make sure your apache/php configs are adjusted accordingly to allow this!


bye
Ron

Offline Qube

  • Administrator
  • Hero Member
  • *****
  • Posts: 2566
  • I mostly code at night... Mostly.
    • SyntaxBomb - Indie Coders
Re: Win 10 update knocks out access to php on remote server ?
« Reply #11 on: January 10, 2020, 04:08:49 AM »
his htm file is just redirecting to the website - as if you would call it directly from within your browser (at least I understood that way).
I didn't read it as that or else surely a simple redirect in HTML would work? - I assumed he wanted to call a PHP file located on another server? - I could be wrong. Perhaps it's time for a full non-working example?
Mac mini ( 2018 / 2020 ), 3 GHz 6-Core Intel Core i5, 16 GB 2667 MHz DDR4, 1TB NVMe, eGPU Radeon Pro 580 8 GB, LG Ultragear 27GL83A-B 27 Inch
Commodore VIC-20, 1.1Mhz MOS 6502 CPU, 5KB RAM, VIC ( 6560 ) GPU

Until the next time...

Offline cpsmith0191

  • Jr. Member
  • **
  • Posts: 73
    • caroleandcarl
Re: Win 10 update knocks out access to php on remote server ?
« Reply #12 on: January 15, 2020, 08:40:46 PM »
Many, many thanks for all your input! Guess what happened today when I rebooted after another windows (10) upgrade.
Yes everything burst back into life. IE my remote window10 system now accesses my xampp server and the php script on the xampp server executes, and no the problem wasn't with the changes to windows\system32\drivers\etc\hosts as this has not been updated this time around.
I include the modifications I originally made to my systems to enable remote access to the xamp server:

Step 1:  Create a virtual host on the system with apache installed (xampp)
Change   C:\xampp\apache\conf\extra\httpd-vhosts.conf  to include
<VirtualHost *:80>
DocumentRoot "c:/xampp/htdocs/myservername/"
ServerName myservername.local
</VirtualHost>

Step 2:  change the hosts file on the system with the apache sever
In windows  this file is in   \Windows\system32\drivers\etc\hosts
In mac this file is in    /private/etc/hosts
Find this entry
##
# Host Database
# localhost is used to configure the loopback interface
##
#...
Then add the following line
127.0.0.1 myservername.local

Step 3 :   Make the following change to any remote system
In windows  this file is in   \Windows\system32\drivers\etc\hosts
In mac this file is in    /private/etc/hosts
Find this entry
##
# Host Database
# localhost is used to configure the loopback interface
##
#...
Then add the following line
‘THE IP OF THE SERVER WITH APACHE ON IT’   myservername.local

(   should look something like     111.111.111.111    myservername.local  )

The above is from notes I made some time ago when I was setting up Intranets for various places which I eventually found.
I'm sorry if my explanation didn't make the nature of the problem clear or what I was doing, I hope this clears it up.
Thanks for all help offered, have fun cps.



 

SimplePortal 2.3.6 © 2008-2014, SimplePortal