
Leaving PHP is too expensive - staticelf
http://sucky.ninja/leaving-php-is-too-expensive/
======
ef4
If you program for a living and you worry about hosting costs for small
projects, you are misjudging your opportunity cost. You are valuing yourself
way too low.

You're going to pour $5000 or $10000 worth of your time into a project, but
then balk at spending $100 to host it long enough to see if it grows. Makes no
sense.

And if you are cash poor, you're much better off spending some of that project
time getting paid, and you'll soon be able to afford as much hosting as you
want.

~~~
staticelf
This is kind of the point I am trying to make. Laravel Forge is selling me
that time I would spend on configuration for a fraction of the price of other
services.

But yes, I agree with you, kind of. But my websites are never probably going
to have a lot of visitors. I want to build up a network of sites that all give
me a small amount of income. Perhaps in the future it will give me more income
and then I could spend it more wisely.

~~~
Zyst
The point I understood from your article makes is that the few dollars you are
saving over having another language stack (Java/Python/etc) makes using PHP
over them worth it.

Which, as people here mentioned, shouldn't really be your main consideration.
If you wanna keep programming in PHP that's perfectly fine, but all in all the
minor price difference between stack hosting prices is a poor excuse to
justify it.

~~~
brightball
It also depends on the situation. He's said that he's looking for several
small sites to provide extra income meaning that he's looking at it from a
cash-flow perspective. From a cash flow perspective, hosting cost definitely
is a factor.

This is the specific type of situation that PHP is almost ideal for because it
scales down better than most other languages since everything is loaded and
processed on-request instead of booting up to preload. You can host 1,000 PHP
sites on a single small server as long as the concurrent traffic doesn't
outstrip the specs. With most other languages that have to boot and preload,
you're restricted before traffic becomes a consideration.

PHP's not the right choice for every situation but for his use case it's
pretty solid.

------
donutdan4114
I've been really liking PHP lately. PHP 7 has awesome new features and
performance improvements. Of course, PHP isn't right for every application,
but I feel like PHP needs to be taken more seriously, compared to Ruby and
Python, for large-scale applications, and fast-response web services.

It's hard to break an old stigma.. but.. PHP7 is NOTHING like PHP4, and a LOT
better than PHP5.x.

~~~
maxxxxx
We have some scripts in PHP and yes, PHP 7 is a big step forward. In some ways
it's more advanced than C# in terms of language features. It's still ugly but
you can do very interesting things with it.

~~~
thrownear
>In some ways it's more advanced than C# in terms of language features.

Like..?

~~~
maxxxxx
Traits, closures don't capture everything by reference

~~~
andreygrehov
Traits are available since PHP 5.4.

------
stickfigure
If you're just looking for a cheap platform for personal projects, why not
Google App Engine? You can spin up a dozen free low-traffic projects without
trouble, and if you have at least one Real project getting billed you can get
more. Hell, you can even use PHP.

However, ultimately, you get what you pay for. Sure, you can get a cheap VPS
that you manage yourself, and will die when the hardware it's on craps out. Or
you can go with a managed service that handles failover, replication, backups,
etc for you. Somebody ultimately has to get paid for all that work. It's
amazing that Heroku, GAE, et all are as cheap as they are.

Self-hosting is cheap only if you do not value your time.

~~~
staticelf
Mostly because GAE disables me to choose any stack I want. I need to use
specific frameworks/tools to use their SQL variant AFAIK.

~~~
tracker1
GAE supports several options... and the SQL interface uses MySQL's API.

------
mschuster91
PHP, for all its faults, enjoys one advantage over, basically, everything
else: SCALE.

People have figured out how to build dead cheap mass hosting in PHP.

You can support next to infinite numbers of small projects on a single
apache+mod_php server - as long as they don't get many visitors you're fine.

NodeJS, Java or other hipster languages will require one instance of a runtime
for each project that runs.

Also, the problems of how to host and develop PHP project have been solved -
for a hoster it's usually enough to tell people "here's your ftp, here's your
mysql access data, have fun". No other environment (except static HTML of
course) comes anywhere close to that.

