[PHP-users 11988] ローカルとサーバー上での動作の違いを教えてください。

atsushi php-users@php.gr.jp
Wed, 4 Dec 2002 22:55:18 +0900


This is a multi-part message in MIME format.

------=_NextPart_000_001A_01C29BE8.378F95B0
Content-Type: text/plain;
	charset="iso-2022-jp"
Content-Transfer-Encoding: 7bit

PHP初心者です。申し訳ありませんが、つまずいてしまいご質問させてください。

現在ユーザー登録し、登録時にそのユーザー名でディレクトリを作成し、そのディレ
クトリ内にimgディレクトリとtempディレクトリとindex.htmlを作成するシステムを
作っています。

下記のソースでローカルでは正常に動いていたのですが、サーバーにアップしたあ
と。
エラーが発生するようになってしまい、原因がわかりません。

アドバイスしてもらえると嬉しいです。

・・省略

//index.html<META>のリンク先
$url="<? echo $HOSTURL;  ?>php/kihon.php?uid=$uid";

//ディレクトリ名
$dir="../gunma/$_POST[uid]";

//IMGディレクトリ名
$dirimg="../gunma/$_POST[uid]/img";

//TEMPディレクトリ名
$dirtemp="../gunma/$_POST[uid]/temp";

//コピーもとファイル名
$fname="../temp/index.html";

//コピー先ファイル名
$fname_to="../gunma/$_POST[uid]/index.html";


mysql_connect($host,$sqluid,$sqlpass);
mysql_select_db($sqlDB);


$sql="select * from hotel_t where pass='$pass'";

$reslut=mysql_query("$sql");
$res=mysql_fetch_array($reslut);
$rows=mysql_num_rows($reslut);

if($rows>=1){

err("そのパスワードはすでに使用されています。");

}


if(is_dir("../gunma/{$uid}")){

err("入力したユーザーIDはすでに使用されています。");

}




mysql_connect($host,$sqluid,$sqlpass);
mysql_select_db($sqlDB);



