Could you point what is the major differences and what must be concerned when changing PHP use from Windows to Linux (Debian f.e.)?

Hi Experts

Could you point what is the major differences and what must be concerned when changing PHP use from Windows to Linux (Debian f.e.) ?

Thanks in advance!
Eduardo FuerteAsked:
Who is Participating?
David FavorConnect With a Mentor Linux/LXD/WordPress/Hosting SavantCommented:
Several items to consider.

When speaking about Linux, each Distro has it unique characteristics.

Debian is great if you have time to burn. Same with all RedHat derivatives, as yum has no real dependency processing.

If you're looking to be up + running quickly + be able to simply install Apache + MariaDB + PHP + OpenSSL, use Ubuntu... along with these commands to setup PPAs (repositories) which always pull latest stable code.

# Host only, unless you're running nested containers
add-apt-repository ppa:ubuntu-lxc/lxd-stable < /dev/null

# Container level
apt-get -y install software-properties-common

# Setup latest stable
LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php </dev/null
LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/apache2 </dev/null
LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/nginx </dev/null

add-apt-repository ppa:pdoes/dovecot </dev/null

apt-key adv --recv-keys --keyserver hkp:// 0xF1656F24C74CD1D8
echo "deb [arch=amd64,i386] $(lsb_release -sc) main" > /etc/apt/sources.list.d/mariadb-$(lsb_release -sc).list

# Freshen local package caches
apt-get update

# Ensure latest versions correct
apt-cache policy apache2 php7.1 mariadb-server dovecot-core openssl

Open in new window

NGINX creates massive extra complexity for no speed improvement (testing tells this every time). I've included it here for completeness.

If you're use to Windows, Ubuntu will be a breath of fresh air, because Windows attempts to obfuscate all things + Linux attempts to make all things transparent + easy to understand.
Dave BaldwinFixer of ProblemsCommented:
Sorry, Ubuntu will NOT be a breath of fresh air for first time users coming from Windows.  I have both it and CentOS on machines here and there are many things that are different that will not be at all obvious to a Windows user.

As for PHP differences, PHP on Windows includes a number of extensions that aren't available on non-Windows systems.  In particular that includes the SQL Server drivers 'sqlsrv'.
Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
Hi Eduardo, I am course what is prompting you to change.  I have been on Windows for the same and every once in a while think about going to linux but keep getting drawn back to Windows.
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

Olaf DoschkeSoftware DeveloperCommented:
Are you using anything Windows specific at all? The MS SQL Server drivers are already mentioned. The PHP language itself is the same. It still mainly get's it's input via $_POST and $_GET and outputs HTML, that's not differing in any aspect.

Do you use Apache or IIS on Windows? Many detail aspects of .htaccess files work on both OS provided you work with Apache on Windows, too.

The administration changes, using Linux in a VM is perhaps a good idea for starters, as you then can still use your favorite Windows editor and share files.

Bye, Olaf.
Dave BaldwinConnect With a Mentor Fixer of ProblemsCommented:
Along with the SQL Server drivers, this page lists the extensions that are only available on Windows.
David FavorLinux/LXD/WordPress/Hosting SavantCommented:
I should have said, breath of fresh air for me.

Windows was my primary platform for years.

First time I switched to Linux, felt like weights had been lifted.

To me, Ubuntu simply makes sense. Windows never did. Likely because with Ubuntu (and all Distros), there's now attempt to hide anything.

So if you can't find the answer from an expert (very rare), you can go straight the the source code for any code.
Olaf DoschkeConnect With a Mentor Software DeveloperCommented:
Since I know you come from VFP, Eduardo, you might have used the COM library for COM Servers, but I think you rather didn't ever make use of that feature, eg using COM('word.application') and many more for MS office automation and COM('adodb.connection') to make connections to data via an OLEDB Provider.

As far as I see you make use of MySQL and there's nothing to pay attention to, what's depending on Windows itself. You also use MySQL (or MariaDB) for Linux, but I'm not aware it has a default character set and collation on Windows differing from Linux. You'd need to pay attention to this main property of any database anyway, independent on Windows vs Linux.

And anything you only changed once in php or mysql configuration. It's really easy to forget, even if all defaults are same on different OSes.

Differences also can come from not using the exact same versions of PHP and MySQL. You always should be able to run on newest versions due to downward compatibility, but there are deprecations of replaced and outdated features, most famously, of course, the mysql functions vs mysqli and PDO modules.

Bye, Olaf.
Eduardo FuerteAuthor Commented:
Thanks for all the answers.

Just in my case, I only have a perspective of working with PHP in the Linux environment.

I do not have Distro so far, maybe in another conversation I'll have it, but it couldn't to be my choice, it's running in a Company.

In other projects, I participated before people who used Debian and complain how much time they spent in configurations to start running it as they wanted, the in general appearence of dashboards was to much similar than Windows, by the way they maintain a dual boot (Win/ Linux).

From your considerations, I conclude that it is to much similar to use PHP in Linux environment since no configurations in needed to be done before to start, it's a matter of some adaptations? Am I right?

The use of XAMPP/  WAMPP/... is too much similar, isn't it?

@David, the script you posted must be coded exactly where (PHP or some Linux config)?

@Scott, as posted here, it's not my choice to change to Linux...

@Olaf, years talking here about VFP subjects, first time I see your face! (rs)
Eduardo FuerteAuthor Commented:

Our messages crossed!
Eduardo FuerteAuthor Commented:

Since I know you come from VFP, Eduardo, you might have used the COM library for COM Servers,...

I used COM Servers to automate Excel  for a short time. I found it something very impedictable, so desisted.

But I really don't see connection between the subject of the question?...
Olaf DoschkeSoftware DeveloperCommented:
COM is one of the modules of PHP only available on Windows. See the link Dave Baldwin posted.
I see the connection to VFP, because
a) You could have created COM Servers in VFP and used them in PHP
b) you could have automated Office, as said, as you're used to from VFP
c) you could have used ADODB-.Connection to connect to DBFs
d) more things...

As you seem not to even connect this to PHP at all, forget about it.

Bye, Olaf.
Eduardo FuerteAuthor Commented:
Good to know this point of view.
It's really not my original concern in this question, but no doubts an intersting derivation.
So, if I use ADODB from PHP code is it possible to read .DBF(s)  that resides in an Apache´s folder?
Isn't it?
Olaf DoschkeSoftware DeveloperCommented:
Yes and no.
1. Only in Windows
2. Directory can be as you specify in the connection string you need to specify with ADODB.Connections Open() method. That might be in the Apache directory, but you're not forced to put your DBFs there. The account running PHP must be able to access the directory you specify.

Bye, Olaf.
Eduardo FuerteAuthor Commented:
Thanks for help!

Probably I'm going to return with new questions about this matter and its derivations...
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.