LebGeeks

A community for technology geeks in Lebanon.

You are not logged in.

#1 December 25 2013

rolf
Member

Alternatives to PHP

PHP has served me well, and still does.
I was just reading this:

http://me.veekun.com/blog/2012/04/09/ph … ad-design/

I'm not sure who wrote it, but I got there by reading an article by Jeff Atwood (for whom I have a good amount of respect), and which seems to support the same opinion.

Here is a great snippet from the linked article:

Consider this code, taken from the PHP docs somewhere.

@fopen('http://example.com/not-existing-file', 'r');

What will it do?

If PHP was compiled with --disable-url-fopen-wrapper, it won’t work. (Docs don’t say what “won’t work” means; returns null, throws exception?) Note that this flag was removed in PHP 5.2.5.
If allow_url_fopen is disabled in php.ini, this still won’t work. (How? No idea.)
Because of the @, the warning about the non-existent file won’t be printed.
But it will be printed if scream.enabled is set in php.ini.
Or if scream.enabled is set manually with ini_set.
But not if the right error_reporting level isn’t set.
If it is printed, exactly where it goes depends on display_errors, again in php.ini. Or ini_set.

I can’t tell how this innocuous function call will behave without consulting compile-time flags, server-wide configuration, and configuration done in my program. And this is all built in behavior.

Now I was kind of reluctant to agree with the author, up to there, but I have to concede that this is one of the major problems with PHP, and the "scream" thing is what already tipped me over the edge and now I realize that I need to start looking for something else. But what?

I'm not looking for a finished, miracle drop-in solution or answer, but I'm up for receiving feedback. I know about Perl (not very excited about the syntax and the fact that Perl originally was - and still is a great text processing langage), python (how do I set it up?), ruby (I don't want to have to deal with rails...), C# (Proprietary? Visual Studio?? Microsoft!? Having to learn everything from scratch?). What I'm looking for is something that can be used as a template language in a straight-forward way (like PHP), but would be a more consistent, elegant and modern system all-round. It also would ideally share some common ground with PHP, or be simple enough, so that I can get up to speed rather quickly.

Anyone here has ideas or something to add?

Offline

#2 December 25 2013

rtp
Member

Re: Alternatives to PHP

I start learning Python/Django, a little while ago and its painful to start learning it and its MVC.  However, I was shocked to find out that Django can create the backend automatically, and it does it really well! I really like the interface. I couldn't connect to a Mysql Db tho, i tried the SqlLite only.

C#, best language! After trying Php,Java, C# and VB.NET.  I have to say, C# rocks! However, the license is an ass

So if you are looking into an all free language, Php Python/Django is the one if you know MVC. Another alternative that I never tried is Rails. I guess that is your only choice. Django or Rails

p.s: i doubt you will find any alternative to php

Last edited by rtp (December 25 2013)

Offline

#3 December 25 2013

Ayman
Member

Re: Alternatives to PHP

Python is a great alternative to PHP and here is why:

- The language is very well designed and thought of.

- It has the best package manager out there: pip which kicks PHP's Composer ass any day.

- You can organize your project packages into virtual environments with virtualenv.

- The language enforces clean and expressive syntax and there is a well defined style guide to follow:pep8.

- There is a plethora of well written modules for almost anything and they are one pip install away, this can make your development insanely productive.

- It is a general purpose language, which makes it useful not just for web but also writing scripts to run anywhere that has Python installed.

- For the web, there exists a huge amount of awesome frameworks to use depending on your taste and requirements.

- And lastly, programming in Python is fun again.

rolf wrote:

python (how do I set it up?)

If you are on a popular Linux distribution it should be available already out of the box. For Windows there is a .msi for downlad and install wizard. But I highly suggest you use Python in a Unix like environment such as Mac OS or Linux for a much nicer experience.

rolf wrote:

I'm looking for is something that can be used as a template language in a straight-forward way (like PHP),

Python is not a template language, you will have to use a template engine such as Jinja, its syntax is clean and awesome.

Actually you shouldn't be using PHP as a template language anymore, PHP started as a web template language but it evolved since then to become a full featured programming language. Plus the syntax is not that suitable for templating. Check out Twig or Smarty.

Last edited by Ayman (December 25 2013)

Offline

#4 December 25 2013

rolf
Member

Re: Alternatives to PHP

Thanks, Ayman, for your help on Python.

Ayman wrote:

Actually you shouldn't be using PHP as a template language anymore, PHP started as a web template language but it evolved since then to become a full featured programming language. Plus the syntax is not that suitable for templating. Check out Twig or Smarty.

This is something I feel a bit strongly about. It started as a template language, and of course it progressed, but it kept (most of) it's original abilities. So you won't see me using Smarty anytime soon! Maybe I don't like layers...

rtp wrote:

p.s: i doubt you will find any alternative to php

That's what I was starting to think - when looking at it from a productivity standpoint.

Anyway, I was also thinking that Python might be the best choice. There also seems to be python hosting providers out there, and I think that's an important point.

Offline

#5 January 20 2014

Fischer
Member

Re: Alternatives to PHP

What do you mean by hosting? VPS or shared hosting? On the shared hosting side, very few support python django because few support mod_wsgi, webfaction.com does support django, but very few do, if you're going for a vps, you are free to host anything. One last thing, if you want to build CMS, consider Mezzanine

Offline

#6 January 20 2014

rolf
Member

Re: Alternatives to PHP

Fischer wrote:

What do you mean by hosting? VPS or shared hosting? On the shared hosting side, very few support python django because few support mod_wsgi, webfaction.com does support django, but very few do, if you're going for a vps, you are free to host anything. One last thing, if you want to build CMS, consider Mezzanine

Thanks. I already have a Windows VPS. Yes I know, it easier to find packages for Linux, but, overall a Windows system is less painful to maintain and manage.
Thanks for the tips.

Offline

#7 January 21 2014

Joe
Member

Re: Alternatives to PHP

If you want to stick to Windows, I suggest you stay away from Python. I haven't tried it myself, but Python is notoriously annoying to learn on Windows.

Offline

#8 January 21 2014

Fischer
Member

Re: Alternatives to PHP

I agree with rahmu, that's why I became a Linux user. If you want to stick with Windows go for C# or rails. Rails is supported by the majority of shared hosting companies.

http://railsinstaller.org/

This page may make your life easier when installing python packages on windows, but believe me, it still sucks, don't waste your time with python on windows.

Offline

#9 January 21 2014

rolf
Member

Re: Alternatives to PHP

C# looks like the most interesting. It can even run PHP code... (although I have yet to see proof of how well it works for production code)

Offline

Board footer