Live data from Hacker News

A look at modern PHP

lwn.net

101–110 of 610 posts

Re: A look at modern PHP

#101
post #17

I've been using PHP for over 15 years and always liked it. There is no other webserver language that's so easy to use and so deployable while still being fast. But for larger projects the available frameworks are just okayish. I think Symfony is closest to what a good framework should be. But every time I use it I wish it would be like .NET Today .NET core is also available on Linux and very easy to deploy so I don't…

What if you’re looking for a great way into .net web dev on Linux? I’ve been struggling to find a good guide that combines dev env, deployment and a good web framework. Any advice?

I have quite a bit of xp with Python (Django/flask) and less with php.

Re: A look at modern PHP

#103

Earlier quoted context omitted.

The first section in that link literally says >In our dashboard you will find pre-configured Open Source apps like WordPress, Plone and other. They are all based on the official docker images and can be deployed with just one click. Otherwise I don't see how something like this is that much more difficult https://www.openshift.com/blog/deploying-applications-from-i... Or this https://kb.sloppy.io/en/articles/1313693-…

They had to write an installer ecosystem around installing docker images, whereas with PHP and most stock server configs you can SSH a file into a server and you're pretty much done. Still if I want to write a simple web app in < 1 day, I would definitely use PHP.

In such a manual workflow ("you can SSH a file into a server"), you still have to setup at least URL rewriting in nginx for any PHP app using routing (which is basically everything using any PHP framework or micro-framework).

