php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #35227 getcwd does not work
Submitted: 2005-11-15 13:38 UTC Modified: 2005-11-15 18:02 UTC
From: rd at mesos dot de Assigned:
Status: Not a bug Package: Directory function related
PHP Version: 4.4.1 OS: Linux Fedora Core release 2
Private report: No CVE-ID: None
 [2005-11-15 13:38 UTC] rd at mesos dot de
Description:
------------
getcwd() doesn't return anything.
The same script is working on other servers.
It has been tested as root.
It is also not working via Apache.

All directorys below the test script have chmod 755.

Reproduce code:
---------------
<?
$olddir = getcwd();
echo "olddir: $olddir\n";
?>


Expected result:
----------------
olddir: /usr/src/php-4.4.1

Actual result:
--------------
olddir: 

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-11-15 13:47 UTC] tony2001@php.net
Use var_dump(getcwd());
 [2005-11-15 13:58 UTC] rd at mesos dot de
[root@server php-4.4.1]# ./sapi/cli/php test2.php 
bool(false)
bool(false)
olddir: 
[root@server php-4.4.1]# cat test2.php<?
$olddir = var_dump(getcwd());
var_dump(getcwd());
echo "olddir: $olddir\n";
?>
[root@server php-4.4.1]#
 [2005-11-15 14:06 UTC] sniper@php.net
You're doing something wrong, this works just fine for me:

# php -r 'echo getcwd();'
/usr/src/php_5_1

 [2005-11-15 14:08 UTC] tony2001@php.net
What's the values of HAVE_GETCWD and HAVE_GETWD in main/php_config.h ?
 [2005-11-15 14:11 UTC] rd at mesos dot de
that's why I am reporting that bug, it is working on several servers, but not on this one:

[root@server php-4.4.1]# ./sapi/cli/php -r 'echo getcwd();'
[root@server php-4.4.1]# 

It must be something special on this server, but I don't know where to start to search.
gcc version 3.3.3 
The same problem exists with PHP 4.4.0.
 [2005-11-15 14:12 UTC] tony2001@php.net
See my previous post.
 [2005-11-15 15:09 UTC] rd at mesos dot de
[root@server php-4.4.1]# grep HAVE_GETCWD main/php_config.h -i
/* #undef HAVE_GETCWD */
[root@server php-4.4.1]# grep HAVE_GETWD main/php_config.h -i
/* #undef HAVE_GETWD */
[root@server php-4.4.1]# 

Is that correct?
That's my configure-string:
'./configure' --with-apxs2 '--host=i386-redhat-linux' '--build=i386-redhat-linux' '--target=i386-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/usr/com' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--cache-file=../config.cache' '--with-config-file-path=/etc' '--with-config-file-scan-dir=/etc/php.d' '--enable-force-cgi-redirect' '--disable-debug' '--enable-pic' '--enable-inline-optimization' '--with-bz2' '--with-db4=/usr' '--with-curl' '--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr' '--with-png-dir=/usr' '--with-gd' '--enable-gd-native-ttf' '--with-gdbm' '--with-gettext' '--with-ncurses' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr' '--with-openssl' '--with-png' '--with-regex=php' '--with-xml' '--with-expat-dir=/usr' '--with-dom=/usr' '--with-dom-xslt=/usr' '--with-dom-exslt=/usr' '--with-xmlrpc' '--with-pcre-regex=/usr' '--with-zlib' '--with-layout=GNU' '--enable-bcmath' '--enable-exif' '--enable-ftp' '--enable-magic-quotes' '--enable-safe-mode' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-track-vars' '--enable-trans-sid' '--enable-wddx' '--with-pear=/usr/share/pear' '--with-imap' '--with-imap-ssl' '--with-kerberos' '--with-ldap' '--with-mysql=/usr' '--enable-ucd-snmp-hack' '--with-unixODBC=/usr' '--enable-memory-limit' '--enable-bcmath' '--enable-shmop' '--enable-calendar' '--enable-dbx' '--enable-dio' '--enable-mcal' '--enable-mbstring' '--enable-mbstr-enc-trans' '--enable-mbregex' '--enable-force-cgi-redirect'
 [2005-11-15 15:28 UTC] tony2001@php.net
Try with just plain `./configure --enable-debug`
 [2005-11-15 17:57 UTC] rd at mesos dot de
it worked.
So I tried different configure-strings, and if I remove '--cache-file=../config.cache' the original configure-string is working.

Thanks!
 [2005-11-15 18:02 UTC] tony2001@php.net
No bug then.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Oct 10 12:01:26 2024 UTC