2013-09-30 77 views
0

我的服務器上有兩個虛擬主機。一個「網絡」和一個「移動」。我可以在「users」目錄下的「web」中查看文件,但是我無法上傳或創建目錄下的目錄?上傳文件到Apache別名目錄和子目錄

例如:

<img src='http://m.domain.com/users/imgs/sample.png' /> this is viewable 

//this is not possible 
<?php 
    mkdir("users/newDir"); //fails 

    $img = file_get_contents("http://images.devshed.com/fds/belts/ds_forums.gif"); 
    $file = "users/newDir/sample.gif"; 
    file_put_contents($file, $img); //fails 

    $img = file_get_contents("http://images.devshed.com/fds/belts/ds_forums.gif"); 
    $file = "users/sample.gif"; 
    file_put_contents($file, $img); //fails 

?> 

我已經欠我的移動虛擬以下指向的文件在我的「網絡」:

<VirtualHost *:80> 
ServerName domain.com 
ServerAlias m.domain.com 

DocumentRoot "C:/Apache/mobileroot" 
<Directory "C:/Apache/mobileroot"> 
    Options FollowSymLinks 
    AllowOverride None 
    Order allow,deny 
    Allow from all 
</Directory> 

Alias /users/ "C:/Apache/webroot/users/" 
<Directory "C:/Apache/webroot/users/"> 
    Options Indexes MultiViews 
    AllowOverride None 
    Order allow,deny 
    Allow from all 
</Directory> 
</VirtualHost> 

回答

0

要回答我的問題,如果有人無意中發現相同問題在未來。

在移動目錄中的所有引用寫有他們的mkdir("users/newDir");

所以的情況下切換到絕對路徑上的「網絡」目錄它保持不變,但對「移動」目錄我改變了所有寫操作使用絕對路徑,如:

mkdir("C:/Apache/webroot/users/newDir");

這迫使新目錄「NEWDIR」要在「網」上創建沒有在服務器上的「移動」目錄。