Re: [PHP-DEV] useless config.w32.h and solutions

2002-12-01 Thread Pierre-Alain Joye
On Sun, 1 Dec 2002 09:48:35 -0500
Dan Kalowsky [EMAIL PROTECTED] wrote:

Sounds like an interesting idea, but does this:

 A) accurately reflect the changes you want to do (I think the #defines
 are messed up)

They are here, but useless ;-)

 B) work at all on a pre-built binary?

I do not believe it will work if we define it where it is actually.
Should we set them during the initialisation process using getenv ?
I just never gone in these part of php sources, I cannot confirm or not
this point. But that sounds a possible way, or ?

hth

pierre

-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DEV] useless config.w32.h and solutions

2002-12-01 Thread Frank M. Kromann
We could change it to something like this:

#define PEAR_INSTALLDIR
(getenv(PEAR_INSTALLDIR))?getenv(PEAR_INSTALLDIR):c:\\php4\\pear
#define PHP_BINDIR (getenv(PHP_BINDIR))?getenv(PHP_BINDIR):c:\\php4
#define PHP_CONFIG_FILE_PATH
(getenv(PHP_CONFIG_FILE_PATH))?getenv(PHP_CONFIG_FILE_PATH):
#define PHP_CONFIG_FILE_SCAN_DIR
(getenv(PHP_CONFIG_FILE_SCAN_DIR))?getenv(PHP_CONFIG_FILE_SCAN_DIR):
#define PHP_DATADIR
(getenv(PHP_DATADIR))?getenv(PHP_DATADIR):c:\\php4
#define PHP_EXTENSION_DIR
(getenv(PHP_EXTENSION_DIR))?getenv(PHP_EXTENSION_DIR):c:\\php4
#define PHP_INCLUDE_PATH
(getenv(PHP_INCLUDE_PATH))?getenv(PHP_INCLUDE_PATH):.;c:\\php4\\pear
#define PHP_LIBDIR (getenv(PHP_LIBDIR))?getenv(PHP_LIBDIR):c:\\php4
#define PHP_LOCALSTATEDIR
(getenv(PHP_LOCALSTATEDIR))?getenv(PHP_LOCALSTATEDIR):c:\\php4
#define PHP_PREFIX (getenv(PHP_PREFIX))?getenv(PHP_PREFIX):c:\\php4
#define PHP_SYSCONFDIR
(getenv(PHP_SYSCONFDIR))?getenv(PHP_SYSCONFDIR):c:\\php4

- Frank


 Hello,
 
 After a nth discussion on phpdev with Stig, Sebastian and me, I post
 this message to ask you the way we should go to solve the problem of
 useless constants define in config.w32.h (see bottom).
 
 The main idea is to check if an environment is available and use it. It
 will not be too complicated to do it and makes the php configuration
 easier under win32 and, why not, more flexible on others platforms (if
 there is a need), which something like a per host or per user under CLI
 mode configuration.
 
 I do not have enough knowledge on the php intern processes to help here
 (*sick*), but at least, I can ran compile tests and running tests under
 different windows platforms.
 
 Any comments ?
 
 hth
 
 pierre
 
 code
 #define CONFIGURATION_FILE_PATH php.ini
 #define PEAR_INSTALLDIR c:\\php4\\pear
 #define PHP_BINDIR c:\\php4
 #define PHP_CONFIG_FILE_PATH
 #(getenv(SystemRoot))?getenv(SystemRoot): define
 #PHP_CONFIG_FILE_SCAN_DIR  define PHP_DATADIR c:\\php4
 #define PHP_EXTENSION_DIR c:\\php4
 #define PHP_INCLUDE_PATH.;c:\\php4\\pear
 #define PHP_LIBDIR c:\\php4
 #define PHP_LOCALSTATEDIR c:\\php4
 #define PHP_PREFIX c:\\php4
 #define PHP_SYSCONFDIR c:\\php4
 /code
 
 -- 
 PHP Development Mailing List http://www.php.net/
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 




