Ask HN: I can't stand PHP anymore. What else can I choose?
All my clients use shared hosting such as iWeb.com (which does'nt have Shell access). Mainly because they don't want to pay a lot for a _reliable_ webhost.
My problem is : As a language-snob (i know, it's sad), i'm immensely bored about PHP. I want to learn another back-end language that i can use on my freelance web jobs.
I'm considering learning Perl. But Perl needs modules to extends it's possibilities, this i cannot do without Shell access. And it's also better to run it as fastcgi or mod_perl, things that shared hosting does not always support.
I know Ruby, but hosting Ruby is not cheap enough, or accessible enough for my clients.
Do you guys have any idea of a web stack or shared host that does the job?
What do you do when you can't stand PHP anymore?
84 comments
[ 3.5 ms ] story [ 165 ms ] threadNow in regards to lock in. How is it different from any other stack? If I build something with ASP.NET MVC (which has the source available under the MS permissive license) I can run it on Windows or any machine running Mono.
Spend a week writing C# in Visual Studio.NET with ReSharper installed, then try to go back to your old language and IDE. You'll understand.
I spend entirely too much time in Eclipse hitting ctrl+space and getting nothing back. Often even when the thing I'm looking for is in the same file, let alone included thru an import. ReSharper will find references for things I haven't even imported. It really is that much better.
Oh, and VS.NET does have open source and commercial plugins (of which ReSharper is a good example.) It's every bit as open as Eclipse as far as extensibility is concerned.
In general, I find it's best when offering comparisons of two products to have actually used both products. That is the basis by which I consider VS.NET to be superior to Eclipse. I'd suggest you try them both before making up your mind for good.
I don't care what you use, it has lock in of some kind. Get over it. VS2008, C#/VB.NET, ASP,NET, MSSQL are great tools. That's all these things are: tools. The end product is always the same. If you build something with Ruby you can't go back and fix it with PHP. Lock in? Yep.
Sure, there's lock in and perhaps Microsoft is engaged in anti-competitive practices. They are a business, after all. But what is wrong with the tools? Visual Studio, C#, VB.NET, IIS? Point out some real issues like the current state of ASP.NET's AJAX toolkit or linq2sql's inability to do perform joins efficiently without an associated view.
I might be playing devil's advocate here, so please don't take me the wrong way. I just want people to look at their tool box more closely and make decisions on real, measurable things.
Disclaimer: I work on everything from ColdFusion, PHP and ASP.NET to Perl, cmd and shell scripts. I have no zealotry in me except for an extreme love of Adobe Flex, Adobe AIR, Macs and the opposite sex.
e.g. something like:
I personally use it for PHP, but it supports Ruby/RoR, it's cheap, and I've never had any problems with it.
Developer hosting from $5/month. Much better uptime than others in this price range. Have had some small sites with them for several years.
We offer all our clients hosting on our slicehost server, for at least a year free (so far we haven't bothered to ask after a year either). It's clean, fast, cheap, and lets you do development and updates much faster. No system administration to speak of (long live apt-get).
But that's neither here nor there. If you can't stand behind doing work in a mainstream language, don't take those jobs, and accept that you're going to earn a fraction of what your peers do.
However, when you deliver product to people in a language nobody else uses, and implicitly recommend they deploy code in that language, and you do it because you're bored with PHP, and you pick the language you move to deliberately to mask the costs of using a less popular language by compiling it down to PHP, you're coming pretty close to screwing over your clients.
Happy to be wrong about this, though. I'll stop here.
[0] I am not, at this point arguing that haXe is a better language than PHP. I don't have enough experience with haXe to make that claim, but it's not an especially high bar to clear.
> In law, malpractice is a type of negligence in which the > misfeasance, malfeasance or nonfeasance of a professional, > under a duty to act, fails to follow generally accepted > professional standards, and that breach of duty is the > proximate cause of injury to a plaintiff who suffers damages.
Using another language is not failure to follow generally accepted professional standards, and I doubt using another language can result in damages to the client. Please don't use technical (legal) terms if you don't mean it.
(Also, HaXe is not a vanity language, unless you like the rest of us calling your favorite language a vanity language too: "Pshaw! It just compiles to ASM!")
http://juliusdavies.ca/svn/viewvc.cgi/not-yet-commons-ssl/
The viewvc.cgi starts with:
#!/usr/bin/env python
I just dropped the script into my ~/juliusdavies.ca/svn/ dreamhost directory. Didn't seem hard to me.
This is much more complicated than it needs to be. Especially when I can just log into my account with webfaction, click "install django application" and be done with it.
Other than that, don't worry too much about the language. Find something you like and stick to it. Just remember to always learn new things and don't get set in your ways.
I Totally Agree. This is the other reason why i want to change the language in which i code for my day to day jobs. Learning new things.
I read a lot about functional programming and other cool stuff on HN but in my work i'm mostly stuck with PHP... This must change.
You do not need shell access to install modules locally. Anything you can do from the shell, you can do from Perl with system(), backticks, or piped open(), but really... no shell access?
You want hosting that is reliable, supports shell access, rails, and 100% uptime, but your not willing to pay more than $5/month ?
Reevaluate what's really important to you.
I love to program, but it's NEVER about the language. I know many of them, and AFAIC they all have their pros and cons. I suppose that if I was a "language-snob", I'd be "immensely bored" too, no matter which language I was using.
So if it's not about the language, then what is it about? You already answered your own question with the first 3 words of your post.
It's about your clients. Always. They have needs far beyond their ability to express them. And they need you.
Stop being a "language-snob" and start being a "solutions-snob". You'll never be bored again. Promise.
I guess what I'm really trying to say in a general sort of way: as soon as you stop worrying about your problems and focus on your client's problems, you both win.
(The fact that some people have tolerance for this stupidity is not worth arguing about. Some people enjoy digging ditches, too, but the OP is probably not one of them.)
Edit: Ah yes, let the downmods begin. "He said something bad about your favorite language!!"
PHP has an absolutely enormous library, which makes just about anything possible in a webapp without needing much in the way of external libraries. Templating is a core feature of the language, and with a small bit of planning and a knowledge of how to employ PHP's strengths, you can get a lot done really quickly. Perhaps the biggest stumbling block is inconsistent naming and parameter schemes for the core library, but even that is just a simple lookup in the excellent php.net documentation.
If you're fighting your tools in their strongest domains, you're not using the tools correctly...
"Best" != "Good"
Web apps are no different than any other kind of app, except they take HTTP requests as input and generate HTTP responses as output. PHP does have some features for speaking HTTP, but that's about it. For the rest of the app, you are on your own.
Let's look at the components of a web app, and see what PHP is missing.
The first thing any application needs is a data model, which is divided into a few tasks -- storing and retrieving the data, and doing something useful with that. For the first half, most people use a database, and talk to it with some library. Obviously PHP apps can talk to the database, but the core support (and Pear DB) are abysmal compared to the DB access layers in other languages (see DBI and JDBC, for example). Most apps these days like to use an ORM, as composing queries with the ORM is easier than writing SQL queries manually. I don't know of any good ORMs for PHP, at least not ones as good as DBIx::Class or Hibernate, so that's one impediment to productivity.
Now that you can get data in and out of your app, you need to do something with it. This is where the real programming happens, and you get annoyed by the fact that a == b but b != a, a !== b but a == b (and the associated "type coercions"), and so on. "Programming language features" alone don't make a language usable, but lack of a sane base makes programming quite difficult. (I could go on for hours here; inconsistent naming conventions, arrays implemented as maps, the lack of lexicals, namespaces, macros and closures, and other features that other languages have had for ages, and so on. This is all well-known, and even the newest PHP newbie knows this stuff is insane or missing.)
You'll also want to use OOP, which PHP does provide, but unfortunately, its take on OO is pathetic. It copies Java flaw-for-flaw, and so is missing key features that make writing readable code so easy, like named initargs. (Java is full of WTFs, but this is the biggest one, IMO. I have to manually initialize every class with a method that can only take positional arguments!?) Its object system has no support for features like roles, and the language doesn't give you any room to implement them yourself. So, I hope you like cutting and pasting, because that's the only way you can share code between classes, unless you think inheritance is an acceptable way to share code, that is... The flaws with the object system go on and on. There is a hack around the type system (interfaces), but there is no type system. WTF? There is no MOP. That's fine for an application developer, but it makes it difficult to write modules. (For what a good MOP can do, see the MooseX:: namespace on CPAN. There are some great time-savers in there; things I haven't seen in any other language, like MooseX::Getopt, and MooseX::AttributeHelpers. I can't live without stuff like this.)
Note to language designers: if you are going to copy a language verbatim, never pick Java. People will laugh at you.
So, uh, now you sort of cobbled together some working app code. Hopefully you didn't couple your domain classes to the database too tightly so that you can write some tests. Tests. What tools do you use for that? I see PHPUnit, but that's about it. There is no framework like Test::Builder (for writing Test modules) and Test::Harness for running those tests. That means there is no way to compose test modules or to write tools to process test output generically. At least you can write tests, though, which I suppose is better than writing your application in bourne shell.
Now you have some tested code that's the core of your application, and can worry about the web side of things. Unfortunately, PHP doesn't do that well here either. The first thing you have to deal with is handling requests. Out of the box, a request for a file on disk results in running that file. This means a nightmarish procedure of manually loading your backen...
Did it ever occur to you that some of us prefer it that way?
I really don't mind rolling my own, especially if I'm going to use it thousands of times.
What I do mind is getting "painted into a corner" because the high level tool I'm using never accounted for something I want to do.
Everything I want to do I can do with php. It's stable, popular, and everywhere. It may not be the best, but I don't care. I'd rather spend my extra mental cycles on my customer's problems, not mine.
Delicious isn't tiny.
Digg isn't tiny.
Shit, even my little startup, massify.com isn't tiny.
I think probably the reason that people don't write non-web applications in PHP is because that's not PHP's expressed purpose.
And re: catalyst, that sure is setting the web dev world on fire. /sarcasm
Beware, though: when you put on a system administration hat you're taking on a lot of new responsibilities, including backups and security. It's also a good idea to bring your friends in on it, so if something goes wrong they can look into it for your client if you're away.
So, it really depends on your level of comfort with sys admin stuff, and the kind of relationship you have with your clients. Good luck!
As for the few sites which get a lot of traffic... they should also generate a bit more income and an upgraded slice.
Django allows you to do far more with less code, and python is the finest language in which to code ( :) ).
I've advised loads of people to switch from php to django - and have had no complaints yet.
Someone suggested Java, which is way out at the farthest end of the "hard to deploy on shared hosting" scale. In fact, I doubt you can find any way to host Java effectively for less than $25/month, and probably more if your app is at all popular. It's just a horrible choice if deployment is a big factor in your decision-making process.
FastCGI is getting easier and easier to get in shared hosting environments, and all of the major web app frameworks in all of the major languages support it (including Catalyst in Perl, Ruby on Rails in Ruby, and Django in Python). Since FastCGI is a better way to run PHP in a shared hosting environment (mod_php has serious security implications), as well, I'd recommend you start insisting on FastCGI support from your host, no matter what language you use for development.
So, I think what folks ought to be recommending is that you go with a host that provides FastCGI and shell access. And then you can decide which language(s) you want to experiment with.
I have been using PHP for years now - no problems so far. Especially when Zend Framework came.