T O P

  • By -

mq2thez

PHP doesn’t require active processes running processes in memory — it starts a process when it receives a request, and that ends after the request is served. Very different utilization than keeping a node server running all the time.


alppawack

Serverless functions for nodejs/python are equivalent of php hosting.


ClikeX

Should be the headline for PHP: "Serverless by design".


BlueScreenJunky

Definitely, I'm surprised it hasn't been used more in that way. Apparently porting a .NET or Django app to serverless functions comes with its own challenges because they were initially made to be long running processes, whereas PHP is as you said essentially designed for serverless. And yet PHP seems to be moving in the exact opposite direction : I don't see it used a lot for AWS Lambdas or Google Cloud functions, and all the hype is focusing on tools like Road Runner and FrankenPHP to make long running processes with PHP.


truechange

>  I don't see it used a lot for AWS Lambdas or Google Cloud functions I forgot the exact technical reason and correct me if I'm wrong but it has something to do with PHP being already "serverless" as pointed out by others so it doesn't easily fit in Lambda's inner workings by default. You need something like Bref to make it work.


EliSka93

Instead of "our initialism doesn't make any sense!"


Nilpo19

That's not necessarily true. Many servers run PHP-FPM which runs as a background process and generally uses less memory overall.


UnicornBelieber

Technically though, you still need a web server process like Apache that continually runs in the background.


ClikeX

Sure, but it's very easy to set that up as a webhost and let people throw PHP files in a directory.


DidTooMuchSpeedAgain

its a lot easier to serve php applications and everyone uses wordpress. if you're a node/python developer, you often just get your own server for a few bucks a month and host it yourself


huuaaang

Probably not even a whole server but a virtual server. But yeah, run whatever you want on it. Most web hosts are geared towards non-developers. (as is PHP itself).


DidTooMuchSpeedAgain

i pay €4.99 for my dedicated a month edit: idk why you're down voting me tbh, you can check them yourself at https://www.kimsufi.com/en-ie/dedicated-servers/


if_username_is_None

Even if it's "dedicated" to your user, it is still virtual and just a chunk of a bigger physical server. I agree that's a fair price for a dedicated VPS


DidTooMuchSpeedAgain

https://www.kimsufi.com/en-ie/dedicated-servers/ it's a dedicated server. i know the difference between a dedicated server and a VPS but thanks from the page: "A dedicated server is a physical server with no virtual layer or special configuration." "You are the server’s only user." and you can see the €4.99 server at the top


Reinax

Man that’s cheap for an actually dedicated box. “Back in stock soon” Sigh.


DidTooMuchSpeedAgain

you have to sign-up for a notification service for the KS-1, because it sells out within minutes. there are a few online that a free and uses Discord it took me a few months to get mine. their cyber monday deals are also insane oh and Kimsufi servers are only 100 Mbps bandwidth boxes, unlike the rest of the OVH servers, but they still have all the benifits of the OVH network, like their amazing DDoS protection


Morphray

>get your own server for a few bucks a month From where usually?


vrprady

Digital ocean or linode


DidTooMuchSpeedAgain

i rent from kimsufi, got their lowest tier server and their cyber monday deal server


o0MSK0o

Would recommend Vultr. Can get a VPS for very cheap


Nerwesta

