ID:               17516
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
-Status:           Closed
+Status:           Open
-Bug Type:         Feature/Change Request
+Bug Type:         *Configuration Issues
 Operating System: Windows
 PHP Version:      4.0CVS-2002-05-29
 Assigned To:      ssb
 New Comment:

Reopened, should maybe be marked as critical:

Setting the environment variables has no effect or strange effects) on
PHP constants on Win32. This might be the main cause for pear
installations failing on windows if php is not installed in c:\php4
(and for PEAR BETA status on Win32).

In the following test script
- PHP_BINDIR is set in the environment
- The setting does not get reflected in the PHP constant
- Mistriously it's not read correctly by getenv()

test script (dos shell):
************************
set PHP_BINDIR="my_php_bindir"
set PHP_BINDIR
cli\php -r "echo PHP_BINDIR;"
cli\php -r "echo getenv('PHP_BINDIR');"


Previous Comments:
------------------------------------------------------------------------

[2002-10-07 20:15:40] [EMAIL PROTECTED]

This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.

Here's the new code.  If you have MSVC installed, please try building
and test if you can actually set these PHP constants through
environment.

#define CONDENV(ev,def) (getenv(ev)!=NULL?getenv(ev):def)

#define CONFIGURATION_FILE_PATH "php.ini"
#define PEAR_INSTALLDIR          CONDENV("PEAR_INSTALLDIR",
"c:\\php4\\pear")
#define PHP_BINDIR               CONDENV("PHP_BINDIR", "c:\\php4")
#define PHP_CONFIG_FILE_PATH     CONDENV("SystemRoot", "")
#define PHP_CONFIG_FILE_SCAN_DIR CONDENV("PHP_CONFIG_FILE_SCAN_DIR",
"")
#define PHP_DATADIR              CONDENV("PHP_DATADIR", "c:\\php4")
#define PHP_EXTENSION_DIR        CONDENV("PHP_EXTENSION_DIR",
"c:\\php4")
#define PHP_INCLUDE_PATH         CONDENV("PHP_INCLUDE_PATH",
".;c:\\php4\\pear")
#define PHP_LIBDIR               CONDENV("PHP_LIBDIR", "c:\\php4")
#define PHP_LOCALSTATEDIR        CONDENV("PHP_LOCALSTATEDIR",
"c:\\php4")
#define PHP_PREFIX               CONDENV("PHP_PREFIX", "c:\\php4")
#define PHP_SYSCONFDIR           CONDENV("PHP_SYSCONFDIR", "c:\\php4")



------------------------------------------------------------------------

[2002-05-29 16:52:31] [EMAIL PROTECTED]

While working with PEAR installer it occurred that the pear.ini setting
file got placed in a newly created directory c:\php4. This dir is
hardcoded in:

http://cvs.php.net/co.php/php4/main/config.w32.h.in

To respect other php installations like in c:\php or c:\programme\php
one need a feature to override the constants given by the php core:

http://www.php.net/manual/en/reserved.constants.core.php

Since scripts in PEAR are designed using these constants, and constants
are not variable, there is probably only one way to override these
values in config.w32.h.in e.g. like:

#define PHP_SYSCONFDIR ( (getenv("PHP_SYSCONFDIR") != "c:\\php4" ) ?
getenv("PHP_SYSCONFDIR" ) : "c:\\php4" )

This allows the user to configure its paths by hand through setting the
environment variables like:

c:\>set PHP_SYSCONFDIR=c:\php

I propose to do this switch for all path related constants in
config.w32.h.in [DIRECTORY_SEPARATOR, PHP_SYSCONFDIR,
DEFAULT_INCLUDE_PATH, PEAR_INSTALL_DIR, PEAR_EXTENSION_DIR,
PHP_EXTENSION_DIR, PHP_BINDIR, PHP_LIBDIR, PHP_DATADIR, PHP_SYSCONFDIR,
PHP_LOCALSTATEDIR, PHP_CONFIG_FILE_PATH].

-urs

------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=17516&edit=1

Reply via email to