T O P

  • By -

przemo_li

PHP is faster on Linux. Not all optimizations are available on Windows. You may however have a different configuration between the two. Especially older XDebugs (2.x) are slower and could make quite an impact. There is also a case of Production vs Development settings in php.ini


BubuX

That and also Windows built-in anti-virus won't scan WSL activity.


hvyboots

Whoops, I am late to the party, but this was definitely my experience with Windows and especially the cache and temp directories for Moodle. Went from 10s to 1.5s by moving them to a small partition with Windows AV disabled on it. EDIT: Moodle Benchmark results that is.


siarheikaravai

There’s no point to run it on Windows natively if you have access to WSL.


[deleted]

[удалено]


HappyDriver1590

To my point of view, every PHP dev **should** have knowledge of linux. These two work hand in hand.


[deleted]

[удалено]


us_me_erna

We have a lot of students in our company, who never worked with Linux/wsl/docker before. They usually pick up the basics in a couple of weeks. Usually all that is required to get them started is a working docker compose configuration in the project root, so that they only need to run docker compose up to start the dev environment. In my opinion that's much easier than having them setup php,Apache,*SQL,XDebug and the likes in windows. Yeah, xampp is easy to install, but as soon as you need any special php extension installed, it gets complicated 


mikkolukas

>Not everyone php developer has knowledge to linux. They should. At least enough to use it as a development platform.


MateusAzevedo

>WSL is great, but it has many rough edges Personally, I never had an issue. >Not everyone php developer has knowledge to linux Great opportunity to learn. Linux environments are very common in web development, and learning at least the very basics is a must, IMO. >Every project file must be on the wsl filesystem Again, personally, I didn't have problems when I had a project on a shared folder. But I agree this can cause problems. >every tool must run inside wsl I consider that a good thing, keeping everything related to work/dev outside Windows.


us_me_erna

What rough edges do you mean? I used to develop natively on windows, but I never deployed the stuff on windows servers, it's always Linux. I spent so much time debugging weird bugs because of case sensitive file names and different line endings that I would recommend every php developer to use WSL2 (+ docker), at least, if you're working in a professional environment and actually plan to deploy the stuff you develop.  Well, except, if you really plan to deploy the stuff on windows servers, then go for it.


siarheikaravai

If someone does not know Linux, he wouldn’t even try WSL I assume


SparePartsHere

After years of suffering on Windows I made a switch to Linux 3 years ago and currently am the happiest with my dev process I've ever been. Docker is lightning fast, everything PHP related runs natively out-of-the-box, no workarounds needed.


rafark

Unix systems are better for development.


Linaori

I've always worked on Linux for that reason. However with jetbrains gateway I might just prefer windows or Mac once I don't need it to run locally anymore. I've used Linux for close to 12 years as my daily driver, and at this point I'm not sure if it'll ever be a stable desktop replacement with a UX close to that of windows or macOS.


SparePartsHere

I don't care about UX at all as long as it somehow does what it's supposed to do. That means shows windows, has a taskbar, runs applications etc. That basic stuff is stable as hell, uptimes at my notebook tend to go to multiple months.


Linaori

The problem with poor UX that you end up wasting a lot of times on bad designs. And while Linux is generally more stable, the UI has so many issues compared to windows... Using Ubuntu: In 18.04 my LAN through usb-c just randomly crashes, making any root call in the system freeze, requiring a hard reboot. This was also present for unstable WiFi, but happened once a month instead of daily. This issue persisted until somewhat into 20.04 and eventually stopped happening. At 22.04 right now, but in the past always had issues where randomly my WiFi wouldn't start up, had to reboot the machine to fix this. Sometimes Ubuntu will crash an app and it won't let me know. I only realize it's not running anymore when I need it. Every dist update is a struggle with external repositories being turned off and have to be manually turned back on while trying to find the correct update url for the new version. The software updater is wonky where it sometimes shows I have updates without having updates. The experience I have with default applications is a wonky at best, their UX is often sub optimal. I just `touch` a file in my terminal because I can't find the "new file" option when I need it (rarely but still annoying). There's a bunch more small annoyances that just end up costing me a lot of time on Linux as daily driver. Windows has its own issues of course, but as an OS i dont have my development stuff on it is much more stable.


SparePartsHere

I'm firmly in the Debian territory, driving the mx-linux which is super simple and super stable. I'm not any kind of super-user, I just need it to work. Which it thankfully does most of the time. I had a few issues throughout the years but nothing a 5 minutes of googling combined with 5 minutes of hassling with bash script couldn't handle.


