PHP SAMBA/SMB/CIFS and smb4php classes

走远了吗. 提交于 2019-12-22 07:01:03

问题


have to access some media files from Network storage to be accessible through SMB and Common Internet File System. PHP website is required to do file manipulation operations on remote storage block. You may suggest some alternate method or if you have any idea or may help on:

  1. configuring SAMBA/SMB/CIFS
  2. SMB/SAMBA/CIFS client configuration
  3. Accessing file system through PHP - research shows that PHP provides smb4php classes in this regard, but no support on how to use in a complete setup.

回答1:


Whether or not you can mount the SMB share directly on your host OS will depend on what your host OS is. That you are talking about SAMBA suggests it might be some sort of Unix / POSIX / Linux - but which one?

Most versions of Linux support a filesystem type of smbfs (usually the man page for mount will list the supported types).

mount -t smbfs -o username=Bill,password=billions //msbox/netshare /some/local/dir

(note that the smbfs vfs is developed by the same people who write Samba - but is a seperate product).

Samba ships with a cli client smbclient. To fetch a file using this you just need to exec it with the right arguments (note that if you don't sepcify all the required arguments on the command line, smbclient will drop into an interactive mode). See the man page installed for smbclient for details of the arguments and their formatting.

research shows that PHP provides smb4php classes

No it doesn't. I assume that you're talking about this - which is not supplied by the people who maintain PHP. It is just a wrapper around the smbclient program. As per my comment on the site (see support forum), yes, the documentation is not great - but I've added the details on the format of the connection string.

Please cite your sources.



来源:https://stackoverflow.com/questions/3768333/php-samba-smb-cifs-and-smb4php-classes

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!