Apache configuration access to LAN shared directory issues

Source: Internet
Author: User
Environment Linux + Apache2.4 + php5.6

Expected implementation: the File_get_contents () method of PHP can be used to directly access the files in the shared directory on the LAN
(Windows can be accessed directly without the need for configuration, but Linux cannot access it.) Currently 1. The method of mounting the disk solves 2. By calling Smbclient implementation. But do not want to use this method, just want to know can be implemented by configuring Apache. Online said can, configuration as follows, but I try not to, do not know what the problem, authority?)

I configured the following in http-vhosts.conf

 Servername 127.0.0.1 DirectoryIndex index.php Documentroot /www/htdocs/ Alias /myshare "//10.173.32.4/myshare" 
  
   
    
         AllowOverride None      Order allow,deny      Allow from all 
  
   

Trouble pointing, thank you!

Reply content:

Environment Linux + Apache2.4 + php5.6

Expected implementation: the File_get_contents () method of PHP can be used to directly access the files in the shared directory on the LAN
(Windows can be accessed directly without the need for configuration, but Linux cannot access it.) Currently 1. The method of mounting the disk solves 2. By calling Smbclient implementation. But do not want to use this method, just want to know can be implemented by configuring Apache. Online said can, configuration as follows, but I try not to, do not know what the problem, authority?)

I configured the following in http-vhosts.conf

 Servername 127.0.0.1 DirectoryIndex index.php Documentroot /www/htdocs/ Alias /myshare "//10.173.32.4/myshare" 
  
   
    
         AllowOverride None      Order allow,deny      Allow from all 
  
   

Trouble pointing, thank you!

You this is an external access, not a PHP access

Positive solutions See so
Http://stackoverflow.com/questions/5070545/php-read-file-contents-of-network-share-file

mount -t cifs //10.173.32.4/myshare /www/htdocs/myshare

And then

$data = file_get_contents('/www/htdocs/myshare/file.txt');
  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.