-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DEV] useless config.w32.h and solutions

2002-12-01 Thread Pierre-Alain Joye
On Sun, 01 Dec 2002 07:57:18 -0800
Frank M. Kromann [EMAIL PROTECTED] wrote:

 We could change it to something like this:
 
 #define PEAR_INSTALLDIR
 (getenv(PEAR_INSTALLDIR))?getenv(PEAR_INSTALLDIR):c:\\php4\\pear

As far as I remember, that s what has been done weeks ago and causes a
compile error. Can you test it on a win32 build ? I should do it later
tonight or tomorrow.

pierre

-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php





Re: [PHP-DEV] useless config.w32.h and solutions

2002-12-01 Thread Frank M. Kromann

Yu are right. Two of the values needs to be constants, as these are used
in building the INI array.

Setting the constants to this works:

#define PEAR_INSTALLDIR
(getenv(PEAR_INSTALLDIR))?getenv(PEAR_INSTALLDIR):c:\\php4\\pear
#define PHP_BINDIR (getenv(PHP_BINDIR))?getenv(PHP_BINDIR):c:\\php4
#define PHP_CONFIG_FILE_PATH
(getenv(PHP_CONFIG_FILE_PATH))?getenv(PHP_CONFIG_FILE_PATH):
#define PHP_CONFIG_FILE_SCAN_DIR
(getenv(PHP_CONFIG_FILE_SCAN_DIR))?getenv(PHP_CONFIG_FILE_SCAN_DIR):
#define PHP_DATADIR
(getenv(PHP_DATADIR))?getenv(PHP_DATADIR):c:\\php4
#define PHP_EXTENSION_DIR c:\\php4
#define PHP_INCLUDE_PATH .;c:\\php4\\pear
#define PHP_LIBDIR (getenv(PHP_LIBDIR))?getenv(PHP_LIBDIR):c:\\php4
#define PHP_LOCALSTATEDIR
(getenv(PHP_LOCALSTATEDIR))?getenv(PHP_LOCALSTATEDIR):c:\\php4
#define PHP_PREFIX (getenv(PHP_PREFIX))?getenv(PHP_PREFIX):c:\\php4
#define PHP_SYSCONFDIR
(getenv(PHP_SYSCONFDIR))?getenv(PHP_SYSCONFDIR):c:\\php4

PHP_EXTENSION_DIR and PHP_INCLUDE_PATH can both be specified in php.ini
and perhaps we can find a way to set them by environment variables ?

- Frank
 On Sun, 01 Dec 2002 07:57:18 -0800
 Frank M. Kromann [EMAIL PROTECTED] wrote:
 
  We could change it to something like this:
  
  #define PEAR_INSTALLDIR
 
(getenv(PEAR_INSTALLDIR))?getenv(PEAR_INSTALLDIR):c:\\php4\\pear
 
 As far as I remember, that s what has been done weeks ago and causes a
 compile error. Can you test it on a win32 build ? I should do it later
 tonight or tomorrow.
 
 pierre
 




-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DEV] useless config.w32.h and solutions

2002-12-01 Thread Preston L. Bannister
There is an impedence mismatch here between typical usage on Unix and
typical usage on Windows.  Some infomation that can typically be compiled-in
on Unix must be determined at runtime on Windows.

I don't believe the environment is really a good place to be expecting this
information - not on Windows.  You run into trouble with differing
applications (bundling PHP) needing to use differing values.  If any of this
is run from a service context - it's just not going to work out well.

There is a logical approach to deriving most or all this information on
Windows that works out a bit more cleanly.

Lets start from the beginning.

