Home > Backend Development > PHP Tutorial > How to access LAN shared files using php under Linux?

How to access LAN shared files using php under Linux?

WBOY
Release: 2016-07-06 13:52:35
Original
1776 people have browsed it

$path = "//10.100.2.140/MyShare/test.txt";
var_dump(file_get_contents($path));

It can be accessed under Windows environment, no problem. However, it cannot be accessed under Linux, and it prompts failed to open stream: No such file or directory. The final shared directory is on another Windows machine. I tested the shared directory under Linux in the running environment that Windows can access it but Linux cannot.

Reply content:

$path = "//10.100.2.140/MyShare/test.txt";
var_dump(file_get_contents($path));

It can be accessed under Windows environment, no problem. However, it cannot be accessed under Linux, and it prompts failed to open stream: No such file or directory. The final shared directory is on another Windows machine. I tested the shared directory under Linux in the running environment that Windows can access it but Linux cannot.

This kind of Windows shared LAN address is unique to Windows
If you want to access a Windows share in Linux, you need to mount the directory first. Find out how to use samba

(Also, if the real file is already on this machine, why not directly access the local directory)

Check the path and permission issues first
//machine name or ip/share name/path/file name

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template