getting scripts to run on PHP 5 with Windows NT

This is a discussion on getting scripts to run on PHP 5 with Windows NT within the PHP Language forums, part of the PHP Programming Forums category; I normally develop PHP projects on a Windows PC (WAMP) and then upload the stuff to Linux/Apache/MySQL4.x/...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-10-2005
DH
 
Posts: n/a
Default getting scripts to run on PHP 5 with Windows NT

I normally develop PHP projects on a Windows PC (WAMP) and then upload
the stuff to Linux/Apache/MySQL4.x/PHP4.x

Now I have to install a content management system on PHP 5 where the
server is Windows NT CS-PORTAL 5.2. The client owns the server, and
refuses to open a commercial web hosting account (as do all my other
clients).

phpinfo() doesn't return $_SERVER['DOCUMENT_ROOT'] which has me
wondering how many changes I'm going to have to make in my CMS in order
to get it to run on an NT server?

TIA. My news client crashed while posting this the first time. Please
excuse any resulting double-post.

Reply With Quote
  #2 (permalink)  
Old 01-10-2005
nc@iname.com
 
Posts: n/a
Default Re: getting scripts to run on PHP 5 with Windows NT

DH wrote:
>
> I have to install a content management system on PHP 5 where
> the server is Windows NT CS-PORTAL 5.2. The client owns the
> server, and refuses to open a commercial web hosting account
> (as do all my other clients).
>
> phpinfo() doesn't return $_SERVER['DOCUMENT_ROOT'] which has
> me wondering how many changes I'm going to have to make in my
> CMS in order to get it to run on an NT server?


Exactly two.

1. Run grep (or another search and replacement utility) and
change all occurences of $_SERVER['DOCUMENT_ROOT'] in your
code to a configuration variable, say, $docroot.

2. In your configuration file (you probably have one),
define the $docroot:

$docroot = $_SERVER['DOCUMENT_ROOT'];

This will be your default definition you will use for all
your clients. For the client you are having trouble with,
change this line manually to something like:

$docroot = 'C:/Inetpub/www';

Alternatively, check the output of phpinfo(); there may
be something usable in the $_ENV variable...

The lesson: don't expect environment variables to be there.
You don't know where your software may end up tomorrow. Set
defaults using environment variables, but be open to changing
settings during implementation...

Cheers,
NC

Reply With Quote
  #3 (permalink)  
Old 01-11-2005
CJ Llewellyn
 
Posts: n/a
Default Re: getting scripts to run on PHP 5 with Windows NT

"DH" <doug861@comcast.net> wrote in message
news:sc6dnQSlddDNV3_cRVn-hg@comcast.com...
> I normally develop PHP projects on a Windows PC (WAMP) and then upload
> the stuff to Linux/Apache/MySQL4.x/PHP4.x
>
> Now I have to install a content management system on PHP 5 where the
> server is Windows NT CS-PORTAL 5.2. The client owns the server, and
> refuses to open a commercial web hosting account (as do all my other
> clients).
>
> phpinfo() doesn't return $_SERVER['DOCUMENT_ROOT'] which has me
> wondering how many changes I'm going to have to make in my CMS in order
> to get it to run on an NT server?


Dunno, do you habitually use absolute paths in your programming?




Reply With Quote
  #4 (permalink)  
Old 01-11-2005
Chung Leong
 
Posts: n/a
Default Re: getting scripts to run on PHP 5 with Windows NT

"DH" <doug861@comcast.net> wrote in message
news:sc6dnQSlddDNV3_cRVn-hg@comcast.com...
> I normally develop PHP projects on a Windows PC (WAMP) and then upload
> the stuff to Linux/Apache/MySQL4.x/PHP4.x
>
> Now I have to install a content management system on PHP 5 where the
> server is Windows NT CS-PORTAL 5.2. The client owns the server, and
> refuses to open a commercial web hosting account (as do all my other
> clients).
>
> phpinfo() doesn't return $_SERVER['DOCUMENT_ROOT'] which has me
> wondering how many changes I'm going to have to make in my CMS in order
> to get it to run on an NT server?
>
> TIA. My news client crashed while posting this the first time. Please
> excuse any resulting double-post.


Is your client willing to install Apache 2? From my own experience PHP is
always somewhat flaky on IIS.

But to answer your question, it wouldn't be that hard to get it to work on
IIS. The following are variables provided by the ISAPI module:

"AUTH_PASSWORD",
"AUTH_TYPE",
"AUTH_USER",
"CONTENT_LENGTH",
"CONTENT_TYPE",
"PATH_TRANSLATED",
"QUERY_STRING",
"REMOTE_ADDR",
"REMOTE_HOST",
"REMOTE_USER",
"REQUEST_METHOD",
"SERVER_NAME",
"SERVER_PORT",
"SERVER_PROTOCOL",
"SERVER_SOFTWARE",
"APPL_MD_PATH",
"APPL_PHYSICAL_PATH",
"INSTANCE_ID",
"INSTANCE_META_PATH",
"LOGON_USER",
"REQUEST_URI",
"URL",

Not on the list are DOCUMENT_ROOT, SCRIPT_NAME, and SCRIPT_FILENAME.


Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 10:08 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0