Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is_dir returns false even when it is a dir?

Tags:

php

Why does is_dir() return false even if it is a dir?

returns no error

$path_mysql = '/var/lib/mysql/';
if(!is_dir($path_mysql)){
    echo 'error';
}

returns error

$path_mysql = '/var/lib/mysql/domain.com/';
if(!is_dir($path_mysql)){
    echo 'error';
}

/var/lib/mysql/domain.com/ does exsits, but is_dir() returns false!?

I can get access to the dir through both PuTTY and WinSCP

like image 716
clarkk Avatar asked Nov 10 '11 15:11

clarkk


1 Answers

Possibly because it cannot check whether the /var/lib/mysql/domain.com/ exists or not, because it does not have enough rights to do that (permission problems).

Check the execute (list) permission of /var/lib/mysql/ directory for the user which runs this PHP script (probably it's www-data)

like image 135
KARASZI István Avatar answered Oct 18 '22 19:10

KARASZI István