A good replacement for PHP

I've heard a lot of criticism of PHP, and I generally agree with it, but it's the only CGI language I know well.
What would be a good language to learn for server-side scripting instead?

Attached: 2000px-PHP-logo.svg.png (2000x1080, 129K)

Other urls found in this thread:

webassembly.org/docs/c-and-c /
github.com/NyaaPantsu/nyaa
twitter.com/NSFWRedditImage

Perl

No joke. It is pretty good.

But for projects of size small and medium. IMHO.

Perl Dancer + Template Toolkit is a winner combo.

Node.js, Python, Ruby, etc
Literally anything is better than PHP

PHP is fine as long as you use a framework like Laravel.

That is unless your main focus is to make something actually realtime. PHP as a stateless scripting language cannot do that and either needs underlying OSs help scheduling tasks to run every minute or parallel JS server to support websockets.

What do you guys think of Golang for developing websites?

Pretty good. The stdlib is so immense you basically don't even need a framework. Maybe just the gorilla framework and whatever adapters you need for you db libraries. Compiles to binaries to. Nothing better than just dropping a single binary on a server compared to the unholy diarrhea blast that is uploading PHP, Python, Node, Ruby, etc...

Thank you for answer. I'll look into that.

>nodejs
Single thread on a server with shitty syntax, please do use a favor and kys.

PHP is great and only getting better

Lies

Node is much worse than PHP

C++
Why do you need a VM or an interpreter when you can make your website in pure binary? Invisible memory overhead and maximum flexibility.

For convenience I'd go with Python, it's easy to learn, the tooling might be slightly better than with Node or Ruby, compared to Ruby I'd say it has better ecosystem and compared to Node it's easier to work with and set up on the server.

Though Go could be great for the reasons mentioned. I might even put Rust there too, but just because I like the language, though it's not actually that good building web services, but you could do a minimal backend with it and build your frontend with React, Vue or Angular.

this
webassembly.org/docs/c-and-c /

I used to be a php developer but these days I mostly do devops type integration work in Python. I like Ruby a lot too. Coming from php I find pythons documentation format to be annoying, and Ruby’s is amazing. Python is usually first class when it comes to sdks from vendors like VMware, where Ruby is an afterthought if it even exists. Dependency hell is a problem with both languages, but Python 2.7 is on every server and on my Mac.

I’m defijitely thinking about learning go though, especially for services that aren’t just scripts running as cron jobs. I’m really attracted to the single portable binary without dependency issues.

not really
PHP is better than all of those at majority of tasks.
and it's much faster to do projects with.

Ruby's implementation is on par with PHP's

and python's speed of coding is on par with PHP's

but pythons implementation for web is fucking trash at best.

talk about time sink..

It's alright, the go devs definitely had server/web applications on their mind, more than other languages.

There's a http package in stdlib, handles simple routing and requests/responses, you could fork it and make whatever adjustments you want of course. For testing it's great, right off the bat you can have it serve static files with http.FileServer and then your manually specified routes, of course in production you'd have nginx/whatever serve static files instead.

Concurrency is nice and simple. Struct tags are really neat for DB ORM and JSON de/serialiazation purposes.

Just don't expect something like Django/Laravel/etc, with Go, C, etc, people will kinda shun that method of using one package which just handles everything because your project ends up becoming a slave to it and you don't understand how most of it even works because it's so fucking enormous. Only use the 3rd party packages you need (DB ORM, CSRF stuff, REST API stuff, etc) and mix it together.

Example: github.com/NyaaPantsu/nyaa

>Perl
fpbp

>PHP is better than all of those at majority of tasks.
>and it's much faster to do projects with.

- t. "I have never developed a Rails app in my live"


PHP isn't that bad, especially the newer implementations.

But if you want somthing differnt, try one of those:

>Perl
(+) Perl has style and is fun
(-) Not many Perl webshops arround these days

>Python
(+) Lots of jobs in differnt fields (not only web design)
(-) Django is OK for webdesign, but not amazing

>Ruby
(+) Great for web stuff, lots of libraries, many rails jobs
(-) Ruby jobs are almost always Rails (this is a plus and a minus as well)

>Node.JS + Vue/React/Angular/..
(+) JavaScript everywhere!!!
(-) JavaScript everywhere..


So pick your poison.
If you can't decide waht to use, take three days for each langauge (Python, Perl, Ruby) and decide what feels best for you. For me Ruby felt like a mixture of Perl and Python and is my personal favorite, but that's just me. And since you already know some JavaScript if you are doing web stuff you should already know if you love or detest JavaScript, ususally the is no middle ground here.

>take three days for each language and decide what feels best for you
Good advice, I will do this. Thanks for your input!

c# python golang ruby

> What would be a good language to learn for server-side scripting instead?
JS, obviously.

Get fucked you retard. Why the hell would you willingly use JS when you have other choices on the server side?

Because I hate everything.
> Get fucked
Gladly, if that means you'll get fucked more.

PHP is hands down the best among this shitpile you just listed. Theres a reason it runs on most servers fuck face. These other languages are just current meme trends and will be irrelevant in the coming years.