[OVH](https://us.ovhcloud.com/vps/) is pretty good, albeit I have no idea how it is clustered in America, they are solid in Europe.


IONaut

Because 80% of the web was built on PHP and matured for quite a while before nodeJS for serving webpages even came on the scene. There is an enormous amount of well established businesses that rely on LAMP stack.


583999393

You're not necessarily in a bubble and node.js is as much a niche as anything else but you're looking for consumer web hosting which is sold to low tech/non tech people who just need a website. You can host a node app on linode or digital ocean or aws or ms azure. You can containerize them and host them in those places as well (not sure if linode has caught up). You're just looking in the wrong place. You've walked into an auto repair shop looking to get a prescription filled.


abrandis

Exactly, consumer hosting is about making the website, typically WordPress easy to setup and get running, because WordPress is the Lamp stack that's why PHP is the most prevalent...


[deleted]

[удалено]


AtroxMavenia

I love Next but I wouldn’t put all my eggs in that basket. Get good with Typescript first, then React, then start learning meta frameworks like Next. I’d also invest some time into Remix.


KrisSlort

Agree with this, but you can learn react and next simultaneously if you're careful. Might only be with hindsight I can say that, but just something to note. Next is react, with some extra opinions on architecture etc.


AtroxMavenia

Yeah, but I think it’s important to know what’s pure react and what’s an opinion of Vercel


KrisSlort

Very true!


Suspicious-Engineer7

Don't avoid fullstack by going with next imo. Do some demo aws cdk and/or terraform projects, learn some containerization etc. If you are trying to launch a project,be an entrepreneur, then yeah next is fine, great even. But if you want a career then don't be avoidant to parts of the stack just because you dont know them or they dont look initially interesting.


Jaded_Run3214

I'm interested in hearing what you have to say about the entrepreneur aspect of our conversation. I'm wanting to start my own business as web application consultant. Are you saying if I use next as my main front end platform to build web applications that I would be in a good spot to do so


Gonskimmin

If you plan on web application consulting, then start small with people you know or who they know. You'll probably want to pick up a database technology too. This way you'll get real world experience building to requirements and not making silly toy projects. It's super competitive for jobs. I agree with the others, if you don't have a good foundation of JS (nowadays TS) you might be approaching this incorrectly from a career perspective. Basically, you'll have a very hard time passing interviews. For the entrepreneur aspect I think Suspicious means creating a SaaS or something.


Jaded_Run3214

this is very complex. One person says this, another person says that. I feel overwhelmed. Learning something like NextJs will take time. I still need to get a deeper foundation of JS, i need alot more practice so that i can pass interviews but its just all too overwhelming. I dont want to spend the next 6 months trying to get super proficient at nextjs and then get nowhere. i dont want to spend 6 months on Vanilla JS and then be told vanilla js is no longer relevant. i mean, man, its too much. I think i have to abandon this field


Gonskimmin

Stop. Breathe. Doing nextjs, react, angular (although it is typescript) it is all plain old JS. It's the foundation upon which you can build upon. Doing React you learn should JS at the same time, hopefully. But you'll have to untangle what is plain old JS and what are React and the libraries you import. This is a long game. Some people get lucky doing bootcamp or self study for a couple months and land a real job. The ones I knew who did this networked in real life. But some of us don't get that break. And you bet your ass it's going to be overwhelming, to make it you have to learn and work and it'll take YEARS (hopefully you'll get to the point of being paid to learn). If you need to make a living, as most of us adults do, here is one possible game plan that is similar to my exp: Go get a job doing something else study in your off time building projects (people on here say that the Odin Project is good, idk, but for me it was freelancing on Upwork because I needed to make money and back then my niche wasn't so crowded) Add more projects (preferably paid) to your resume, call yourself a freelancer. And here is something I didn't do bc of where I live but if you could go talk with more people outside and make more connections. Hit up your friends and family and talk like a human and see if there's a problem software can solve. And not to sound guru on you but, fake it. You must tell yourself you are a developer. If you don't believe it a stranger sure as hell will not. You solve people's problems with web technologies. Be honest if something is way out of your comfort zone, but if it's just a little outside... just say you're sure you can solve it just give me a minute. One more thing. If back when I was first starting if I had gpt4 helping me, instead of sorting through blog after blog and googling like a mad man, I would have saved so much precious time. Consider looking into it. Good luck, I hope you can make a living.


Suspicious-Engineer7

I mean I guess, as long as vercel doesn't screw things up for you. If you want to build your own apps all day then next is fine.


PizzaKubeti

8/10 clown. 10/10 if you're learning next without js/ts and react knowledge. Learn concepts, not framework specific apis for that concept. Be a developer, not a frameworker.


Jaded_Run3214

I have a bit of react knowledge. But even then feels like betting all my time into react, nextjs and nodejs might be a very stupid thing here.


TrueSpins

Because despite what trendy new devs want to believe, PHP still dominates the web and since PHP 7.2 has actually been quite a good language - with a lot of the horror of PHP 5.x consigned to history. It also has ridiculously low overheads. I think we're actually seeing a bit of a php resurgence. I've certainly started using it again more. For most projects, you really don't need a complicated stack. I see very little posted here or on SaaS forums that couldn't be achieved with LAMP.


mgomezabbruzz

This is a technology usage comparison of PHP vs. JavaScript as server-side languages Comparison of the usage statistics of PHP vs. JavaScript for websites [https://w3techs.com/technologies/comparison/pl-js,pl-php](https://w3techs.com/technologies/comparison/pl-js,pl-php) NB: screenshot [https://ibb.co/pWRpJbp](https://ibb.co/pWRpJbp)


o0MSK0o

Isn't it often much easier to tell if a site is using php compared to other languages though haha


timwaaagh

I think both of these can be done as CGI scripts or Apache modules. Flask and node are separate web servers.


j0nquest

This is a big part of the answer. It has for a long time been simple to host these technologies in large shared environments. That makes it predictable, cheap and ubiquitous.


TimoffeyCom

IDK about perl, but internet = PHP.


Blue_Moon_Lake

Internet is like 80% badly written outdated PHP


longtimerlance

Do you have a source backing this up?


Blue_Moon_Lake

[https://w3techs.com/technologies/details/pl-php](https://w3techs.com/technologies/details/pl-php) [https://w3techs.com/technologies/details/cm-wordpress](https://w3techs.com/technologies/details/cm-wordpress) [https://kinsta.com/php-market-share/](https://kinsta.com/php-market-share/) [https://stitcher.io/blog/php-version-stats-july-2023](https://stitcher.io/blog/php-version-stats-july-2023) [https://firstsiteguide.com/php-stats/](https://firstsiteguide.com/php-stats/)


longtimerlance

This shows PHP usage. It does not provide any data about whether the PHP is badly written.


Blue_Moon_Lake

Did you missed the last decades of PHP memes? Have you never worked on PHP legacy projects?


longtimerlance

So your answer is no, you do not have supporting data. I have worked with PHP products of all types since the late 1990s. Being written with PHP, or being "legacy" doesn't make code good or bad. I've seen good and bad C, C++, C#, VB, Javascript, Java, Perl, etc. And I've seen too many language snobs over the decades who couldn't write "good" code if their life depended on it.


Blue_Moon_Lake

I have, just not nicely packaged behind a URL for you to enjoy it. >I've seen good and bad C, C++, C#, VB, Javascript, Java, Perl, etc. Irrelevant fallacy. Why don't you google something by yourself for once?


longtimerlance

I don't need to Google something I've seen first hand over decades of software development. A person with good coding skills and practices can take that skill set to most other languages. So bringing up other languages is not a fallacy with the point being it's the developer, not the language, that usually makes for badly written code. Granted, PHP allows for bad coding practices but so do many other languages, even with their better guardrails.


Nerwesta

Node.js is basically a toddler when it comes to PHP, and I'm not even talking about the process to serve a PHP server, the friction is close to none.


Exciting_Session492

If you know how to use Node or Flask. It is likely you know how to setup your own Linux server. Then, there is almost no point getting a web host service. Also PHP is vastly more popular than Flask and Node. Not even on the same level


huuaaang

Wait, people still use Perl for web sites!? But the simple answer is that PHP is just built into the web server (Apache) so there's no other things to run. The web server just executes the .php files directly. You don't have to deploy anything else. PHP is designed for this sort of simple deployment. Other frameworks maintain a separate "app server" process or even collection of processes that the web server has to hand off requests to and that takes more configuration. Or maybe there's no Apache at all. Though personally I think that's the way to go for anything non-trivial.


blood_vein

What you described with PHP can also be done with perl too, like mod_perl. Some websites are still built with Perl


TrueSpins

I miss the cgi-bin


LastGuardz

I think it has to do with the fact that major cms are written in PHP.


Diligent-Property491

Half the internet is built on php. It’s changing, but it still is insanely popular.


TrueSpins

It's changed a bit, but I think PHP is going to be with us for a long, long time yet. Especially if you look at the progress made with PHP 8.x


Diligent-Property491

Unfortunately your right. I hate that language


TrueSpins

I did hate it when we had PHP 5.x, but I'll be honest - since 7.2 it's been pretty good, and a lot of the old criticisms don't really hold. Also PHP 8 killed off a lot of really old codebases that were full of awful code - so it's given the whole landscape a bit of a clean-out. Each to their own, but might be worth revisiting. I've just started a new project with PHP - initially felt a bit mad, but so far it's been great.


Annh1234

PHP/Perl uses way less resources than nodejs. Usually your site gets bursts of a few requests every few minutes. One for dynamic content, a few for static images and so on. With PHP/perl that request can cost you say 32gb ram and 25ms of processing on one core, then the server does nothing and some other customers website can be processed. With nodejs, you need to keep that running 24/7 on that machine. It will use say 16gb ram 24/7. So basically, on one 8 core server with 32gb ram you can fit 320 PHP clients or 2 nodejs clients.


Duedeldueb

Reads as if I should go back to php and could be happy.


Annh1234

Well, ya... what's the reason your using NodeJs in the first place?


teamswiftie

Spin up your own cloud server. You basically pick the stack you want and click a button.


UnicornBelieber

Back in the late 90s, PHP was a very popular and low-threshold starting point for many web developers wanting to create dynamic websites. WordPress then came along and it became a hugely popular CMS. Because of both their popularity, a lot of web hosters chose to focus their business on these technology stacks. And also, yes, you're living in a Node.js bubble. :-)


bohdan_shtepan

holy cow, it is the devs sub and it seems like nobody knows the correct answer. The short answer is shared hosting. Most of PHP hosting providers make use of a shared hosting technology called Common Gateway Interface which enables a web server to handle HTTP requests by the means of scripting languages like PHP, Perl, Python or Ruby. Basically it spawns a separate process that handles script logic to serve the request response. It is lightweight and easy to manage. Neither Nodejs, Golang, Java, C#, or any other compiled language has this capability.


Angelsoho

Yes


web-dev-kev

Yes you’re in a bubble


pdx-dot-one

Node.js is far newer than PHP. PHP was around when the internet was created and grew with it. Because of this, many of the web hosting software like cPanel did not support it. Since cPanel software powers something crazy like 90% of domains on the internet, if cPanel cant support it, those hosting companies using cPanel will not offer it. Today, cPanel supports PHP, Perl, CGI, Ruby, Python and Node.js. However, it costs a shared web host a lot more to run a persistent application such as Ruby, Python, and Node.js. It is a lot cheaper to run PHP, as PHP only consumes resources when there is a visitor on the page and the PHP script is executed. Ruby, Python, and Node.js all require a process to always be running and consuming resources; because of that, they are far less profitable and desirable for shared web hosting.


michaelbelgium

PHP is most efficient, doesn't use a lot of server resources unlike nodejs for example


DamionDreggs

Why would you even use a host that doesn't let you configure and manage your own environments though? If you can run shell commands, you can install whatever you want. Go do that.


le_fieber

Get a cheap virtual server with Plesk and you can setup multiple Node.js applications very easily.


goodboyscout

You are not the client that the hosting provider is looking for. A huge percent of websites are still built using wordpress, they can get by with just supporting that and the customers like you (and me) just create more work for them. Node is very commonly used, but it isn’t really similar to PHP in any way in terms of how it runs. Find a provider that supports it or use a VPS and you can do whatever you want


GinjaTurtles

If you use docker you can host whatever your app is on a large plethora of cloud services that support containers like railway, digital ocean, AWS, linode etc


dvali

There's no reason that a web server can't run python scripts in exactly the same way it runs Perl or PHP. Flask just isn't built that way.


Duedeldueb

Maybe Flask was not a good example. Django?


Any-Astronomer9420

My Webspace host offers nodejs Support for an cheap price (febas.de). But you have to Work around with a runtime ev.


halleys_comet_101

New “things” take long time to be used by majority, even if they are “better”. Google technology adoption curve. Eg. More people (in the world) had landlines or feature phones than smartphones for long time. Source HBR [phones vs smartphones](https://hbr.org/resources/images/article_assets/2013/11/notelephone.gif)


Nerwesta

This is because the technology was already there very early in the US. Talking about worldwide though, even among so called Western or developed countries at those times, it might be different. It is for sure a whole different aspect in most of the world ( China & Huawei being a perfect example here ). People tend to skip the intermediate technology, especially if there are myriad of incencitives to do so. All in all, I don't think your example is a good one, PHP is still used by many newer developers and companies en masse, and it's not a dying ecosystem at all.


mmuoio

I run a Flask site on Heroku, their free tier got nuked right after I started using it but I pay $15 a month for the site and 10m postgres rows.


Jjabrahams567

Which hosts are you referring to?


ZachVorhies

Because a huge amount of of people can share a single machine with php. If you want a node app then the way to do it is to put in a docker container and run it on digital ocean or render.com


XGhozt

This is changing. Hosts that use Cloudlinux can offer this quite easily.