Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
I've never had experience with it. I've always used apache as I find it easier for myself and I've never had a problem that was solved with needing to switch
-
1. Very wise choice. Production wise, NginX is much better from my experience. Configuration is painless, doing load balancing, compression, using TLS and HTTP/2 and static file caching is super simple. I'd 100% recommend it over Apache.
2. Sure. PHP is always kept in the backend. By the way, using a framework like Laravel or CI is highly recommended. Using an opinionated framework gives you much less rope to hang yourself in a team environment.
3. If you're making a SPA or PWA, using PHP should be kept for making REST APIs only. That should be fine, considering devRant is using the same approach.
Keep in mind that SPA renders on the client and it might be prerendered on the server. A traditional web app on PHP always render on the server only, so using PHP to do the rendering part is not feasible.
In simple terms, just serve your React/Vue SPA as a static file, or use Hypernova for server rendering. Then, connect to the backend via REST API created on PHP.
Best of luck! -
@DLMousey i'd say about 80% cause of the way apache serves request, wiether its a php file or flat file php is still loaded in memory. While with nginx php is only loaded with php files so apache would be more limited on cheap vps than nginx would.
-
@DLMousey it varies alittle bit on how much memory your php scripts take but i have put a $5 droplet in a hard swap with apache cause of mod php. Generally it just boils down to the processes vs threads arguement, apache loads php into each child process which takes up usable memory and those processes are used to serve everything wheither they are php or not. Nginx serves with php-fpm so php is loaded as many cgi backends you have but static request don't use the memory hogged processes to serve them which allows more concurrent request. Which for sites with alot of static content nginx would have better performance but at the same time if the whole site generated with php besides maybe 3-5 files you probably wouldnt see much of a difference
Related Rants
Looking for advice here.
Is it wise to use nginx instead of Apache if running php (in regards to the LAMP stack)? And can php be kept strictly in the backend? I've never used php before and now I get the chance (yippie) so I want to hear what you guys have to say. Previously I've used node. And also, can frontend libraries like react or vue be used alongside php or is it just going to turn into a smorgasbord of nonsense.
Thank you for any advice :)
undefined
php
advice