There's literally nothing wrong with PHP if you're not a Pajeet and know what the hell you're doing. Most of the language's criticism comes down to:

>type juggling can lead to shit being casted in unexpected ways if you're not careful
Sure, but JS is even more insane in that regard, and unlike JS and most scripting languages, PHP supports proper type hinting which is literally best of both worlds in the static vs. dynamic debate. I don't care if Python is statically typed if allows you to pass arbitrary shit to a function because "hurr, muh duck typing".

>stdlib functions have inconsistent names and order of parameters
Yeah, fucking live with it. Most of them were modeled after C functions which were inconsistent in the first place.

>there's a lot of shitty PHP code written by shitty programmers
Absolutely. The low entry barrier was the reason for PHP's success but also its curse. Hobbyists keep learning the language from tutorials written by other hobbyists in 1998 for PHP3. I also blame ancient abominations like fucking Wordpress refusing to fucking die already.

>functions are not first class objects
That's the only valid criticism I can think of.

Recent versions 7+ improve on these except the Pajeet PHP upwork/elance code and blog tutorials everywhere

>Node.js, Python, Ruby, etc
>Literally anything is better than PHP
posts 3 examples slower than php
>Literally anything is better than PHP

Go. It was literally made for server side stuff.

its uglu

Is PHP the natural enemy of the pajeet and hipster?

PHP is a shit language, gets memed by blowhards like who wants to keep his shit PHP job. The only reason it still has a high amount of use is because its the backend Wordpress and there is so much legacy code around due to the fact that PHP was the only backend language available 10 years ago. Using vanilla PHP for any large project would be insane. Using Rails-clone frameworks in such a shit language is only for PHP programmers whos braincells have been too deadend to learn a new language. PHP syntax is just an ungodly mishmash of Perl, C, and Java syntax. The original PHP was just a bunch of Perl scripts. PHP is literally sub-pajeet white trash level shit

Maybe don't do server side rendering in 2018? Make your client devices do it for you. Unless your client device is an IE6 browser, you should have no excuse to not use this approach unless you are simply unfamiliar with it. Hosting static HTML/JS/CSS and running a JSON API are trivial tasks compared to setting up a php-style stack for anything more complicated than a to-do app.

>PHP was the only backend language available 10 years ago
No.
And how do you handle persistence?

>PHP was the only backend language available 10 years ago
No.
>The original PHP was just a bunch of Perl scripts.
No.

>No.
>No.
nice samefag arguments from trailer trash PHP coder

i personally prefer nodejs over php, faster and easier for me

>Maybe don't do server side rendering in 2018? Make your client devices do it for you.
Fuck off. Seriously, as a _user_ of the web, I'd like you to fuck off and die. Web is a collection of resources. When I enter a resource identifier in my browser, I expect to be served a resource, not 5MB of JavaScript that I'm supposed to execute so that 27 XHR requests and bazillion CPU cycles later I can assemble an ephemeral, "resource" for myself because you lazy ass thinks it being 2018 somehow justifies this kind of cancer. Fuck you.

>muh cycles

>nice samefag arguments from trailer trash PHP coder
No.

Attached: no.png (406x138, 10K)

found the jobless neckbeard. get a job you bum

you are part of the cancer killing the web. I hope you die in a lake of soy

>Why do you need a VM or an interpreter when you can make your website in pure binary?

Because I want to spend a few hours coding a site, not a few weeks.

Hey friend I agree with you. Today's slow ass webloat 5.0 annoys the everliving shit out of me. PHP can do fucking everything interface with everything and deliver a ready to render page in microseconds. Meanwhile all these newfag copypasters who call themselves "devs" post 20 billion idiotic questions to stackoverflow about their 20 libraries that they need to display a 1 page scroll-forever site.

I love perl but have never tried it for webdev, will give this a go

Attached: smug_argentina_man.jpg (2048x1365, 247K)

Hack (which is based on php I think?), .net core, maybe some Java frameworks

it all depends on the usage case really, as shit as php is it is one of the more versatile web language to date that doesn't shit the bed with a gazilion folders like node

there's nothing wrong with php, its a nice c like language, only devs who write spaghetti code with it

the only drawback is server code is in a different language from client code, so nodejs it is... as much as I hate the js library 'ecosystem' where they name shit after random unrelated things

Can you tell me if RoR has changed much since beginning, I tried it around 2008ish so in the very beginning, and I mostly got bothered with the tooling, it felt like I was programming in c++/opengl on visual studio.

Now I'm learning Python but mostly for something else than web, but I have tried Django and it doesn't feel that bad, well, I have done a simple blog with it so I'm not an expert. I might like Django better, even though it has pre-2010 aesthetics on it.

php is pretty good, especially since version 7

PHP is just as single-threaded, it's just that you run multiple copies of it, which you can do with nodejs too.

>but pythons implementation for web is fucking trash at best.
Python has no "implementation for web". Every web framework is an external project. I use Python for web stuff, but I don't use any of the third-party frameworks, but just my own minimalist one. Frameworks, IMO, is one of those things that you can just as well do yourself since it's all about matching the site's requirements to your own mental model.