93 points · by agopaul · 10y ago · 91 comments
New energy in an ecosystem is never a bad thing.
We aren't working in that environment any more. What software runs on a server is no longer up to the hosting company. A developer/devop can configure a server far more easily, with no input from a sysadmin. The process can be completely automated. That change has opened up development options considerably. That doesn't mean writing code in PHP is a bad choice, but it does mean there is a choice. PHP's primary advantage has been eroded to the point where it should no longer impact the decision making process when you're figuring out what to use. Everything else has caught up.
In terms of initial setup of an application than doesn't use anything but the standard library in either language I would completely agree with you.
Edit: Composer, not Artisan as dependency manager in PHP.
"We" are a minority.
The vast majority of websites out there are still hosted on shared servers over which the customer has very little control other than installing and updating WordPress. You might be able to convince cPanel to let you run a Rails app, but the system as a whole was designed with PHP in mind.
The owners of those websites have absolutely zero interest in messing with the server environment. They're not developers. They've probably never heard of devops. They're totally allergic to SSH and can barely even use FTP. And yet, these are the people who, whether knowingly or not, help keep the web as decentralized as it is. PHP was the only language that catered to them 15 years ago, and it still is the only language that makes this possible on a large scale.
I host my blog with NearlyFreeSpeech.net. The whole site is just a couple of PHP scripts. I haven't updated it in almost a year, but it keeps working, no maintenance required. If I had to host it on DigitalOcean like all the cool kids do, it would cost me 10x more in monthly fees (even with the smallest droplet) and 100x more in time. This kind of setup is what I call "It just works." Not dockerfiles and bootstrapping commands and all sorts of dependency management tools.
The smallest droplet is 5 dollars a month, do you pay 50 cents a month for your shared hosting?
>100x more in time
Have you even looked into DO or are you just making assumptions? You can create a ton of apps with one click (One-click apps) and install a full stack with WordPress, Drupal, Django, and much, much more, and it just works. If anything, it's the same amount of effort as some cPanel shared hosting.
This. My first web programming was in Perl [1], and using PHP was much simpler to get into. You just uploaded it and it worked.
I think the biggest problem with PHP was it was a hammer and everything looked like a nail. That created a lot of spaghetti code.
[1] I still have a soft spot in my heart for Perl. I don't think it was an issue of "PHP is better than Perl", just that PHP was easier/faster.
Wordpress is an example of a PHP application that just works and deploys easily, but it also not using a lot of libraries. My take, and it may very well be wrong, is that the ecosystem is a nightmare in terms of deploying application. There's everything you could ever want though.
Of cause my experience may be down to the applications I tried to deploy.
Then the day I started I learned the sad truth. The "Technical Architect" laid down the law: all applications had to be written in Zend Framework 2 and nothing else. I gave it a chance, read all the docs and wrote an app in it. Suffice to say there was a scarce community and lots of defects. I also found how it worked overly complex. Imagine taking spring and asking "how can I make this harder and in PHP?" That's how I found the dependency injection framework to be.
Suffice to say I only lasted 3 months before moving on. ;-)
I used ZF2 during the beta, and the activity on SO, their IRC and their forums were high even then, so I can't say I recognize what you say about the scarce community.
That being said, I also agree with carrja99's comments regarding the complexity and defects. Many things felt unfinished, and documentation was pretty poor if you wanted to step outside the boundaries of what was covered in their example applications (which was unfortunately necessary for my project). I ended up reading a great deal of framework code for that project.
I'm not doing PHP at the moment, but I don't think I'd even consider ZF3 at this point given how many other strong frameworks are available.
The if channel was actually quite active I think I was recalling the difficulty of using build tools with... Perforce.
Now ZF2-3 have nothing to distinguish themselves from the other frameworks.
I always flat-out refused to become a Zend Certified Engineer. I'm perfectly willing to gain a certificate for my actual programming capabilities, but not for how well I can remember details in a manual.
There wasn't all that much about 'remembering useless details from a manual' in it. I've taken the cert twice (5.x and 5.3 IIRC) and in neither case was there much in the way of 'manual trivia'. Far more were scanning a piece of code and being able to determine what the outcome was (error? if so, which one? if not, what's the output?) than haystack/needle issues.
Laravel is easily competitive with Rails and Django. PHP7 is usually faster than Python and Ruby in most cases (it's roughly surpassed Facebook's HHVM). Composer and the PHP ecosystem give you very wide and convenient access to high-quality vendor libraries for just about anything you need (similar to gems/npm).
It's not as if it's broken. You can write a fantastic web application or web service using PHP. You can make a mess out of it for sure, but I've seen plenty of Rails projects turn into a big mess too.
1) It just works. 2) Plenty of great frameworks. I especially love Laravel, which has _everything_ from a great IoC to ORM, as well as a huge community around it. 3) It's so easy and quick to get started. 4) HHVM (and also PHP 7) just makes PHP fly.
If your project is primarily web based its a really good choice.
At the end of the day though PHP is just a tool and what matters is how you use it and what's the outcome. If you are familiar with it then why not use it?
I personally feel like the biggest shortcoming of PHP is its legacy and the huge amount of bad code that you can find by searching on Google.
I never used Symfony, but I'm curious to hear from someone who tried both (ZF2, Symfony 2), what they like best of Symfony. Might give it a try in the next projects
I did some research, and after reading this article comparing the PHP frameworks [0], I ended up choosing Laravel, which I think was a great choice. The documentation seems quite good, and there seems to be a strong community. I found this site which has video tutorials that teach the framework https://laracasts.com/
After sitting through a few lessons, I was off, and finished a production ready web application in about a week, and was really proud of how it turned out, especially since I do systems administration for a living and not development.
[0] http://zenofcoding.com/2015/11/16/the-great-php-mvc-framewor...
A little competition or alternatives is always good.
It takes a lot of work and thinking to get to this state that is easy to overlook but it reflects a respect for users from the developers. And it shows. All the top apps in terms of deployment are PHP. I will ignore the many criticisms against it, they may be valid or they may not. The bottom line is utopianism is a deadend, there are always upsides and tradeoffs. PHP is improving and will continue to improve and is relatively simple to learn and use. Kudos.
Python is really a fantastic asset to the community. It's relatively simple to use and deploy thanks to its wide support on most Linux distibutions. I hate complexity and there are tons of interesting things in Python beyond Django. The server story could be improved but its not a deal breaker.
I think Ruby and to some extent Node but Ruby more so shows a thorough disrespect near hostility for the user. Deploying a Ruby app is always time for trepidation and you can be sure it is going to take time unless you are extremely well versed and upto date on the ecosystem ie a developer with a Ruby focus and perhaps that's why Ruby is best used in SAAS scenarios. I have deep doubts on the user focus of developers who expect users to deploy their Ruby apps.
There are tons of issues that crop up, from getting the base environment up and you do need a dev environment which has its own pitfalls and gotchas as gems may need to be built. Then there is the decision of where the gems should be, using things like RVM, Rbenv or the system ruby, the users who should run it and all the shenanigans that comes with it. Then deploying the apps themselves in terms of using things like Bundler which needs its own knowledge base and servers which could mean compiling Passenger with or without Nginx or using Unicorn. That is a lot of know how and it's a complete mess.
Updating apps can be equally troubling. There is no knowing which Ruby gem dependency could fail, which library may be needed, and that particular library may not be in your running distribution so you may need to compile it and that could start a long time consuming chain. This is millions of user and dev hours wasted for nothing, literally, that could be resolved by the developers and is much worse than anything you can throw at PHP which looks almost angelic in comparision. The deep knowlege required makes Ruby and Node extremely unpleasant. It should not take this amount of know how to simply deploy and use an app.
HN is dev focussed and it makes economic sense for devs to have expertise in the most rewarding languages, but this should not detract from the weakness and strengths of languages and I think it does.
Disclaimer: maybe I'm doing something terribly wrong? I don't have much experience deploying python. If so please tell me.
Laravel is the best example for this, with spin-offs in several other languages. (Fair notice: many of the ideas in Laravel are not new, but borrowed/inspired from C#, rails and others)
* Node.js frameworks inspired by Laravel: http://www.adonisjs.com/, https://quorrajs.org/
* Python: http://www.pylonsproject.org/projects/pyramid/about, https://github.com/aacanakin/glim
* Java: http://wings.loonydev.com/
and so on
In other news, the `trait` type was recently popularized by PHP and can now be found in many languages: https://en.wikipedia.org/wiki/Trait_(computer_programming)
For what it's worth I given up on PHP, after using it as my go-to language for about 16 years. I'm drinking the golang cool-aid and never coming back!
PHP lacks consistency in naming conventions, function signatures (is that a string or bitmask I'm supposed to pass?) and tons of other things.
I could write a novel about it, but there's already multiple websites/articles dedicated to PHP's inherent design flaws:
https://whydoesitsuck.com/why-does-php-suck/
https://eev.ee/blog/2012/04/09/php-a-fractal-of-bad-design/
Plus it's limited in capabilities compared to stuff like Node.js (or other libuv bindings), considering we get stuff like Hot Module Reloading, isomorphic/universal applications, simple websockets integration, all of which PHP is either incapable of providing or provides inferior solutions due to limitations of the PHP language or Zend Engine.
Welcome to Javascript?
Your forget what species you're talking with here, and the language you're using to communicate right now :) When has Homo Sapiens ever exerted consistency in language design?! - really, programming languages are more like tools for communication that tools for solving technical problems, and they exhibit all the flaws that you see in other communication tools made by humans...