Plus if the deployed app has its own domain/subdomain, you need to set that up, set up TLS certs etc., so it is really no different in the end. You either configure nginx to proxy all requests for some domain to an index.php file, or you proxy them to a locally running container (where you also don't have to worry about versions of software installed on that server, clashes between different apps, etc.).

Commercial PHP webhosts also have an "installer" for automating all of this, provisioning databases, etc.

A lot of this can also be automated by various Kubernetes controllers (DNS configuration, TLS cert provisioning, databases, volumes, backups, monitoring etc.) if you already have a cluster. And for packaging installable apps, there is Helm and its charts (e.g. https://hub.helm.sh/charts/bitnami/ghost), you can also manage them from a GUI dashboard (https://kubeapps.com/) or even from a git repo (https://argoproj.github.io/argo-cd/) if you want to have a repeatable history of all changes to the environment, updates, etc.

Re: A look at modern PHP

#104
people make fun of php all the time... just see the comments in this thread.

people forget though that wordpress, drupal, joomla and magento are all written in php and most likely accounts for 70% or so of all the websites online today.

php is going to be around despite all the negativity and fanboyism of other languages. you can't go wrong with knowing php if you always want something to fall back on if you need a job. while coding wordpress websites isn't the greatest job in the world, it is a job and be thankful for that especially during these times.

Re: A look at modern PHP

#105
post #14

Even with PHP7, PHP still feels like it is playing catch up. There is nothing new or revolutionary in PHP7, just adopting features present in other major languages. Adopting as other newer languages like Go and Rust seems to be moving beyond those features. A catch up into a world that's on its way out, if one will feel so blunt. PHP's raison d'être remains its ease of getting an instance running on a webserver. But…

Wait, Go hasn’t had any revolutionary change since it arrived 10 years ago. It is still basically the same language/package. I’m not saying that is bad, but why does a language need to be constantly revolutionary if it solves what it sets out to solve well? Catch up to other languages? You can easily argue the opposite, that other languages has finally catched up to PHP, ease of deployment, ease of horizontal scaling…

> why does a language need to be constantly revolutionary if it solves what it sets out to solve well?

That's a very big If in PHP's case.

Re: A look at modern PHP

#106

Earlier quoted context omitted.

What do you mean by concurrency here? JS like async or Java/C# like threads? And why would concurrency help in problems where PHP is involved, in the problems I solve with PHP I don't think I ever needed async. For unning more things in parallel like processing 1000 RSS feeds you can spawn 10 scripts that run in parallel and if one crashes the others still continue to work(I had experienced crashes with some RSS XML…

Anything that will block the server. Fetching data from an external API, doing some kind of expensive computation, sending an email etc. You can either handling this Node style with blocking i/o, throw the work onto a background queue like Sidekiq, or use a language with first-class concurrency support like Golang or Kotlin. To me Kotlin feels like a far nicer and more scalable language than Golang.

I like this about PHP, you don't have a callback hell. I don't disagree with you just sharing my experience here, we might work on different kind of problems.

Re: A look at modern PHP

#107
so is PHP worth learning right now? and what is the job prospect looking like? if I study the language for the next few months what is the lickely scenario I will find a career in it.. I actually enjoy and like PHP unlike other people idk what it is about the languauge it looks fun and enjoyable to play with . Plus it's simple and easy opens doors to more complex languages later on down the road

Re: A look at modern PHP

#108
post #31
post #15

For web backend, being able to ship a single binary, such as what Rust and Go can provide, is really nice. I don't see PHP as a more compelling solution than either of those languages. Scripting and command line automation is executed better by Python and Ruby, which excel for writing Unix scripts and tools. I do not see what the use case for PHP is in 2020. PHP has one of the most abhorrent language syntax designs t…

Think of a simple landing page with a form to save data from a form and send out an email with confirmation. In PHP you just need to add to your HTML page a few lines of PHP code and copy it using scp to any share server hosting that costs 4 dollars a year. No "automation", no "cloud", no REST APIs, no WSGI/Gunicorn, etc. just plain Apache with mod_php enabled, which is available everywhere. I don't think anything ca…

Aren't there a zillion online services that provides that product out of the box, most likely for free, only requiring a browser and some monkey clicks around? -> No PHP, HTML or web server.

Re: A look at modern PHP

#109
post #61
post #14

Even with PHP7, PHP still feels like it is playing catch up. There is nothing new or revolutionary in PHP7, just adopting features present in other major languages. Adopting as other newer languages like Go and Rust seems to be moving beyond those features. A catch up into a world that's on its way out, if one will feel so blunt. PHP's raison d'être remains its ease of getting an instance running on a webserver. But…

> But with fewer people self-hosting these days, that has become less an advantage. I don't think fewer people self-host. There are some going to big clouds, there are some using integrated offerings like squarespace, but there are still many hosting their website with a regular hoster. And probably in total many more than in the past. > And even for those who do self-host, the advantage is becoming narrower as other…

> I don't think fewer people self-host. There are some going to big clouds, there are some using integrated offerings like squarespace, but there are still many hosting their website with a regular hoster. And probably in total many more than in the past.

From my experience, the share of people who can only deploy PHP is steadily shrinking. PHP remains the default, and popular, but easily deploying other languages is becoming more feasible, and we're shipping docker containers with Python/Go/Node/whatever code a lot more often these days.

Re: A look at modern PHP

#110
post #75

Earlier quoted context omitted.

Not the parent, but it would be nice to have separate thread for things like logging and firing events into a queue.

Just curious what problem are you trying to solve, I never had the need for different threads to communicate in PHP, most of the time in my work a user makes a request, and a PHp scripts does something like update the database or does some searching/working and returns a result.

What if that request was a document upload and your system is calling out some external api or processing for long enough such that you’d rather return now and update later when the job finishes. Maybe through Ajax or a redirect.

The shenanigans that WP plugin devs go through to get around the lack of a queue is ridiculous (chunk the file and keep reloading the page until we’ve processed all the chunks or have an Ajax endpoint that processes a chunk at a time...) and the when I asked a marketing friend of mine who works with Wordpress he said that redis is an “advanced requirement” and I should keep things simple.

In Django land I’ve always set up queues even just to send emails because it keeps things snappy.

Post reply on HN