|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2010-10-28 11:46 UTC] nsp at h4h dot pl
Description:
------------
test is simple:
print_r(glob("/var/www/*"));
Always returns empty array.
____________________________
Yes, I know this is strange, yes I have search whole web and no solution yet.
Problem is probably related to OS, because other server (also linux lenny) work OK on the same apache2 and same php5 module.
I have made simple command line test:
sudo -u www-data php5 -c /etc/php5/apache2/php.ini -r 'print_r(glob("/var/www/*"));'
And this is working OK.
My apache2 has no strange modules, this is normal web server.
My system:
php5: 5.2.6.dfsg.1-1+lenny9
kernel: 2.6.8-2-386
libc6: 2.7-18lenny6
apache: apache2 2.2.9-10+lenny8
No special file system security on OS, /var/www is 777, default apache2 security settings.
This problem is VERY rare, but Im not the only one:
same problem here:
http://forums.gentoo.org/viewtopic-t-826894-start-0.html
Any suggestions?
PLEASE HELP!
Test script:
---------------
print_r(glob("/var/www/*"));
Expected result:
----------------
glob() should return array of files
Actual result:
--------------
empty array, no errors
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 22:00:01 2025 UTC |
Add error_reporting(-1); ini_set('display_errors', 'on'); to your script before calling glob() and see if any errors are generated. Also, are you using SELinux by any chance?After adding: ini_set('display_errors', 'on'); I have no errors, I also try: error_reporting(E_ALL|E_STRICT); ini_set('log_errors',1); assert_options(ASSERT_BAIL,1); same thing: no errors, empty array I have try to open this dir and list files by other way, eg. opendir and this way everything is OK and code work as expected.