By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,871 Members | 2,304 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,871 IT Pros & Developers. It's quick & easy.

getting scripts to run on PHP 5 with Windows NT

P: n/a
DH
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.

Jul 17 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
nc
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

Jul 17 '05 #2

P: n/a
"DH" <do*****@comcast.net> wrote in message
news:sc********************@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?


Jul 17 '05 #3

P: n/a
"DH" <do*****@comcast.net> wrote in message
news:sc********************@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.
Jul 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.