3 ms·
That ship has sailed a long time ago (or you're just playing around and most languages will have a REPL nowadays) Modern PHP wears a business suit and wants to
by makeitdouble 5y ago
That ship has sailed a long time ago (or you're just playing around and most languages will have a REPL nowadays)
Modern PHP wears a business suit and wants to buddy the "big boys" (Java/C#) of the world. You'll have deployment pipelines, strong push towards classic OOP, strict type checking etc.
I personally think ruby for instance is leaner in its dev process in most real world projects.
- chinathrow 5y agoOP is correct, you still can develop like this with PHP, and no the ship has not sailed for many. You can have deployment pipelines etc, but if you like, you can still develop the ancient way - it still works.
- makeitdouble 5y agoSure, but would you have that in production for the company you work for? One can also use old school CGI to serve their site, it’s super lightweight and you just upload the file at the right place, for almost any language. But that has been deprecated for the last 2 decades now.
- djbusby 5y agoOdd, I'm getting Perl/CGI gigs still. I should tell them to rewrite to...what's cool now?
- makeitdouble 5y agoI see a number artisans managing their business on pen and paper, and handwrite receipts. It works for them, but I wont tell random people starting a business now to go with pen and paper, 99% of the time that would be a bad advice when there are much much better alternatives now.
- datenarsch 5y agoWell I can still develop like this in ASP.NET if I wanted to and probably and many other languages/frameworks too, so it's not exactly unique.
- hutrdvnj 5y agoapt-get install libapache2-mod-python Now you can put .py files into your www folder, like .php files.
- jeroenhd 5y agoMany people learn PHP as a first or at least as an early language. They don't want to know about deployment pipelines, CI/CD, or how to configure JDBC, they want to make a website store a list of names. You can't easily generate HTML from Java without some kind of templating language and framework around it, or a billion string concatenations if you're working without external libraries. ASP.NET has an advantage similar to PHP, but getting ASP.NET up and running has always been a chore in my opinion; there are a lot of moving parts that you need to configure right to get the browser to show you the end result. I believe that PHP is the easiest way to just Get Things Done when you're starting out with a programming language. To deploy a website, you sign up for a free account somewhere, often with a free subdomain like mywebsite.cheapwebhosting.com, put the files on there and hit refresh. Seeing a result immediately is very motivating for beginners, and PHP doesn't require knowing anything complex like DOM manipulation to generate web pages the way Javascript does. If there were as many free web hosts that allowed the same ease of use for C# or some other language with inline templating, I'm sure it'd take off just as easily. The language isn't as bad as people claim either, I think it's on par with languages like Python and Javascript. PHP has its quirks, like using a dollar sign for variables, it's really not that much worse than its competitors. Shorthands like $_POST/GET/SESSION are such a relief to work with compared to the "professional" languages with their frameworks upon frameworks and complex, layered objects representing state. It's a great tool for setting up a simple website, maybe even a very basic web shop, where the "big boys" are complete overkill. A website like HN doesn't need more than a few PHP files to function until it hits a certain scale, and even then scaling up PHP websites is relatively easy. I think the real reason people hate PHP is because it's a language used by a lot of beginners and intermediate programmers who overestimate their ability and deliver subpar projects that someone else now needs to maintain or rewrite. I wouldn't want to inherit some kind of custom blogging engine written by an intern three years ago in any programming language, and because of its ease of development many PHP programs are just designed badly.
- makeitdouble 5y agoMy issue with your approach is your first time programer still needs to: - install/update PHP or go with the outdated version that shipped with their system. - have a hosting service that will accept random PHP files - know what their hosting's PHP version/configuration is to match it locally. For instance their hosting will keep the most secure config possible, thus no out of the box fetching of URLs. - endlessly fight to find syntax errors as they are too new to have a linter. Depending on the PHP version they settled on they won't have error logs in one place but two. - fight the endless stream of out of date tips and tricks left by 2 decades of PHP programers of various pedigree. All of these have different variations for different languages, they all have their barriers and dead bodies in the closet. My take is that PHP isn't specially beginner friendly at this point, at least not as friendly as it was when it began. Making a public website from scratch will be complex anyway, so they might as well go with a saner setup that uses a templating language and not write code right into the HTML. It won't be much harder and they'll have a fighting chance to find up to date tutorial to host their project easily (hosting a rails project on Heroku for instance could be miles easier in that respect)
- path411 5y agoHaving a ci/cd pipeline is much different than having to setup and maintain local environment build pipelines.