Two connected computers. Visibility is established and the file explorer has full access to the filing system between computers. I have MySql/PHP/Apache installed on one computer and my application attempting to access the file system on the other computer. file_exists failed. I can’t see the content on the second computer from my PHP application.
How are you trying to access it? You would need to do it something like this:
Also, if you have a firewall, you might need to open up remote access for your application. Remember that if it is not a public folder, you need to set the permissions on the remote folder to allow access. You might want to show us an example of how you are accessing it…
Let’s say that PC1 with my PHP application is trying to access PC2 with the content.
The content folder on PC2 has full (unrestricted) public access.
The file explorer on PC1 is showing the network connection to the targeted folder to PC2 with the name “\remote-computer-name\public-folder” and local driver name “X:”.
I have disabled the firewall on PC2.
My application on PHP is trying to access the content but failed.
May I ask you: How I can open remote access for my application? Maybe it is the solution?
See the last 4 usage examples in the file:// wrapper documentation - PHP: file:// - Manual
I have tried to access the external filesystem on LAN and it didn’t work. Yes, I used double back-slash.
If you use ONE SLASH at the begging of an address, it is on the local computer starting at it’s root.
Therefore it will never get to the other computer. You need to use two slashes. For some reason when I posted the example, it dropped one. Here is my example inside code tags:
Note the two slashes at the beginning which tells it to go to another computer.
Did you try the other variations, especially the last one, which doesn’t use any \ characters?
The windows \ path separator, because it is also php’s string escape character has always been a problem. You either need to double them inside of strings, to get a single one out, or use / characters instead, which php will convert to \ when running on windows.
My system admin. helped me to resolve the problem. It was resolved with some changes to the windows 10 configuration. Windows was set to recognize the IP address of the target PC. Thank you so much to all.