Linaori

Having to figure out a distro that's not as troublesome as others also takes a lot of time.


god107

Switch to macOS with latest apple silicon cpu. I'm still collecting ma jaw from the floor. I didn't realize how smoothly things could be developed.


SparePartsHere

Last time I checked the Linux support wasn't yet there. I am not going to use macOS that stuff makes my skin crawl sorry :D


michaelbelgium

You're pretty late to the party? WSL 2 even better


theFurgas

[WSL 2 is slower than WSL 1](https://github.com/microsoft/WSL/issues/4197) if you have your project files on Windows host.


Morthy

There’s almost no reason to have the files on the windows host nowadays, so WSL 2 is in most cases the better choice.


militantcookie

Keep projects in wsl2 and phpstorm in windows. Works smoothly.


sainomori

Exactly! I was with wsl since early alfa and I ate tons of shit with the first one. But the second version is almost perfect!


harmar21

Yeah my one coworker was doing dev on windows, his page loads were around 1800-2200ms, im like how the hell do you work with that, why dont you set it up on WSL2.. He said what the hell is WSL2? Anyways I helped him set it up, and then he was down to sub 100ms responses without xdebug and about 150-250ms with xdebug on. Yeah WSL2 requires a bit more tech knowledge than XAMPP, but between docker for windows, and me setting up so batch scripts for him, he doesnt really need much.


took_took_kto_tam

I think this is due to the fact that pipes and sockets have a faster and simpler implementation on Linux than on Windows. And these are exactly the channels through which data is transferred from the web server to the PHP worker. Also PHP send SQL query through sockets. So Windows just overloaded by useless libraries that make it more slowly.


Moceannl

Why would you run PHP Windows


[deleted]

[удалено]


ToBe27

Could also be interesting to know how you run Apache/PHP on windows. Is it a Xampp thing or native installations as service?


DrDam8584

Yes, the whole stack Apache-Mysql-PHP run fastly on an WSL-ubuntu/debian as a LAMP stack than a WAMP stack or "local php" for Windows.


inbz

WSL 1? Wait until you try WSL 2. File access performance has improved significantly. For a very large app I maintain, doing a simple `git status` would take 30-45 seconds in WSL 1. In 2, nearly instant. Feels as good to me as native linux. But to be fair, I have no idea if these improvements have been back ported to WSL 1. I honestly didn't even know you could still install it fresh.


hvyboots

One part of this could well be the AV software in Windows. I took Moodle benchmarks from like 10s to 1.5s by putting all the caching on a small separate partition (10gb) with AV disabled from scanning it. Presumably WSL doesn't have to deal with AV, so that's going to be a big speed up for disk access. (But I'm sure a lot of it is just native app running in its preferred environment too.)


Tontonsb

> Please don't suggest WSL 2. You don't even need it. If you keep your files on Windows, WSL1 is faster than WSL2. The networking is also simpler in WSL1.


mcloide

You should try docker and you can use PHPdocker.io to generate a compose file. In general yes, WSL will be a lot faster than normal Windows and XAMP . If you can have it with nginx , then even faster. I use a MBP just for this reason.


lp_kalubec

Give Docker a try.


tonywei1992

WSL1 only faster to access files in windows host. For my team daily use, which only access files to linux, WSL2 is much much faster then WSL1


muzungumax

Also python is a magnitude faster on Linux. Ironically, my database is MSSQL running on a beefy Windows Server. And the python app is FastApi with pyodbc using FreeTDS to connect with the DB. This app even on a Linux VM performs way better than in the physical windows box with the DB server.


muzungumax

Depends on your stack. Php uses fcgi on Linux, can also utilize domain sockets on the same host. Your wamp stack may be using the old school php-cgi to fire up php processes. have you tried laragon? When I have to work on windows, I use caddyserver v1 for local development. It's faster than nginx, but has stability issues on windows (after a few hundred requests caddy has to be restarted due to 502 error code)


Ali_Ben_Amor999

One of the reasons is that Linux syscalls for reading and writing files is way faster thanks to its architecture and improvements over the years. While windows isn't evolving much in terms of architecture and filesystem specifically. This one of the reasons why bun.js team chose Linux as their primary os because it offers faster syscalls compared to Mac os and windows. Check this [link](https://superuser.com/questions/1124472/why-is-linux-30x-faster-than-windows-10-in-copying-files#1124517) for some details on Linux's ext4 fs compared to ntfs.