PHP_BINDIR  c:\\php4
PEAR_INSTALLDIR c:\\php4\\pear
PHP_CONFIG_FILE_PATH
PHP_CONFIG_FILE_SCAN_DIR
PHP_DATADIR c:\\php4
PHP_EXTENSION_DIR   c:\\php4
PHP_INCLUDE_PATH.;c:\\php4\\pear
PHP_LIBDIR  c:\\php4
PHP_LOCALSTATEDIR   c:\\php4
PHP_PREFIX  c:\\php4
PHP_SYSCONFDIR  c:\\php4

PHP_BINDIR can be exactly determined at runtime (using GetModuleHandle() and
GetModuleFileName() - I can supply the idiom and bewares).

Once you know where PHP was installed, you can assume by default the other
directories as relative.  So you have:

PHP_DATADIR %PHP_BINDIR%
PHP_EXTENSION_DIR   %PHP_BINDIR%
PHP_INCLUDE_PATH.;%PHP_BINDIR%
PHP_LIBDIR  %PHP_BINDIR%
PHP_LOCALSTATEDIR   %PHP_BINDIR%
PHP_PREFIX  %PHP_BINDIR%
PHP_SYSCONFDIR  %PHP_BINDIR%
PEAR_INSTALLDIR %PHP_BINDIR%\\pear

Since these are all computed values, it would be a good idea to eliminate
the compile-time constants.  Better to not pretend - as this will help you
find code that might be a problem.

Finally you go looking for a configuration file to override the defaults.
If the configuration file was not specified on the command line, then you
pick it up from (usually) the installation directory.

( Microsoft sells the idea of using the registry at this point, but in
practice I've found it better to make only minimal use of the registry ).

What I had not figured out last I had time to look at the code, was how to
plug in computed values as though they were compiled in.


-Original Message-
From: Frank M. Kromann [mailto:[EMAIL PROTECTED]]
Sent: Sunday, December 01, 2002 11:55 AM

Yu are right. Two of the values needs to be constants, as these are used
in building the INI array.

Setting the constants to this works:

#define PEAR_INSTALLDIR
(getenv(PEAR_INSTALLDIR))?getenv(PEAR_INSTALLDIR):c:\\php4\\pear
#define PHP_BINDIR (getenv(PHP_BINDIR))?getenv(PHP_BINDIR):c:\\php4
#define PHP_CONFIG_FILE_PATH
(getenv(PHP_CONFIG_FILE_PATH))?getenv(PHP_CONFIG_FILE_PATH):
#define PHP_CONFIG_FILE_SCAN_DIR
(getenv(PHP_CONFIG_FILE_SCAN_DIR))?getenv(PHP_CONFIG_FILE_SCAN_DIR):
#define PHP_DATADIR
(getenv(PHP_DATADIR))?getenv(PHP_DATADIR):c:\\php4
#define PHP_EXTENSION_DIR c:\\php4
#define PHP_INCLUDE_PATH .;c:\\php4\\pear
#define PHP_LIBDIR (getenv(PHP_LIBDIR))?getenv(PHP_LIBDIR):c:\\php4
#define PHP_LOCALSTATEDIR
(getenv(PHP_LOCALSTATEDIR))?getenv(PHP_LOCALSTATEDIR):c:\\php4
#define PHP_PREFIX (getenv(PHP_PREFIX))?getenv(PHP_PREFIX):c:\\php4
#define PHP_SYSCONFDIR
(getenv(PHP_SYSCONFDIR))?getenv(PHP_SYSCONFDIR):c:\\php4

PHP_EXTENSION_DIR and PHP_INCLUDE_PATH can both be specified in php.ini
and perhaps we can find a way to set them by environment variables ?

- Frank

 On Sun, 01 Dec 2002 07:57:18 -0800
 Frank M. Kromann [EMAIL PROTECTED] wrote:

  We could change it to something like this:
 
  #define PEAR_INSTALLDIR
 
(getenv(PEAR_INSTALLDIR))?getenv(PEAR_INSTALLDIR):c:\\php4\\pear

 As far as I remember, that s what has been done weeks ago and causes a
 compile error. Can you test it on a win32 build ? I should do it later
 tonight or tomorrow.


-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php