简体   繁体   中英

PHP and NAS (IIS 7.5, Windows Server 2008)

how can i access folders like

\\10.200.0.3\some_folder
user name: user
password: pass

is it possible to map network device then access it using php? please help me connect to this share and access files there..

What you're looking for is Server Message Block (SMB) or the open source implementation SAMBA.

To use this in PHP, you could look at smbwebclient .

You might however simply add a drive map to the share on your Windows server, assign it a fixed letter (like Z:) or even simply access \\\\hostname\\folder (escape the backslashes) and use the PHP built in directory commands to read and write the files from that drive. It'll be a helluvalot easier.

Try one of these;

  • Make sure the IIS worker process has access to that location (IUSR or IIS_IUSRS)
  • Change the website's application settings in IIS to use credentials from a user account who has access to the location

Since you will be running PHP using IIS/Apache user make sure server user also has permissions to access network shared folder. Once you are sure IIS user does have permissions to access shared folder, you may try listing contents of shared folder by using path such as: $target_path = '\\\\\\\\server\\\\images\\\\';

Have a look at this questions, might be helpful: PHP: upload files to network shared folder

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM