Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

My goal is to move away from PHP completely by 2013 for my websites.

I've recently been toying around with various methods of tying C++ to a web frontend, with varying degrees of success. My current favorite method is to use mongoose to create a very simple HTTP interface for any C(++) project (mongoose is great!) and then use AJAX and JSON for any and all communication to and fro client and server. However, this leaves people that have JS disabled out of the loop.

My problems with PHP aren't so much the language as much as it is the environment. It's such a mess with so many dependencies that keep breaking any time you want to do a security update. I'm running PHP-FPM w/ nginx on Ubuntu LTS (Lucid), with the suhosin patch, xcache, memcached, and libcurl (I try to keep the external dependencies down to a minimum. PHP's 3rd party libs are so poorly developed and leak memory like crazy. They're also strictly non-TS builds, and will segfault like there's no tomorrow if used in a TS environment.). Trying to keep up with all the security patches means rebuilding a zillion different packages and applying a few dozen patches each time. It's not a piece of cake.

As soon as I've found a nice, convenient, and lightweight C++ web interface (wt is nice, but it's very intrusive and all your code becomes wt-specific), I'm planning a series of tutorials and open-sourced projects that can help anyone else interested in dumping PHP.

Honestly, it's not so much moving towards C++ as it is away from dynamically typed languages. I've had it with subtle bugs that appear only during run time and only when a certain codepath is taken with languages that let you implicitly define variables. I've come to the conclusion that implicitly defined variables and structures are of the devil himself, and no developer should ever end up working in a language where the compiler doesn't alert you at compile time that your codepath uses previously undefined values. ugh.



I agree that statically typed languages have a lot of advantages but I can't see much reason to use C++ for anything if you have reasonable alternatives. Why not Scala or Haskell or even just plain old Java?


Have a look at the OK Web Server[1]. It has a clever design that cleanly separates application and HTTP concerns and the default libraries are written in C++.

[1] https://github.com/okws/okws


You realise that there are tools to get around the problems that you describe? Linters and automated testing will both catch the sorts of problems that you're having.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: