Environment Linux Apache2.4 php5.6
Expected realization: You can directly access files in the shared directory in the LAN through the file_get_contents() method of PHP
(It can be accessed directly under Windows without configuration, but cannot be accessed under Linux. Currently, you can 1. By mounting the disk Solution 2. Implement it by calling smbclient. But I don’t want to use this method, so I want to know if it can be achieved by configuring Apache. The Internet says it can be done, and the configuration is as follows, but I tried it and it doesn’t work. I don’t know what the problem is, permissions?)
I configured the following in http-vhosts.conf
<code> Servername 127.0.0.1 DirectoryIndex index.php Documentroot /www/htdocs/ Alias /myshare "//10.173.32.4/myshare" <Directory "//10.173.32.4/myshare"> AllowOverride None Order allow,deny Allow from all </Directory></code>
Please give me some advice, thank you!
Environment Linux Apache2.4 php5.6
Expected realization: You can directly access files in the shared directory in the LAN through the file_get_contents() method of PHP
(It can be accessed directly under Windows without configuration, but cannot be accessed under Linux. Currently, you can 1. By mounting the disk Solution 2. Implement it by calling smbclient. But I don’t want to use this method, so I want to know if it can be achieved by configuring Apache. The Internet says it can be done, and the configuration is as follows, but I tried it and it doesn’t work. I don’t know what the problem is, permissions?)
I configured the following in http-vhosts.conf
<code> Servername 127.0.0.1 DirectoryIndex index.php Documentroot /www/htdocs/ Alias /myshare "//10.173.32.4/myshare" <Directory "//10.173.32.4/myshare"> AllowOverride None Order allow,deny Allow from all </Directory></code>
Please give me some advice, thank you!
This is external access, not PHP access
For the correct answer, see SO
http://stackoverflow.com/questions/5070545/php-read-file-contents-of-network-share-file
<code>mount -t cifs //10.173.32.4/myshare /www/htdocs/myshare </code>
Then
<code>$data = file_get_contents('/www/htdocs/myshare/file.txt');</code>