Every now and then people make jokes about php being dead and I worry. What then?
No, you don't fall back. Skill and experience in programming is highly portable. You should be able to take your problem-solving skills and adapt them to other languages in a reasonably short period of time.
Almost all programming languages have the same fundamental building blocks: loops, conditions, branches, variables, data structures, functions and modules. Once you recognize how your next language represents these, you can map most of your previous knowledge onto them.
Laravel Octane, while impressive, is more Laravel.
I was referring to how highly opinionated frameworks encourage or demand you to stay within a closed ecosystem, limiting a developers' exposure to the broader ecosystem and its capabilities.
In addition, you're more likely to hit upon obstacles integrating other code into your application if that other code has not been built with the opinionated mechanism in mind.
One thing I've noticed is that when I asked some people about PHP in other forums and places or mentioned I will be working with PHP and need to study it now they mostly hated on PHP. Why is that?
Blindly hating PHP is the 'cool' thing to do by people who don't know any better. I say blindly because most of those expressing the hate have never used PHP, or if they did, it was back in the 5.x days. Look beyond that and you'll see PHP is a powerful and well respected language.
Laravel is a framework used to build PHP applications, it is extremely opinionated, that means it expects you to do things the magical Laravel way, and punishes you if you try to do things differently. It allows you to make sites quickly, but limits your growth options.
PHP works almost the same on any OS, the main difference is how you install it and some of the supported extensions. If you are just starting off I would recommend learning how to install and run PHP within Docker.
by all the cowards in this thread.
The client POSTs the card details to your server over HTTPS
Your backend POSTs it to your payment processor over HTTPS within the same request where you receive it
Congratulations, you now have credit card details resident in memory and potentially webserver logs. Was there an error? Now they're potentially in your error logs too as part of a stack trace.
That's before we even consider how locked down access to the code and servers is.
Avoid touching credit cards if possible, and use a third party service so you never have to deal with them directly.
Handling credit card data is enormously complex in terms of the PCI requirements the payment gateway will require you to comply with, and not doing so can lead to hefty penalties.
It's hard to discuss it without showing the other side of the coin, i.e. a representative sample of those posts that have been deleted. Also, do the people responding to those posts fall under the "enablers" category you said you would like to see less of?
I have experienced situations where I have spent time writing meaningful technical replies to things, only to find the thread deleted by the time I hit send, or shortly thereafter.
Something that immediately comes to mind was one last month I believe it was, about the relationship between web servers and CGI.
I find the enforcement of this subs blanket "no help posts" rule counterproductive.
People asking questions is not only an essential mechanism for people to learn, but the replies and the discussions that go with them often provide a broader discussion, as well as providing a kind of peer review.
This sub has 143k members. If someone posts an interesting question, and receives a meaningful reply, maybe even extended discussion, that's potentially many thousands of people that have learnt something that they otherwise would not have.
That's much more valuable to our community than a rehashed blog post.
What it shouldn't be is a venue for homework questions. But there is clearly a difference between a low-effort question, and an interesting, thought provoking question related to PHP, its internals, or software development in general.
I find the comment about "help question enablers" unpalatable. Because in many cases, if we took that question, used it as the title of a blog post, and wrote our reply below it, then posted that blog post containing identical content, it would stay.
tl;dr: Remove low effort help posts, keep more interesting ones.
Without wishing to appear mean, if we knew how to do that at scale, well, we wouldn't be posting on Reddit, as we would be too busy enjoying the sun on our private tropical islands.
There are articles available which cover at least part of algorithms used as part of pagerank, but the amount of data sucked in by Google and alternative search engines to make their products is insane.
The full algorithms are not known outside of these companies, and represent some of the most valuable trade secrets known to mankind.
You're right of course, all things being equal, if performance is free, then take it.
However, from a library users' perspective, I would argue that considerations about the feature set provided by the router (e.g. ease of configuration, debugging, header analysis etc) are almost always more important factors than the tiny performance differences between them.
Calling people "die hards" is not going to win you any arguments here.
You have so far failed to provide any evidence to back up your implicit claim that OOP is wasteful and convoluted ("not fans of OOP boilerplate and ceremony").
Saying you have code to prove it, but you can't show it, is not meaningful evidence in a public debate.
FastCGI is the network protocol that NGINX uses to communicate with PHP-FPM. It just sends the file path, headers and a few other things, and receives the output.
A process using FastCGI is different than CGI process because FastCGI allows a single process to handle more than one request, so it remains alive after the each request has completed, and listens for another request to be passed to it over its control socket.
When PHP-FPM receives those requests over FastCGI, it can then pass that data along to one of its worker processes. PHP-FPM is capable of buffering requests, as well as scaling the number of workers up and down in response to demand.
The worker (the main PHP process) is what then does the parsing, lexing, AST, building the opcodes and then processing them. It then passes the information back to FPM, which then passes it back to NGINX.
NGINX
^
| FastCGI
V
PHP-FPM
^ ^ ^
| | | FastCGI
v v v
PHP PHP PHP
It sounds as though you are in a really bad position.
Refactoring one application is a hard, time consuming job, refactoring the core of dozens of disconnected websites and then making them all work with it is a practical impossibility as everything you touch is likely to be an API break.
(This is the same problem that something like Wordpress has)
Even if you were to use automated refactoring tools such as those built into PHPStorm or Rector, there is no guarantee that they would apply consistently to child projects. It may also take longer to create and test these rules than it would to re-write the child sites.
My question would be what resources do you have to solve this problem. A team of developers? Multiple years?
Someone needs to look at the business case. Wil the product still be on the market by the time such a large scale rework is complete.
What are the consequences of NOT doing it? Are the security vulnerabilities severe enough that they could cause data loss and possible lawsuits.
Is there a possibility of taking the data and migrating it to an alternative product?
There's a lot more that needs to go into evaluating options.
No, you don't fall back. Skill and experience in programming is highly portable. You should be able to take your problem-solving skills and adapt them to other languages in a reasonably short period of time.
Almost all programming languages have the same fundamental building blocks: loops, conditions, branches, variables, data structures, functions and modules. Once you recognize how your next language represents these, you can map most of your previous knowledge onto them.
That's Awazing!
Docblocks on the inside are used heavily for static analyzer hints.
Laravel Octane, while impressive, is more Laravel.
I was referring to how highly opinionated frameworks encourage or demand you to stay within a closed ecosystem, limiting a developers' exposure to the broader ecosystem and its capabilities.
In addition, you're more likely to hit upon obstacles integrating other code into your application if that other code has not been built with the opinionated mechanism in mind.
This is not exclusive to Laravel.
Blindly hating PHP is the 'cool' thing to do by people who don't know any better. I say blindly because most of those expressing the hate have never used PHP, or if they did, it was back in the 5.x days. Look beyond that and you'll see PHP is a powerful and well respected language.
Laravel is a framework used to build PHP applications, it is extremely opinionated, that means it expects you to do things the magical Laravel way, and punishes you if you try to do things differently. It allows you to make sites quickly, but limits your growth options.
PHP works almost the same on any OS, the main difference is how you install it and some of the supported extensions. If you are just starting off I would recommend learning how to install and run PHP within Docker.
Congratulations, you now have credit card details resident in memory and potentially webserver logs. Was there an error? Now they're potentially in your error logs too as part of a stack trace.
That's before we even consider how locked down access to the code and servers is.
Avoid touching credit cards if possible, and use a third party service so you never have to deal with them directly.
Handling credit card data is enormously complex in terms of the PCI requirements the payment gateway will require you to comply with, and not doing so can lead to hefty penalties.
Source maps.
Stack overflow typically requires knowing what you're looking for in the first place.
It's hard to discuss it without showing the other side of the coin, i.e. a representative sample of those posts that have been deleted. Also, do the people responding to those posts fall under the "enablers" category you said you would like to see less of?
I have experienced situations where I have spent time writing meaningful technical replies to things, only to find the thread deleted by the time I hit send, or shortly thereafter.
Something that immediately comes to mind was one last month I believe it was, about the relationship between web servers and CGI.
I find the enforcement of this subs blanket "no help posts" rule counterproductive.
People asking questions is not only an essential mechanism for people to learn, but the replies and the discussions that go with them often provide a broader discussion, as well as providing a kind of peer review.
This sub has 143k members. If someone posts an interesting question, and receives a meaningful reply, maybe even extended discussion, that's potentially many thousands of people that have learnt something that they otherwise would not have.
That's much more valuable to our community than a rehashed blog post.
What it shouldn't be is a venue for homework questions. But there is clearly a difference between a low-effort question, and an interesting, thought provoking question related to PHP, its internals, or software development in general.
I find the comment about "help question enablers" unpalatable. Because in many cases, if we took that question, used it as the title of a blog post, and wrote our reply below it, then posted that blog post containing identical content, it would stay.
tl;dr: Remove low effort help posts, keep more interesting ones.
A useful search engines must provide more than just relevance, it must attempt to decide what is the most relevant.
That is why pagerank is so valuable to Google. It's the ranking element.
Without wishing to appear mean, if we knew how to do that at scale, well, we wouldn't be posting on Reddit, as we would be too busy enjoying the sun on our private tropical islands.
There are articles available which cover at least part of algorithms used as part of pagerank, but the amount of data sucked in by Google and alternative search engines to make their products is insane.
The full algorithms are not known outside of these companies, and represent some of the most valuable trade secrets known to mankind.
You're right of course, all things being equal, if performance is free, then take it.
However, from a library users' perspective, I would argue that considerations about the feature set provided by the router (e.g. ease of configuration, debugging, header analysis etc) are almost always more important factors than the tiny performance differences between them.
Any reasonably optimized router will be lost in the background noise of IO.
5.5, 8 years ago.
Calling people "die hards" is not going to win you any arguments here.
You have so far failed to provide any evidence to back up your implicit claim that OOP is wasteful and convoluted ("not fans of OOP boilerplate and ceremony").
Saying you have code to prove it, but you can't show it, is not meaningful evidence in a public debate.
Can you explain "language's brand of OOP".
PHP OOP is comparable to most other languages with the exception of generics and maybe accessors. Please provide examples.
Leaving powerful and well-understood capabilities on the table is not something to be proud of.
You have said that "well-organised procedural codebase can be easier to manage in many ways", so the floor is all yours, prove it.
Types: Where they can be used and what each one can do.
Design patterns: Adapters, decorators etc.
Security: Why SQL injection is bad and how to avoid it. Basic session cookies. Password hashing / verification.
Debugging: When to spam printf and when to use xdebug (and how).
Error handling: PHP is bad at this.
Magic: What it means if you come across a __call, __get, __set, __invoke etc.
Most other things such as what functions are available and their parameters, you can look up in the manual as needed.
FastCGI is the network protocol that NGINX uses to communicate with PHP-FPM. It just sends the file path, headers and a few other things, and receives the output.
A process using FastCGI is different than CGI process because FastCGI allows a single process to handle more than one request, so it remains alive after the each request has completed, and listens for another request to be passed to it over its control socket.
When PHP-FPM receives those requests over FastCGI, it can then pass that data along to one of its worker processes. PHP-FPM is capable of buffering requests, as well as scaling the number of workers up and down in response to demand.
The worker (the main PHP process) is what then does the parsing, lexing, AST, building the opcodes and then processing them. It then passes the information back to FPM, which then passes it back to NGINX.
It depends where your database is. If it is local and well optimized each query will only take a few thousandths of a second.
You can have the best of both worlds by using caching.
They are explicitly designed not to be predictable and will suck in entropy from other sources to try and make sure of it.
It sounds as though you are in a really bad position.
Refactoring one application is a hard, time consuming job, refactoring the core of dozens of disconnected websites and then making them all work with it is a practical impossibility as everything you touch is likely to be an API break.
(This is the same problem that something like Wordpress has)
Even if you were to use automated refactoring tools such as those built into PHPStorm or Rector, there is no guarantee that they would apply consistently to child projects. It may also take longer to create and test these rules than it would to re-write the child sites.
My question would be what resources do you have to solve this problem. A team of developers? Multiple years?
Someone needs to look at the business case. Wil the product still be on the market by the time such a large scale rework is complete.
What are the consequences of NOT doing it? Are the security vulnerabilities severe enough that they could cause data loss and possible lawsuits.
Is there a possibility of taking the data and migrating it to an alternative product?
There's a lot more that needs to go into evaluating options.
How big? You have to make a determination if it is salvageable. Not everything is.