if(@$_POST["new"]){


$res=mysql_query("insert into hotel_T(uid,pass,ado_ken,ado_city,name)
values('$uid', '$pass', '$ado_ken', '$ado_city', '$name')");

$rc=mkdir($dir,0777);

mkdir($dirimg,0777);

mkdir($dirtemp,0777);

copy($fname,$fname_to);

$file=fopen($fname_to,"w") or die("OPENエラー,$fname_to");

$string="<meta http-equiv=refresh content=0;URL=$url>";

fputs($file,$string);

flock($file,LOCK_UN);

fclose($file);



if($rc){

echo "ディレクトリ",@$_POST[uid],"を作成しました。";

       }

else{

echo "ディレクトリ作成失敗";

    }

                  }

elseif(@$_POST["del"]){

$row=mysql_query("delete from hotel_T where uid='$uid'");

if(!$row){

echo "失敗";

         }

                      }



?>


↓エラーメッセージ↓


Warning: mkdir() failed (Permission denied) in
/home/cyamicom/public_html/php/insert.php on line 63

Warning: mkdir() failed (No such file or directory) in
/home/cyamicom/public_html/php/insert.php on line 65

Warning: mkdir() failed (No such file or directory) in
/home/cyamicom/public_html/php/insert.php on line 67

Warning: Unable to create '../gunma/ssssssss/index.html': No such file or
directory in /home/cyamicom/public_html/php/insert.php on line 69

Warning: fopen("../gunma/ssssssss/index.html", "w") - No such file or
directory in /home/cyamicom/public_html/php/insert.php on line 71
OPENエラー,../gunma/ssssssss/index.html






------=_NextPart_000_001A_01C29BE8.378F95B0
Content-Type: text/html;
	charset="iso-2022-jp"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-2022-jp">
<META content=3D"MSHTML 6.00.2600.0" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT=20
face=3D"MS UI =
Gothic">PHP=1B$B=3Di?4<T$G$9!#?=3D$7Lu$"$j$^$;$s$,!"$D$^$:$$$F$7$^$$$4<AL=
d$5$;$F$/$@$5$$!#=1B(B</FONT></DIV>
<DIV><FONT face=3D"MS UI Gothic"></FONT>&nbsp;</DIV>
<DIV><FONT=20
face=3D"MS UI =
Gothic">=1B$B8=3D:_%f!<%6!<EPO?$7!"EPO?;~$K$=3D$N%f!<%6!<L>$G%G%#%l%/%H%j=
$r:n@.$7!"$=3D$N%G%#%l%/%H%jFb$K=1B(B</FONT><FONT=20
face=3D"MS UI =
Gothic">img=1B$B%G%#%l%/%H%j$H=1B(Btemp=1B$B%G%#%l%/%H%j$H=1B(Bindex.html=
=1B$B$r:n@.$9$k%7%9%F%`$r:n$C$F$$$^$9!#=1B(B</FONT></DIV>
<DIV><FONT face=3D"MS UI Gothic"></FONT>&nbsp;</DIV>
<DIV><FONT=20
face=3D"MS UI =
Gothic">=1B$B2<5-$N%=3D!<%9$G%m!<%+%k$G$O@5>o$KF0$$$F$$$?$N$G$9$,!"%5!<%P=
!<$K%"%C%W$7$?$"$H!#=1B(B</FONT></DIV>
<DIV><FONT face=3D"MS UI =
Gothic">=1B$B%(%i!<$,H/@8$9$k$h$&$K$J$C$F$7$^$$!"860x$,$o$+$j$^$;$s!#=1B(=
B</FONT></DIV>
<DIV><FONT face=3D"MS UI Gothic"></FONT>&nbsp;</DIV>
<DIV><FONT face=3D"MS UI =
Gothic">=1B$B%"%I%P%$%9$7$F$b$i$($k$H4r$7$$$G$9!#=1B(B</FONT></DIV>
<DIV><FONT face=3D"MS UI Gothic"></FONT>&nbsp;</DIV>
<DIV><FONT face=3D"MS UI Gothic">=1B$B!&!&>JN,=1B(B</FONT></DIV>
<DIV><FONT face=3D"MS UI Gothic"></FONT>&nbsp;</DIV>
<DIV><FONT face=3D"MS UI =
Gothic">//index.html&lt;META&gt;=1B$B$N%j%s%/@h=1B(B<BR>$url=3D"&lt;? =
echo=20
$HOSTURL;&nbsp; ?&gt;php/kihon.php?uid=3D$uid";</FONT></DIV>
<DIV><FONT face=3D"MS UI Gothic" size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT=20
face=3D"MS UI =
Gothic">//=1B$B%G%#%l%/%H%jL>=1B(B<BR>$dir=3D"../gunma/$_POST[uid]";</FON=
T></DIV>
<DIV><FONT face=3D"MS UI Gothic" size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT=20
face=3D"MS UI =
Gothic">//IMG=1B$B%G%#%l%/%H%jL>=1B(B<BR>$dirimg=3D"../gunma/$_POST[uid]/=
img";</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT=20
face=3D"MS UI =
Gothic">//TEMP=1B$B%G%#%l%/%H%jL>=1B(B<BR>$dirtemp=3D"../gunma/$_POST[uid=
]/temp";</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT=20
face=3D"MS UI =
Gothic">//=1B$B%3%T!<$b$H%U%!%$%kL>=1B(B<BR>$fname=3D"../temp/index.html"=
;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT=20
face=3D"MS UI =
Gothic">//=1B$B%3%T!<@h%U%!%$%kL>=1B(B<BR>$fname_to=3D"../gunma/$_POST[ui=
d]/index.html";</FONT></DIV>
<DIV>&nbsp;</DIV><FONT face=3D"MS UI Gothic">
<DIV><BR>mysql_connect($host,$sqluid,$sqlpass);<BR>mysql_select_db($sqlDB=
);</DIV>
<DIV>&nbsp;</DIV>
<DIV><BR>$sql=3D"select * from hotel_t where pass=3D'$pass'";</DIV>
<DIV>&nbsp;</DIV>
<DIV>$reslut=3Dmysql_query("$sql");<BR>$res=3Dmysql_fetch_array($reslut);=
<BR>$rows=3Dmysql_num_rows($reslut);</DIV>
<DIV>&nbsp;</DIV>
<DIV>if($rows&gt;=3D1){</DIV>
<DIV>&nbsp;</DIV>
<DIV>err("=1B$B$=3D$N%Q%9%o!<%I$O$9$G$K;HMQ$5$l$F$$$^$9!#=1B(B");</DIV>
<DIV>&nbsp;</DIV>
<DIV>}</DIV>
<DIV>&nbsp;</DIV>
<DIV><BR>if(is_dir("../gunma/{$uid}")){</DIV>
<DIV>&nbsp;</DIV>
<DIV>err("=1B$BF~NO$7$?%f!<%6!<=1B(BID=1B$B$O$9$G$K;HMQ$5$l$F$$$^$9!#=1B(=
B");</DIV>
<DIV>&nbsp;</DIV>
<DIV>}</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV><BR>mysql_connect($host,$sqluid,$sqlpass);<BR>mysql_select_db($sqlDB=
);</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>if(@$_POST["new"]){</DIV>
<DIV>&nbsp;</DIV>
<DIV><BR>$res=3Dmysql_query("insert into =
hotel_T(uid,pass,ado_ken,ado_city,name)=20
<BR>values('$uid', '$pass', '$ado_ken', '$ado_city', '$name')");</DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV>$rc=3Dmkdir($dir,0777);</DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV>mkdir($dirimg,0777);</DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV>mkdir($dirtemp,0777);</DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV>copy($fname,$fname_to);</DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV>$file=3Dfopen($fname_to,"w") or =
die("OPEN=1B$B%(%i!<=1B(B,$fname_to");</DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV>$string=3D"&lt;meta http-equiv=3Drefresh =
content=3D0;URL=3D$url&gt;";</DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV>fputs($file,$string);</DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV>flock($file,LOCK_UN);</DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV>fclose($file);</DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV>if($rc){</DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV>echo =
"=1B$B%G%#%l%/%H%j=1B(B",@$_POST[uid],"=1B$B$r:n@.$7$^$7$?!#=1B(B";</DIV>=

<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV>else{</DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV>echo "=1B$B%G%#%l%/%H%j:n@.<:GT=1B(B";</DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV>&nbsp;&nbsp;&nbsp; }</DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
}</DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV>elseif(@$_POST["del"]){</DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV>$row=3Dmysql_query("delete from hotel_T where uid=3D'$uid'");</DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV>if(!$row){</DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV>echo "=1B$B<:GT=1B(B";</DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
}</DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV>?&gt;</DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2>=1B$B"-%(%i!<%a%C%;!<%8"-=1B(B</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><STRONG>Warning</STRONG>: mkdir() failed (Permission denied) in=20
<B>/home/cyamicom/public_html/php/insert.php</B> on line=20
<B>63</B><BR><BR><B>Warning</B>: mkdir() failed (No such file or =
directory) in=20
<B>/home/cyamicom/public_html/php/insert.php</B> on line=20
<B>65</B><BR><BR><B>Warning</B>: mkdir() failed (No such file or =
directory) in=20
<B>/home/cyamicom/public_html/php/insert.php</B> on line=20
<B>67</B><BR><BR><B>Warning</B>: Unable to create=20
'../gunma/ssssssss/index.html': No such file or directory in=20
<B>/home/cyamicom/public_html/php/insert.php</B> on line=20
<B>69</B><BR><BR><B>Warning</B>: fopen("../gunma/ssssssss/index.html", =
"w") - No=20
such file or directory in =
<B>/home/cyamicom/public_html/php/insert.php</B> on=20
line =
<B>71</B><BR>OPEN=1B$B%(%i!<=1B(B,../gunma/ssssssss/index.html</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV></FONT>&nbsp;</DIV></BODY></HTML>

------=_NextPart_000_001A_01C29BE8.378F95B0--