Win 10 update knocks out access to php on remote server ?

Started by cpsmith0191, December 11, 2019, 22:22:26

Previous topic - Next topic

cpsmith0191

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.

Derron

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

Qube

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 Studio M1 Max ( 10 core CPU - 24 core GPU ), 32GB LPDDR5, 512GB SSD,
Beelink SER7 Mini Gaming PC, Ryzen 7 7840HS 8-Core 16-Thread 5.1GHz Processor, 32G DDR5 RAM 1T PCIe 4.0 SSD
MSI MEG 342C 34" QD-OLED Monitor

Until the next time.

cpsmith0191

#3
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.

cpsmith0191

#4
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.

Derron

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

cpsmith0191

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.

Derron

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

cpsmith0191

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.



Qube

Quote from: cpsmith0191 on January 08, 2020, 23:35:52
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 Studio M1 Max ( 10 core CPU - 24 core GPU ), 32GB LPDDR5, 512GB SSD,
Beelink SER7 Mini Gaming PC, Ryzen 7 7840HS 8-Core 16-Thread 5.1GHz Processor, 32G DDR5 RAM 1T PCIe 4.0 SSD
MSI MEG 342C 34" QD-OLED Monitor

Until the next time.

Derron

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

Qube

Quote from: Derron on January 09, 2020, 07:28:59
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 Studio M1 Max ( 10 core CPU - 24 core GPU ), 32GB LPDDR5, 512GB SSD,
Beelink SER7 Mini Gaming PC, Ryzen 7 7840HS 8-Core 16-Thread 5.1GHz Processor, 32G DDR5 RAM 1T PCIe 4.0 SSD
MSI MEG 342C 34" QD-OLED Monitor

Until the next time.

cpsmith0191

#12
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.