differences in running php scripts on a windows and linux

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
carnivore
Forum Newbie
Posts: 3
Joined: Sun Jun 16, 2002 5:42 pm

differences in running php scripts on a windows and linux

Post by carnivore »

What is the differences in running php scripts on a windows and linux server? I have looked at the scripts but really can't and major differences in the script whether it has been writing for a particular server.

[/quote][/b]
User avatar
hob_goblin
Forum Regular
Posts: 978
Joined: Sun Apr 28, 2002 9:53 pm
Contact:

Post by hob_goblin »

you can't chmod in windows ;)
carnivore
Forum Newbie
Posts: 3
Joined: Sun Jun 16, 2002 5:42 pm

Post by carnivore »

I should have made myself clearer. Can a script be writin exclusively for linux that it will fail to work on a windows server, and vise versa?

I see examples that say a script will work on Linux, does that rule it out altogether from being run on windows??
Zmodem
Forum Commoner
Posts: 84
Joined: Thu Apr 18, 2002 3:59 pm

Post by Zmodem »

MOST functions and features work on both windows and linux.

There are some subtle differences though. One was mentioned above.

Another one is the use of path names. Such as those used in include().

A lot of scripts writen for linux will do something like this:

Code: Select all

include ("./myfile.php");
That will not work on windows, because of the ./ (dot slash) at the beginning.

However, if the statement were to be written as:

include ("myfile.php");

it would work on BOTH OS's.

In older versions of PHP, sockets didn't work all that well on windows, but did on linux. Also, CC and BCC don't seem to function in the mail() command on windows (at least I couldn't get them to work)

I would say 95% of PHP is totally cross platform.

Hope that helps.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

are you trying to write such a script (working on linux but not on windows) deliberately? :cry:
Peter
Forum Commoner
Posts: 28
Joined: Mon Jun 10, 2002 12:40 am
Location: Brisbane, Australia

Post by Peter »

Sendmail or rather mail() is non-existant on windows systems.

I think most differences are to with the filesystem function and directory functions because obviously Linux and Windows have different filesystems. If not, I'd love to see a C:\windows\ directory on linux OS. :P
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

mail() is working under php/win32, but you have to set SMTP = <smtp server>
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Peter wrote:mail() is non-existant on windows systems.
No, mail() does work on Windows because instead of sendmail you can specify a SMTP server for the mail to be sent through.
carnivore wrote:I see examples that say a script will work on Linux, does that rule it out altogether from being run on windows??
Not necessarily, sometimes it means that the person who wrote the script has only tested it on Linux machines (they know it works on Linux but don't know if it works on Windows) so you may be able to run it on Windows with little or no tweaking.

Mac
User avatar
mikeq
Forum Regular
Posts: 512
Joined: Fri May 03, 2002 3:33 am
Location: Edinburgh, Scotland

Post by mikeq »

My developement boxes are windows, but my production box runs some version of Linux.

I have never had to change any code to worl around the different OS's
carnivore
Forum Newbie
Posts: 3
Joined: Sun Jun 16, 2002 5:42 pm

Thank you

Post by carnivore »

:D Thank you everyone for your help
Post Reply