#17516 [Csd->Opn]: overriding constants in config.w32.h.in

From: Date: Mon, 24 Mar 2003 21:59:44 +0000
Subject: #17516 [Csd->Opn]: overriding constants in config.w32.h.in
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-36322@lists.php.net to get a copy of this message
ID: 17516 Updated by: stone@php.net Reported By: urs@php.net -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] ssb@php.net 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] urs@php.net 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

« previous php.bugs (#36322) next »