何か問題が発生しても、mkdir()は例外をスローしません。何が起こっているかについてより多くの情報を得るには、スクリプトをもう少し「おしゃべり」にする必要があります
<?php
error_reporting(E_ALL);
ini_set('display_errors', true);
if( !isset($_POST["create"]) ) {
echo 'post parameter create not present';
}
else {
// you are absolutely sure about passing the POST parameter as-is to mkdir() ?
// ok, it's up to you; just make sure it doesn't get abused....
echo 'current working directory: ', htmlspecialchars(getcwd()), "<br />\n";
echo 'newDirCreated: ', htmlspecialchars($_POST["newDirCreated"]), "<br />\n";
$rc = mkdir($_POST["newDirCreated"], 0777);
if ( $rc ) {
echo 'created';
}
else {
echo "an error occured<br />\n";
if ( function_exists('error_get_last') ) {
echo 'error_get_last: ', htmlspecialchars(print_r(error_get_last(), true));
}
else if ( isset($php_errormsg) ) {
echo 'php_errormsg: ', htmlspecialchars($php_errormsg);
}
else {
echo 'no additional error information available';
}
}
}
ただし、デバッグ後は、(エラー状態を処理しながら)おしゃべりを少なくすることを忘れないでください。すべての情報を任意のユーザーに公開するべきではありません...
も参照してください: