NYCPHP Meetup

NYPHP.org

[nycphp-talk] IIS a dysfunctional kludge?

Paul A Houle paul at devonianfarm.com
Fri Jan 15 13:00:58 EST 2010


Chris Snyder wrote:
> One thing I haven't seen on this thread: for those of you who develop
> on Linux and deploy on Windows (or vice versa, more likely) how do you
> deal with the differences in file names, line endings, and $_SERVER
> vars?
>
>   
    One little secret about Windows is that the WIN32 API accepts '/' as 
a path separator character.  Even DOS accepted / from the very 
beginning,  see

http://blogs.msdn.com/larryosterman/archive/2005/06/24/432386.aspx

    for a really great story.  For the most part you can always use '/' 
and not have trouble.  The one exception is that you WILL have trouble 
if you pass a filename with a / in it to CMD.EXE batch script,  since 
'/' plays a role similar to '-' in UNIX.

    Line endings typically aren't a big deal in web apps.  (Browsers 
don't care)  Apps on Windows aimed at developer (say the editor in 
Dreamweaver or Visual Studio) are designed to accept either UNIX style 
or Windows styles line endings and I think that's the way to do it.  I 
think the worst trouble I had in this department was getting PHP on 
Windows to send mail through qmail on UNIX (which is tougher than most 
MTAs about line endings.)

    Most other problems can be smoothed over with compatibility 
functions:  for instance,  write your own function for appending to 
php_in_path that uses ';' on Windows and ':' on UNIX.  You ought to have 
encapsulated $_GET,  $_POST and all of that anyway since somebodu might 
have turned on magic_quotes_gpc on your server.
> I try to match my dev and production environments as closely as
> possible to avoid portability bugs, but that means I have to jump
> through some hoops, like using a dev server rather than just
> installing xampp on my laptop.
>   
    I do it both ways.  One project I'm working on depends on a 20 GB 
semantic database so I do most of the development on my Linux server...  
Some people might mbe shocked,  but I use Dreamweaver as an editor there 
since it's usable editor with the ability to work transparently over SFTP.



More information about the talk mailing list