views:

202

answers:

6
+1  Q: 

PHP alternatives?

Are there alternatives to PHP that perform faster and have somewhat the same feature set (like support for common RDBMS, Curl, Regex, etc)?

What about coding websites in C? How does that work out? Is that platform independent and works on each server?

+6  A: 

Your question is broad.

  • PHP can be made fast and scalable (Flickr, Facebook and more sites run PHP)

  • Somewhat similar in purpose are webframeworks like Ruby on Rails, Django, Lift, ... (these can scale, too, see e.g. Twitter)

  • A short intro on CGI in C: http://www.cs.tut.fi/~jkorpela/forms/cgic.html

The MYYN
+1  A: 

PHP plugs directly into Apache.

C does not. To connect C with Apache, you'll have to use some secure/fast CGI implementation instead of the off-the-shelf CGI.

C -- as a language -- is a lot of work for building web sites.

Look at Web Frameworks in Python.

Look at Ruby on Rails.

S.Lott
+1  A: 

Perl (CGI)

Python

RoR (Ruby On Rails)

ASP (Not the best option)

Pretty sure if your going to code a website in C your gonna be coding your own webserver too so I'd stay away from that.

RoR would be a good option. But it just depends on your personal preference. I tend to stick with php since I know how to do pretty much everything in PHP.

EpicDewd
+3  A: 

"Are there alternatives to PHP" - Yes

"...that perform faster..." - Yes

"...the same feature set..." - No - that would make PHP redundant.

You're asking a very broad question. There are lots of languages out there which support all sorts of DBMS, PCRE and other stuff too.

"What about coding websites in C? How does that work out? Is that platform independent and works on each server?"

  • No it's not platform independent.

Its rather difficult to point you in a specific direction based on such a broad ranging question.

You might want to read this:

http://shootout.alioth.debian.org/

But note that most of the cost of software lies in development - hardware is cheap - so being able to implement something in half the lines of code will be massively more beneficial for most people than doubling the performance.

There are also less obvious constraints and/or advantages in usuing specific languages - e.g.

http://www.oreillynet.com/ruby/blog/2007/09/7_reasons_i_switched_back_to_p_1.html

C.

symcbean
Urk, I hate that article. "7 reasons I switch back to PHP" is constantly presented as some kind of attack on Rails, when it's not - it's a demonstration of the author's ignorance. His first words are "I spent two years trying to make Rails do something it wasn’t meant to do...". The rest of the article could be replaced with "... so I'm kind of an idiot for wasting 2 years."
meagar
"You might want to read this" - particularly "Overall Performance: PHP is rarely the bottleneck (HTML slides)" http://talks.php.net/show/drupal08/7 :-)
igouy
+1  A: 

Here is a nice comparison of scripting languages.

missingfaktor
+1  A: 

If your problem is a website or web application that seems too slow, switching languages is probably not worth the effort. There are much more efficient ways to speed things up. One of them would be code caching to avoid the overhead of a fresh compile of your PHP scripts on every page requests. See for example http://en.wikipedia.org/wiki/PHP_accelerator. I've personally used XCache to great effect.

There are many other reasons for websites performing slower than they could, many completely unrelated to the underlying language. YSlow (http://developer.yahoo.com/yslow/) is an indispensable tool to find your bottleneck. To give but one example, combining multiple CSS or JS files included from a HTML page into a single file each can dramatically improve response times.

So bottom line: In most cases, the underlying language is not the culprit. Having said all that, yes, there are faster languages. See the other answers above :)

Thilo