~~~
ninjakeyboard
"Scale" doesn't mean being able to run many applications on a server - it
means being able to serve a lot of traffic. Dynamic languages are inherently
slower and one thread per request server models tend to perform poorly once
they hit a certain concurrency threshold because the cost of
creating/destroying and context switching between threads becomes pretty high.
The reason people talk about node being performant is because it uses a small
number of threads with event driven approaches (well, one thread in Javascript
itself.)

You'll see a lot of the modern approaches use event driven approaches
(Typesafe/Play/Akka/Scala, node, nginx etc) because they handle high levels of
concurrency much better than one-thread-per-request models of yester-year. The
issue isn't so much one thread per request models as much as it is waiting
around for database access etc. Once threads are parked and sleeping,
performance will really suffer at scale.

Any use case where you have to read from remote datastores will like topple
over pretty quickly or else be very expensive to scale if you're using PHP.
The blocking thread-per-request model really doesn't scale very well.

~~~
tyingq
This makes sense, but isn't really about PHP at all. You're comparing node.js,
with it's built-in event driven web server to ANY language running in a
fastcgi or mod_xxx fashion. Python, perl, etc, running under fastcgi would all
have the same downsides you are citing.

You can, for example, use Facebook's HHVM+Proxygen to serve up event driven
PHP. That would be a more direct comparison to node.

------
ultramancool
You can do the same for even less money and with any language - $5/mo
digitalocean box and a quick hack ansible script to deploy. Maybe if you
really don't understand the ops side of things you won't like even writing a
little ansible script, but heck, I'd do it just to save $14/mo over this guy's
scheme. I think understanding the ops side of things on your own small scale
sites is quite useful sometimes though.

~~~
JonoBB
What about firewall config? What about installing SSL certs? What about
subdomains? What about queue workers? Cron jobs?

The whole point of the article is that those items are completely beyond many
devs. Yes, you could learn to do it yourself, but its just _so_ much easier to
get started with a service like Forge.

~~~
arien
There are tons of runbooks in DigitalOcean's community, or Webfaction's or
whatever else that guide you step by step on how to configure things.

It's a matter of choice, you can spend some extra money and have those things
handled for you or you can save it and do it yourself (perhaps just once if
you use some config management tool to save your settings).

P.S. It's also worth asking oneself, are these things really required for my
small, personal projects? Perhaps they aren't and you can save yourself both
time and money.

