Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
dev-lang/php USE flag to enable php's glob() ?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
mieses
Tux's lil' helper
Tux's lil' helper


Joined: 28 Feb 2004
Posts: 105

PostPosted: Thu May 06, 2010 5:54 pm    Post subject: dev-lang/php USE flag to enable php's glob() ? Reply with quote

I don't know if this is the right place to ask a question about dev-lang/php.

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:
<?php
print_r(glob("/var/www/localhost/htdocs/*"));
?>


while the following shell command correctly returns an array of filenames and directories:
Code:
# sudo -u apache php -c /etc/php/apache2-php5/php.ini -r 'print_r(glob("/var/www/localhost/htdocs/*"));'


Note that I am trying to force command line php to use the same php.ini as apache uses, for sake of consistency.

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:
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


This issue is similar to http://bugs.php.net/bug.php?id=48365 except that in my case glob() does work from command line. Is there a USE flag that affects the behavior of php's glob()?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum