PHP's glob() function returns an empty array when called in a web page but works when called from command line. Is there a USE flag to allow PHP's glob() function access to the filesystem (or to libc)?
The following php code returns an empty array:
Code: Select all
<?php
print_r(glob("/var/www/localhost/htdocs/*"));
?>Code: Select all
# sudo -u apache php -c /etc/php/apache2-php5/php.ini -r 'print_r(glob("/var/www/localhost/htdocs/*"));'
My phpinfo() does not indicate that any functions are disabled. I don't think php is running in "safe mode". I see the same behavior in dev-lang/php-5.2.12 and 5.2.13, on x86 and amd64. The scandir() function is able to access the filesystem when called from a web page.
php 5.2.13 is compiled with the following USE flags:
Code: Select all
apache2 berkdb bzip2 cli crypt ctype gdbm hash iconv imap ipv6 json ldap mysql mysqli ncurses nls pcre pdo readline reflection session simplexml snmp sockets spl ssl threads truetype unicode xml xmlrpc xsl zlib -adabas -bcmath -birdstep -calendar -cdb -cgi -cjk -concurrentmodphp -curl -curlwrappers -db2 -dbase -dbmaker -debug -discard-path -doc -empress -empress-bcs -esoob -exif -fastbuild -fdftk -filter -firebird -flatfile -force-cgi-redirect -frontbase -ftp -gd -gd-external -gmp -inifile -interbase -iodbc -java-external -kerberos -kolab -ldap-sasl -libedit -mcve -mhash -msql -mssql -oci8 -oci8-instant-client -odbc -pcntl -pic -posix -postgres -qdbm -recode -sapdb -sharedext -sharedmem -soap -solid -spell -sqlite -suhosin -sybase -sybase-ct -sysvipc -tidy -tokenizer -wddx -xmlreader -xmlwriter -xpm -yaz -zip