PHP cannot verify if directory exists -
i going crazy one
i have folders , files structure
- /
- /projects
- /mytest
- /install
- /index.php
- /product
- /install
- /mytest
- /resources
- /projects
so, inside install/index.php file trying verify if /product folder exist. know folder exists, looks php doesn't. code:
if(file_exists('../../mytest/product') && is_dir('../../mytest/product')) { echo 'folder exists!'; } else { echo 'php blind or something!'; } maybe tired, cannot figure out wrong. rested minds here maybe see problem. thanks!
with current directory structure:
/ /projects /mytest /install /index.php /product /resources the following code works fine:
<?php if(file_exists('../product') && is_dir('../product')) { echo 'folder exists!'; } else { echo 'php blind or something!'; } ?> as current code:
<?php if(file_exists('../../mytest/product') && is_dir('../../mytest/product')) { echo 'folder exists!'; } else { echo 'php blind or something!'; } ?> both solutions outputted "folder exists!", issue related folder permissions.
you need confirm:
- owner folder
remember owner of directory has same of script user, otherwise function return false when php running in safe_mode..
limit files can opened php specified directory-tree..
Comments
Post a Comment