473,401 Members | 2,127 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,401 software developers and data experts.

Portability of PHP from windows to Linux

Hello,

I am new to the open source environment. We have to develop a web
application using Apache/PHP/MySQL on Windows (A component that we want
to use is available only on Windows for now). Later when the component
is available on Linux, we would like to move the code.

The web application is a simple one - collects data, does some simple
validations and stores in the database.

I would like to know how portable the code will be. Do we need to
rewrite a lot of code when we move from Windows to Linux? What are the
issues I need to be aware of?

Thanks for your help,
seth

Aug 30 '05 #1
8 2060
Probably not too bad. The main thing would be adjusting any hard-coded
paths to files -- both in the code and in php.ini (since the filepaths
in Linux use / to separate directories). You will probably need to
check permissions on directories and files that the application
requires.

The other place you might run into trouble is connecting to any
databases -- only because modules and extensions are loaded differently
under Linux than they would be on Windows. That's more of a PHP setup
issue than a code problem.

There are probably also differences in how you might interact with the
operating system -- especially the file system. Opening and writing to
files, etc. might have slight different requirements or limitations
under a different OS.

I'd say that it shouldn't be too difficult, but be prepared to spend a
little time adjusting your PHP configuration and make some minor code
changes. Above all, test it first!

Aug 31 '05 #2
seth wrote:
Hello,

I am new to the open source environment. We have to develop a web
application using Apache/PHP/MySQL on Windows (A component that we want
to use is available only on Windows for now). Later when the component
is available on Linux, we would like to move the code.

The web application is a simple one - collects data, does some simple
validations and stores in the database.

I would like to know how portable the code will be. Do we need to
rewrite a lot of code when we move from Windows to Linux? What are the
issues I need to be aware of?

Thanks for your help,
seth


If it is simple what is the component that will only work on Windows?

It is usually the case that all of the really nifty components are more
readily available on Linux, because PHP is really just an interface into
the many libraries available on that platform.

--
Kenneth Downs
Secure Data Software, Inc.
(Ken)nneth@(Sec)ure(Dat)a(.com)
Aug 31 '05 #3
seth wrote:
I would like to know how portable the code will be. Do we need to
rewrite a lot of code when we move from Windows to Linux? What are the
issues I need to be aware of?


The code I wrote that works fine on my local EasyPHP testing server
(Windows) failed on a commercial server (Linux) because table/field
names in the MySQL database were apparently case sensitive on the server
(Worked fine here). Watch out :). All lowercase names is a good standard.

Cheers,
Nicholas Sherlock
Aug 31 '05 #4
NC
seth wrote:

I am new to the open source environment. We have to develop a web
application using Apache/PHP/MySQL on Windows (A component that we want
to use is available only on Windows for now). Later when the component
is available on Linux, we would like to move the code.

The web application is a simple one - collects data, does some simple
validations and stores in the database.

I would like to know how portable the code will be. Do we need to
rewrite a lot of code when we move from Windows to Linux? What are the
issues I need to be aware of?


Generally, PHP code is portable with zero rewrites, unless OS-specific
extensions are used. For example, shared memory and semaphores are not

available on Windows, while COM is available only on Windows. So an
application relying on shared memory or semaphores will not work under
Windows, while an application using COM will work only on Windows.

Check the documentation for extensions you are using for any
OS-specific
notes.

Cheers,
NC

Aug 31 '05 #5
Following on from seth's message. . .
I would like to know how portable the code will be. Do we need to
rewrite a lot of code when we move from Windows to Linux? What are the
issues I need to be aware of?

Not a big issue, in fact I would say just the same as going from one
version of something to another: There might be odd niggles which cause
frustration but nothing to cause you to do any serious rewrites. You'll
just find that something that worked fails possibly with an error and is
fixed by trivial tweak to paths, filenames and permissions. This might
be due to different versions of PHP, mySQL, Apache and sillynesses with
config files.

Bottom line is assume it will work as-is but be prepared for some
tweaks.

--
PETER FOX Not the same since the statuette business went bust
pe******@eminent.demon.co.uk.not.this.bit.no.html
2 Tees Close, Witham, Essex.
Gravity beer in Essex <http://www.eminent.demon.co.uk>
Aug 31 '05 #6

"Nicholas Sherlock" <n_********@hotmail.com> wrote in message
news:df**********@lust.ihug.co.nz...
seth wrote:
I would like to know how portable the code will be. Do we need to
rewrite a lot of code when we move from Windows to Linux? What are the
issues I need to be aware of?


The code I wrote that works fine on my local EasyPHP testing server
(Windows) failed on a commercial server (Linux) because table/field
names in the MySQL database were apparently case sensitive on the server
(Worked fine here). Watch out :). All lowercase names is a good standard.

Cheers,
Nicholas Sherlock


I have had the same experience. The bigger problem was different versions of
PHP and MySql on the Windows and Linux servers. Usually the Linux servers
seem to be running newer versions.

Al Kolff
Aug 31 '05 #7
On 31 Aug 2005 00:43:46 -0700, "NC" <nc@iname.com> wrote:
For example, shared memory and semaphores are not
available on Windows


Actually shared memory is available through: http://uk2.php.net/shmop
The example script runs fine here on Windows 2000.

But presumably you were referring to the System V IPC stuff.

--
Andy Hassall :: an**@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Aug 31 '05 #8
People,

Thanks for all your replies. The information you have provided is
really helpful. I really appreciate you all for taking time to respond.

It started me thinking.
Can PHP call APIs in a 'custom windows dll' as effectively as ASP?
Looks like there could be some issues here, based on some of the posts
I saw.

Thanks,
seth

Sep 1 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Google Mike | last post by:
No, this isn't what you thought the subject of this post meant. It's better. I just wanted to share with you something I did that makes editing PHP and carrying your projects back and forth a...
5
by: Nick Mudge | last post by:
I have PHP 4 running as a module on windows XP, I also have MySQL and Apache 2 running on windows XP. If I write a big website on my computer that has XP and I use PHP, MySQL and Apache 2, and...
7
by: fabio de francesco | last post by:
Hi, I'm not a professional programmer, but I've been writing C/C++ and Ada programs for a few years on GNU/Linux without ever concerning on standards and portability to other OSs. I've always...
3
by: Walter Dnes (delete the 'z' to get my real address | last post by:
I'm doing some stuff at home that I can't justify doing on work time, mostly to learn C programming. But it might possibly be useful at work. I run linux at home at home and Windows at work. One...
93
by: roman ziak | last post by:
I just read couple articles on this group and it keeps amazing me how the portability is used as strong argument for language cleanliness. In my opinion, porting the program (so you just take the...
25
by: Stephen Mayes | last post by:
From lurking on this most excellent newsgroup, I have garnered that an expressed benefit of having a standard is portability of code. I see a lot of open source endeavors that inspire my awe, but I...
35
by: Sunil | last post by:
Hi all, I am using gcc compiler in linux.I compiled a small program int main() { printf("char : %d\n",sizeof(char)); printf("unsigned char : ...
4
by: Abra | last post by:
I need to write a Windows application with GUI, that should be able to run also on Linux. I have already a .NET application (written in C#) that uses (among others) Windows.Forms, ADO.NET, and...
93
by: jacob navia | last post by:
In this group there is a bunch of people that call themselves 'regulars' that insist in something called "portability". Portability for them means the least common denominator. Write your code...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.