春哥也編程很久沒來了,最近在阿里的特別忙
但是在平時的工作中遇到了一個問題,想在這里跟大家一起分享一下
問題描述:
我有一台虛擬機,VM的,運行了centos6.3
想通過mountwindows的共享目錄,運行php腳本
mount -t cifs //10.12.1.195/kiss /var/www/ -o username="xxx",password="xxx"
但是nginx總是報錯,file not found.
然后插到php的原因,php-fpm運行正常的
知道用cli方式的運行php腳本的時候,才發現問題,
它就會報錯
Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0 Fatal error: Unknown: Failed opening required 'xxx' in Unknown on line 0
命名可以打開,但是為什么會報錯呢,反復的找問題,反復的想,沒有問題啊,后來覺得是php的問題
所以在php的官網上查詢到了一個bug
https://bugs.php.net/bug.php?id=48778
他里面形容的情況跟我遇到的一樣,
尤其是看到下面的 [2010-10-20 09:37 UTC] sarunas dot valaskevicius at oxid-esales dot com 回答的內容
we faced similar problem on linux, while mounting windows dir, which seems to be the same problem as bug#50150. Also, the workaround to add parameter "-o noserverino" while mounting worked ok (maybe for windows there is a similar mounting feature?).
所以得在mount的時候加上這個參數 noserverino
mount -t cifs //10.12.1.195/kiss /var/www/ -o username="xxx",password="xxx",noserverino
至於具體什么含義大家自己去查吧,呵呵