PHP portability considerations

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
User avatar
Heavy
Forum Contributor
Posts: 478
Joined: Sun Sep 22, 2002 7:36 am
Location: Viksjöfors, Hälsingland, Sweden
Contact:

PHP portability considerations

Post 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.
Last edited by Heavy on Tue Oct 29, 2002 1:48 pm, edited 1 time in total.
User avatar
mydimension
Moderator
Posts: 531
Joined: Tue Apr 23, 2002 6:00 pm
Location: Lowell, MA USA
Contact:

Post 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.
User avatar
Heavy
Forum Contributor
Posts: 478
Joined: Sun Sep 22, 2002 7:36 am
Location: Viksjöfors, Hälsingland, Sweden
Contact:

Post 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!
User avatar
BDKR
DevNet Resident
Posts: 1207
Joined: Sat Jun 08, 2002 1:24 pm
Location: Florida
Contact:

Post 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
User avatar
mydimension
Moderator
Posts: 531
Joined: Tue Apr 23, 2002 6:00 pm
Location: Lowell, MA USA
Contact:

Post 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.)
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post 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
User avatar
Heavy
Forum Contributor
Posts: 478
Joined: Sun Sep 22, 2002 7:36 am
Location: Viksjöfors, Hälsingland, Sweden
Contact:

Post 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 ...
User avatar
BDKR
DevNet Resident
Posts: 1207
Joined: Sat Jun 08, 2002 1:24 pm
Location: Florida
Contact:

Post 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
Post Reply