Page 1 of 1

PHP portability considerations

Posted: Mon Oct 28, 2002 6:09 am
by Heavy
Which things should be thought of when designing PHP code to work on multiple platforms?

First:
* Filesystem differences. "D:\web_pub" and "/web_pub" for example.

Posted: Mon Oct 28, 2002 6:33 am
by mydimension
you actually don't have to worry about filesystem syntax to much. as long has you use *nix slashes, php will take care of the rest. what you would do is use realative paths everywhere and then have a single variable that holds the base path. the base bath could either be "C:/htdocs" or "/usr/htdocs". then just prepend that to all your relative paths.

Posted: Mon Oct 28, 2002 8:15 am
by Heavy
Ok.
One issue is that every path/file has to be referenced with CoRrEcT cHaRaCtEr CaSe for *nix systems.

Please, come up with some more!

Posted: Mon Oct 28, 2002 8:57 am
by BDKR
Doesn't some of this depend on what the project is? What features are you using and are they supported on both platforms? Shared Memory and semaphores for example. How about sockets?

Cheers,
BDKR

Posted: Mon Oct 28, 2002 9:32 am
by mydimension
a major descrpency is the mail() function. on *nix systems there is almost no setup required. on win32 systems there is a lot more to setup. (i.e. what smtp server to use, etc.)

Posted: Mon Oct 28, 2002 9:33 am
by twigletmac
You need to document the settings that will be used in the php.ini - so that you know what configuration needs to take place for the site to work as expected.

Mac

Posted: Mon Oct 28, 2002 2:00 pm
by Heavy
So far, you are right on track.
I posted to learn about system differences, and you are teaching me! :D
Please go on! :lol:

I am a total newbie regarding:
Shared Memory and semaphores for example. How about sockets?
How are those things typically controlled from PHP and why should I consider using them?
Is there a concise URL I could follow to learn about those things?
I didn't check the manual right now 8O ...

Posted: Tue Oct 29, 2002 7:42 am
by BDKR
Hey,

Shared memory and semaphores are not often used in web development. That prolly accounts for why it's not often spoke of or covered in tutorials and such. As for sockets, there has been a generic implementation of sockets for some time. In the meantime, the socket functions are still considered experimental (based on the last post I read on the php mailing list).

I've used all of the above with PHP, but not in web development. These are the kinds of things that are paving the way to making PHP a pretty good general purpose language, in much the same way that Perl became such.

Now this isn't to say that the above can't be used in web development. They can. I had considered the user of shared memory for maintaing session information for example. There
are probably a good number of possibilities. It just depends on what you need to do.

Cheers,
BDKR