No it doesn't. Nginx doesn't know what PHP is. It just passes the incoming request off to a port. If PHP or Node or whatever is listening on that port, it doesn't matter to nginx.
Nginx is ridiculously easy to learn, and my feeling is people who rely on Apache modules for functionality necessary to their application are designing their application wrong.
That said, you CAN make Apache almost as fast and efficient as nginx, it's just easier to install nginx and get that speed and efficiency out of the box.
I'm sure it is 100% a case of the people in charge of the decision at Slack know Apache and don't know nginx, as you said. But I think learning nginx takes no time at all. I made the switch for our internal servers a few years ago and it was really painless.
Oh please. Don't get over defensive just because I called you out on your ridiculous claim that web apps cause a beach ball due to AJAX requests.
Yes, the calculation will take longer when you have to do an AJAX request instead of doing it in JS. But it shouldn't be more than a fraction of a second, unless your server is having issues, it will be plenty fast.
OP wanted a solution for having to duplicate logic. I provided a total reasonable one. If you think making AJAX requests in a JS app is not doable you are the one who doesn't know anything about writing web apps. Because that's exactly how the web works.
I'm doing something on a web app and my workflow is interrupted as the whole thing freezes and I get a spinner as it calls out.
I dunno what browser you're using but that should never happen due to an AJAX call. They are asynchronous. The rest of the page should continue as normal.
Your assertion that PHP-FPM is only better than Apache with mod_php on multi0core servers is baloney. It depends on what your restriction is.
PHP-FPM has other advantages over mod_php, not least of which is not having to fire up additional PHP processes for every visitor to your site. Even on a single core server, this can be advantageous. Especially if your limiting factor is memory and heavy site usage is causing Apache to actually end up using a pagefile.
The bottom line is while yes, you CAN configure Apache to use PHP workers and be more comparable in performance to the default nginx configuration, Apache is bloated. Nginx is more stable and uses less resources to do the same job. Unless the project necessitates using Apache, I always use nginx.
Definitely if it's working for you don't rework everything.
BUT, if you're going to switch servers anyway, I think it's worth making the jump for a few reasons.
Your HTTP server and your PHP workers SHOULD be separate processes. When you need to restart/reload one of them it shouldn't break both. Going to NGINX separates out the HTTP server from your PHP workers necessarily.
NGINX w/PHP workers uses a lot less memory than Apache when you've got a lot of users hitting your site. It's also usually faster while using less resources.
I realize you can configure Apache with PHP workers, but it's not how most people run Apache. And if you're going to set up Apache that way, IMHO it's better to just switch over to NGINX which is much leaner than Apache.
As far as your rewrite rules, it's really not hard to port those over to NGINX. I'd say when you're hitting that point though, make sure whatever you're doing with rewrite rules really should be done with rewrite rules. A lot of people do application routing in rewrite rules just because it's so easy with .htaccess files, but that's a bad way to go and you should fix your application if that's what's going on.
That is not normal at all, that's totally fucked up. Also it's stupid because you're inevitably going to find situations where something works on dev and then breaks on live.
Your dev environment should exactly mirror your live environment.
I realize that. That should have been obvious to you from my last comment.
People use LAMP as a shorthand, though, to refer to any similar PHP stack. It's not 100% accurate but it's a lot easier than spelling out all the possible variations or saying "Unix-y PHP stack".
Right, he could be developing for a WAMP stack but I was using LAMP here as a shortcut for all PHP stacks (he could be using nginx, some other kind of DB, etc.)
Yeah, developing for LAMP on Windows is like developing for .NET on Linux. Well, not quite that bad, but you get my point. People who are developing a web app on Windows are usually going to use .NET. And if someone is going to develop PHP (or Ruby, Node, etc.) they will usually be on Linux or OS X.
So if your new machine is a dedicated development machine I would strongly recommend dual booting Ubuntu or something.
As someone who works in the hosting industry this is not a good idea. Just get an affordable VPS somewhere and use that. Make sure the VPS meets the minimum specs of whatever you're trying to do. If you're developing your own game then don't waste money on any kind of hosting until you need to; develop locally.
They're being complete idiots. Any program written in any language can be secure or insecure, there's nothing about the language itself that guarantees it will be one or the other.
If they're concerned about the security of the scripts then an audit should be done.
Uh huh. I set it up and maintain it. Whatever you say, dude. Done arguing with someone so dumb.
I use nginx and PHP every day for many production and development servers at work. So, yeah, I understand them just fine.
No it doesn't. Nginx doesn't know what PHP is. It just passes the incoming request off to a port. If PHP or Node or whatever is listening on that port, it doesn't matter to nginx.
I don't think you really understand nginx.
Well nginx has nothing to do with how your PHP performs, that's one of its advantages over Apache IMHO.
Nginx is ridiculously easy to learn, and my feeling is people who rely on Apache modules for functionality necessary to their application are designing their application wrong.
That said, you CAN make Apache almost as fast and efficient as nginx, it's just easier to install nginx and get that speed and efficiency out of the box.
I'm sure it is 100% a case of the people in charge of the decision at Slack know Apache and don't know nginx, as you said. But I think learning nginx takes no time at all. I made the switch for our internal servers a few years ago and it was really painless.
PHP is still used for a lot of big projects. What's more surprising (to me) is that something like this is using Apache and not nginx.
Says the idiot who claimed AJAX requests cause beach balls.
I'm a lead web developer and I've been programming for over 25 years. You're an imbecile.
I"m done wasting my time on you.
Oh please. Don't get over defensive just because I called you out on your ridiculous claim that web apps cause a beach ball due to AJAX requests.
Yes, the calculation will take longer when you have to do an AJAX request instead of doing it in JS. But it shouldn't be more than a fraction of a second, unless your server is having issues, it will be plenty fast.
OP wanted a solution for having to duplicate logic. I provided a total reasonable one. If you think making AJAX requests in a JS app is not doable you are the one who doesn't know anything about writing web apps. Because that's exactly how the web works.
I dunno what browser you're using but that should never happen due to an AJAX call. They are asynchronous. The rest of the page should continue as normal.
Well, if making an AJAX call is too slow maybe your server isn't up to the task. :P
Have you considered keeping all the logic in PHP and just making AJAX calls from JavaScript to have the PHP perform the logic and give you the output?
That's not the same thing that the OP was asking for at all.
If you're creating generic objects so often that this bothers you You're Doing it Wrong(tm).
Your assertion that PHP-FPM is only better than Apache with mod_php on multi0core servers is baloney. It depends on what your restriction is.
PHP-FPM has other advantages over mod_php, not least of which is not having to fire up additional PHP processes for every visitor to your site. Even on a single core server, this can be advantageous. Especially if your limiting factor is memory and heavy site usage is causing Apache to actually end up using a pagefile.
The bottom line is while yes, you CAN configure Apache to use PHP workers and be more comparable in performance to the default nginx configuration, Apache is bloated. Nginx is more stable and uses less resources to do the same job. Unless the project necessitates using Apache, I always use nginx.
Definitely if it's working for you don't rework everything.
BUT, if you're going to switch servers anyway, I think it's worth making the jump for a few reasons.
Your HTTP server and your PHP workers SHOULD be separate processes. When you need to restart/reload one of them it shouldn't break both. Going to NGINX separates out the HTTP server from your PHP workers necessarily.
NGINX w/PHP workers uses a lot less memory than Apache when you've got a lot of users hitting your site. It's also usually faster while using less resources.
I realize you can configure Apache with PHP workers, but it's not how most people run Apache. And if you're going to set up Apache that way, IMHO it's better to just switch over to NGINX which is much leaner than Apache.
As far as your rewrite rules, it's really not hard to port those over to NGINX. I'd say when you're hitting that point though, make sure whatever you're doing with rewrite rules really should be done with rewrite rules. A lot of people do application routing in rewrite rules just because it's so easy with .htaccess files, but that's a bad way to go and you should fix your application if that's what's going on.
That is not normal at all, that's totally fucked up. Also it's stupid because you're inevitably going to find situations where something works on dev and then breaks on live.
Your dev environment should exactly mirror your live environment.
Nasty crap like this happens in every language. It's just bad code. Nothing unique to PHP.
I realize that. That should have been obvious to you from my last comment.
People use LAMP as a shorthand, though, to refer to any similar PHP stack. It's not 100% accurate but it's a lot easier than spelling out all the possible variations or saying "Unix-y PHP stack".
Right, he could be developing for a WAMP stack but I was using LAMP here as a shortcut for all PHP stacks (he could be using nginx, some other kind of DB, etc.)
Yeah, developing for LAMP on Windows is like developing for .NET on Linux. Well, not quite that bad, but you get my point. People who are developing a web app on Windows are usually going to use .NET. And if someone is going to develop PHP (or Ruby, Node, etc.) they will usually be on Linux or OS X.
So if your new machine is a dedicated development machine I would strongly recommend dual booting Ubuntu or something.
There are no good programming patterns that use eval. People use it because they are solving a problem the wrong way. Don't use it.
EDIT:
People saying that you shouldn't trust user inputs are right, you shouldn't. Ever.
But you ALSO shouldn't use eval.
Ugh, Terrible. So cliched and awful.
As someone who works in the hosting industry this is not a good idea. Just get an affordable VPS somewhere and use that. Make sure the VPS meets the minimum specs of whatever you're trying to do. If you're developing your own game then don't waste money on any kind of hosting until you need to; develop locally.
They're being complete idiots. Any program written in any language can be secure or insecure, there's nothing about the language itself that guarantees it will be one or the other.
If they're concerned about the security of the scripts then an audit should be done.
Temp laying systems are a good option, yes.