Forum Moderators: coopster
[webmasterworld.com...]
--> Hopefully this is easy enough. How do I check to see if I'm in ISAPI mode- how do I change it if I am?
Thanks for any ideas-
AFAIK the best way to tell if you're in ISAPI "mode" is to look at what server you're using. If you're using a Microsoft server (IIS or PWS) you'll undoubtedly have the ISAPI module installed. So the only way to change it would be to switch servers. If, that is, I read your question correctly.
You can gain some information using php_sapi_name()... it will return the "type of interface between web server and PHP" [php.net].
...and the environment variable GATEWAY_INTERFACE will return "what revision of the CGI specification the server is using; i.e. 'CGI/1.1'." [php.net].
I imagine you've checked the php installation using php_info() to see if register_globals is 'on' or 'off'.
If you don't have control over your php installation (access to the php.ini file) there are work-arounds. BUT, read and take to heart the reasons why register_globals now defaults to "off". Get both here [php.net].
Hope this helps.
T
Used locally you don't have the security concerns of a networked situation but bear in mind that if you have any notion of using your code online you may have to rewrite it to suit the host's setup and your clients' needs/desires.
>better or worse?
In the long run it's best to go with the flow and get used to writing scripts with register_globals "off".
$_SERVER['REMOTE_ADDR'];
to attain the IP address rather than:
getenv("REMOTE_ADDR");
this is what php.net suggests.
In httpd.conf:
LoadModule php4_module c:/php/sapi/php4apache.dll
Would this suggest I'm running in ISAPI - how would I change that if it's the case > I could be in leftfield but doesn't hurt to ask;0
You simply need to decide which way you want to set up your server. Using mod_php is the recommended way. BTW you might not want to refer to ISAPI, which is the Internet Server Application Programming Interface when you are talking about the Apache webserver.
In PHP 4.1 and later the recommended way to access predefined variables is by using the autoglobal associative arrays. I see no need to use getenv() anymore.
Andreas