------
ddorian43
So the whole point is shared hosting ? Use
[https://www.webfaction.com/?aid=9281](https://www.webfaction.com/?aid=9281)
(affiliate link so I don't pay for my own account), it is best-host in the
world and also does your django,nodejs,rials,postgis,redis,whatever stuff.

~~~
sergiotapia
WebFaction is so good, I don't know why they aren't more popular.

------
drinchev
So the OP says hosting is expensive and in the same time pays for provisioning
service + the hosting service.

That's sad. I wrote my `git deploy` server-provisioning script with ansible
[1] for a weekend. Using DigitalOcean's API you can make a deployable server
in your bootstrapping phase ( like running yo [2] ). I'm using this script
since an year and so far it saved me 120$, I guess.

What I don't have here is support for scaling, but anyway I hope one day I
would need to scale my hobby-project to a point that I can see the difference
between 1 and 4 VPS. Also keep in mind that PHP is a bit slower than the
alternatives these days - NodeJS, Go ...

Hmm...

[1] [https://www.ansible.com/](https://www.ansible.com/) [2]
[http://yeoman.io/generators/](http://yeoman.io/generators/)

------
epx
PHP has batteries included. For almost everything you can imagine doing, from
image manipulation to send e-mail, there is some (poorly conceived) API.

And, coupled to Apache MPM or equivalent, it offers a very simple model of
development with good scalability. A PHP script can work top-to-bottom, as if
it were the only thing in the Web server, and MPM will run that script in any
number of parallel instances. Many, many developers can't grasp more complex
models e.g. Node.js asynchronous. So there is impedance match between some
average programmer with a good idea to implement, and the tool.

Given these factors, people start some prototype in PHP, and one day the
prototype becomes a major product, and rewriting it is prohibitively
expensive.

~~~
chias
> For almost everything you can imagine doing, from image manipulation to send
> e-mail, there is some (poorly conceived) API.

My favorite example of this:
[http://php.net/manual/en/function.gzgetss.php](http://php.net/manual/en/function.gzgetss.php)

It tickles me seven shades of pink that this function is _built into the
language_.

------
jfoster
If Heroku is amazing but too expensive, what about Google App Engine? As an
under-utilised Google service there is the risk of it being shut down, but
aside from that, it delivers on the PaaS promise quite well. The free tier is
generous and works on a per-app basis.

~~~
aikah
> The free tier is generous and works on a per-app basi

The RDBMS isn't part of the free tier AFAIK. The free tier has an horrible
datastore and some weird limitations. You can't even do external http requests
with your own libs you have to use some stuff provided by Google, and it
rewrites incoming request headers.

Nobody is using AppEngine because it is not a good service, even for free. I'm
not talking about the latest "google cloud" PaaS which is a very different
service.

------
true_religion
Heroku's free tier seems to be built for hobby or small scale projects.

All it requires is that your application not receive traffic for at least 6
hours per day and have less than 10,000 rows in the database.

Granted it is easy to go past these limits, but it is also very easy not to.
Lots of school projects have no need for this. Most hobby sites really don't
need to be up 24/7\. Generally, if you aren't making money from it, you have
to question: does it need to be live 100% of the time? If not, then Heroku is
great and you pay $0.

------
Zyst
Hijacking a bit of the thread. Does anyone know of a price sensitive ASP.NET
setup?

I would love to use ASP.NET for hobby projects, but it really is quite
prohibitive price-wise compared to almost every other web setup.

Hopefully prices will go down with ASP.NET 5 being able to run on OS X and
Linux, but as of right now I haven't really found any cheap alternatives to
Azure to run ASP.NET on.

~~~
reboog711
Price sensitivity is open to interpretation. I have a Windows VPS from
AccuwebHosting

[https://www.accuwebhosting.com/vps-hosting/windows-vps-
hosti...](https://www.accuwebhosting.com/vps-hosting/windows-vps-hosting/vps-
classic)

Less than $10 a month on their lower priced plans; although over the years I
have beefed up my machine. I use it for ColdFusion apps/sites primarily,
however there is no reason why .NET wouldn't work.

~~~
Zyst
Thanks, I'll check it out. Pricing looks good.

------
tracker1
Dokku or dokku alt on digital ocean... A $40 VPS can handle quite a bit of
load... there's not much in terms of scaling, or redundancy, but as a starting
point, with similar cognitive overhead, it's a nice starting point and
value... Once you need more, you can worry about it when you need it.

(posted same comment on-site)

------
Mahn
> _Laravel Forge is a service that for $9 a month they will provision
> unlimited production ready php servers (install, setup and configure) and
> you can control it all from a web interface._

So, perhaps I'm missing something here, but how is this economically viable
for Lavarel?

~~~
developer2
You didn't finish reading the article. The $9 gets you unlimited
setup/configuration/management of servers and projects. You separately pay for
the servers at your host of choice. His example is the $9 at Laravel Forge +
$10 server at Linode. The $9 is a convenience package for managing things, not
including the cost of hosting itself.

Of course if your load is small, you can host multiple projects on a single
server. So you don't need to pay for a $10 Linode per project, unlike what
people do with Heroku where you pay the full hosting cost per project.

------
kentt
Is the point of this article is that hosting non-php sites is too expensive or
difficult? That really isn't true.

If you just need to get a LAMP stack there's thousands of inexpensive options.
If you want to something free and scalable like heroku, openshift would work.

------
ck2
HHVM and PHP7 change everything about php, the performance is incredible now.

You can use a $20 per YEAR vps and get really decent performance with nginx +
php7

------
EugeneOZ
Thinking "PHP is enough" and not trying/learning new things - that what is
much more expensive.

~~~
vinceguidry
Why wouldn't PHP be enough? It solves problems, you can make money with it,
what more do you want?

I use Ruby, and I see zero reason to venture outside of my domain. I can
happily keep using and learning and diving deep into Ruby for the rest of my
career. I used to worry that I'd eventually become obsolete, but languages do
not really go away. People still make fine livings coding in Fortran.

There is a world outside of code, you know.

~~~
jeena
[https://en.wiktionary.org/wiki/if_all_you_have_is_a_hammer,_...](https://en.wiktionary.org/wiki/if_all_you_have_is_a_hammer,_everything_looks_like_a_nail)

~~~
vinceguidry
All I'm getting paid to do is drive nails.

If I want to scratch an itch, I'll start a side project. Then again, I use
Ruby because I love it, so my side projects tend to also use Ruby.

Also, programming languages are not tools. The tools are the programs written
in the language. The language is just the human interface layer. Why people
get emotional about this I have no idea. (three downvotes in 1 minute on GP)

With a programming language, you custom-build a tool for every nail-like
object you have to drive into wood-like material.

~~~
jeena
> All I'm getting paid to do is drive nails.

Because you only have a hammer, what do you expect?

> Also, programming languages are not tools

That is obviously not true. If I want to write a decision engine then Prolog
is a good tool for that, if I want to write a high volume web-api then Go or
Erlang is a good tool for that, if I want to write a kernel module then C is a
good tool for that. And so on.

Saying that all objects are nail-like and all materials are wood-like is, at
least in my world, quite crazy.

~~~
vinceguidry
> Because you only have a hammer, what do you expect?

That's right. But it's not that I have a hammer. I am the hammer. Ruby is an
extension of my mind, just like how a fencer's sword becomes an extension of
his arm.

Why in the world would a champion fencer stop spending 10+ hours a day
practicing his art and start picking up axe throwing? Doesn't make any sense.
It's not something you would do by choice.

I used to think that devs who bounced around languages and tech stacks were
getting more well-rounded. Now I believe they are cheating themselves out of
mastery.

> That is obviously not true. If I want to write a decision engine then Prolog
> is a good tool for that, if I want to write a high volume web-api then Go or
> Erlang is a good tool for that, if I want to write a kernel module then C is
> a good tool for that. And so on.

That's ridiculous. I can write a decision engine in Ruby. I can write a high-
volume web-API using Rails. You can even write a kernel module with Ruby:

[https://github.com/utshina/mruby-lkm](https://github.com/utshina/mruby-lkm)

~~~
fenollp
You are both right.

One says such-and-such is good for this, which is right (keyword is _good_ ).
The other says "I can do this and that with my hammer". Yes, true.

But yeah add the words "not slow as hell" and "maintainable" and one of you is
right, the other is delusional.

BTW that link to "a kernel module wrote in Ruby" is pretty much all C with a
few lines of Ruby on top.

~~~
vinceguidry
> BTW that link to "a kernel module wrote in Ruby" is pretty much all C with a
> few lines of Ruby on top.

Did you just look at the language stats? That project implements Ruby using
mruby in a kernel module. Of course it's written in C, Ruby is written in C.
The few bits of Ruby are just a hello world example.

------
sharemywin
I think you should actually put a number with your time and do the math. It's
all guessing though.

------
bobby_9x
For web projects, I still use PHP+Codeigniter. There still aren't good,
mature, battle tested frameworks in any other language.

If I could, I would gladly replace my code base with Python.

Edit: It's pretty telling about the HN community when I simply post an honest
opinion about my coding practices, and I am down voted into oblivion.

How are we ever going to actually progress when we can't even talk about
things openly and honestly without getting the equivalent of shouted down.

Your feelings may be hurt, but I'm still not going to use Django until it
improves.

~~~
ogsharkman
I'm not against PHP but that statement is flat out wrong. To me it seems a lot
of PHP frameworks are building on the frameworks that came before them in
other languages like Rails, Django, et al which is a good thing.

------
xyzzy4
_> The problem with Heroku is their pricing model and while $7 doesn't look
like a lot it rockets when you have several projects. Just having 10
applications make the cost go up to $70 which is already too much to put down
each month for something that might as well not pan out to anything._

Couldn't you have one Heroku app instance that runs multiple PHP apps?

~~~
staticelf
This made me curious, how would you setup that if you want different domains
for each php app?

From all I know, you need to pay $7 per app.

~~~
xyzzy4
You could buy multiple domain names through Godaddy or such and just set them
to forward with masking to various URLs of your heroku app. I don't see why
this wouldn't work.

------
update
hm. i started using python instead of php as soon as i discovered web.py.

>'Leaving PHP is too expensive'

seems the opposite in my experience.

