Jump to content

platform indipendent


birbal

Recommended Posts

how can i make a script platform indipendent? i am geting frustrated to fix the scirpts when i move on the scripts to different platform(eg linux-win vice versa).(i was using linux before)it is wireing now and i am getting confused with different notations. please clarify from the basics for windows and linux separately.thank you

Link to comment
Share on other sites

The simple answer is not to use anything that is platform-dependent. If you're looking for a list of those things, it's a long list. Many extensions and functions depend on OS commands to do certain things, so they only work on certain OSs. Here's an example, on Windows servers this function only works on certain versions:http://www.php.net/manual/en/function.symlink.phpFor other things, PHP defines constants to represent operating system values. Don't hard-code a backslash in a directory path, for example, when you should be using the DIRECTORY_SEPARATOR constant, which contains the OS-defined directory separator.PHP options are something else to consider. Don't rely on things like short tags or magic quotes when they may be enabled or disabled on various servers. When possible, detect what the environment is and respond appropriately. If magic quotes is on, for example, then you need to use stripslashes when you get data from $_GET, $_POST, or $_COOKIE. Otherwise, you don't. The basic rule is to check settings in the script instead of assuming you know what they are.

Link to comment
Share on other sites

yes thats what i was looking for. i was expecting there is a good manner to do it.

If you're looking for a list of those things, it's a long list.
and can you give any link of those list which i can take a look.and what about ../ and / is it react different from linux and windows?
Link to comment
Share on other sites

...thanks for the help again.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...