• 0

php or python for web development?


Question

I am trying to get into web development and I have been researching the different languages that I can use to start learning these things. I have a little bit of php knowledge, enough to allow me to make customization and changes to some things in wordpress but not enough to really do anything with it.

With so many different languages that can be used to code websites I am confused what would be the best one to chose to start learning. I have read good things about django (python) and how it is a better language that is more cleaner for bigger scale projects and that such. php is more widely used/supported and basically ready to go out of the box, however it has its own set of problems also. The more I read about the two different languages, the more I get indecisive.

Can you help sway me in the right direction?

Link to comment
Share on other sites

Recommended Posts

  • 0

I don't really think there is a 'best' option, you can write clean well-structured large scale web applications in pretty much any language as long as you follow good coding practices.

Personally I use Ruby/RoR or ASP.NET MVC (not web forms) for any new projects. I used PHP for 6-7 years before that and contributed to the interpreter... but I'm much happier with Ruby & C#, there's a ton of bad design/annoyances/inconsistencies in PHP. There are some good upcoming PHP frameworks such as FuelPHP and Laravel although obviously they can't fix the underlying annoyances with the PHP language.

I would recommend just spending a while with each language/framework learning the basics / experimenting until you find the one(s) you like best.

  • Like 2
Link to comment
Share on other sites

  • 0

I would personally recommend PHP as I'm currently using Laravel for a few projects (a few customer sites and some of my own projects.). But PHP was the first web development language that I learned ... so I'm always following PHP more so than lets say Ruby or Python.

Link to comment
Share on other sites

  • 0

Ehh, it's good to know both, and starting with something like Python might let you avoid pitfalls you'd hit if you start with PHP (Which seems to welcome bad practises through it's bad design :shifty: )

That said, Python and PHP run quite differently (PHP normally runs in-process with the server, Python runs outside), while you can setup PHP to behave like Python it's a fair bit harder.

Link to comment
Share on other sites

  • 0

Ehh, it's good to know both, and starting with something like Python might let you avoid pitfalls you'd hit if you start with PHP (Which seems to welcome bad practises through it's bad design :shifty: )

That said, Python and PHP run quite differently (PHP normally runs in-process with the server, Python runs outside), while you can setup PHP to behave like Python it's a fair bit harder.

PHP only runs in process with the server IF you are using Apache/Mod_PHP,,, otherwise you use PHP-FPM and it really isn't "a fair bit harder" to install or configure...

Link to comment
Share on other sites

  • 0

There's probably 10 times the PHP projects out there compared to Python projects, which is worth taking into consideration. Building something from the ground up, either works.

Link to comment
Share on other sites

  • 0

Python.. django is just the easiest way to get going and even though there is a lot of php code out there, that doesn't mean its the best place to start. django is just so robust and easy to build robust applications with that i simply couldn't recommend php unless you specifically need to run an existing php code base.

Link to comment
Share on other sites

  • 0

There's probably 10 times the PHP projects out there compared to Python projects, which is worth taking into consideration. Building something from the ground up, either works.

There are 10 times more PHP projects, but there are fewer Django (Python) developers. I get recruiters begging me for leads on Django developers pretty often because they are harder to find.

Link to comment
Share on other sites

  • 0

What do you actually want ?

Do you want to have fun as an amateur ? Do you want to have a job one day as a web dev. Do you have a degree in computer science ?

If you are doing it to become a "pro" then you should start from scratch. Too many "web devs" these days don't master programming and are only good at using a framework. It's great cause it's easier for real programmers to find a job but anyway that's another subject ... Learn C and then get a proper oop book (one about the paradigm and not the languages). If you are already there then i suggest to learn how the web works before learning a language. If you know C and Java/C++/C# you'll have no problem getting into any languages out there. But CSS can be tricky. HTML too once you get into proper use of tags and things like WAI-ARIA. Javascript itself is easy but you need to know the DOM. I recommend learning Jquery too. After you kow how it all works you can start to learn a framework.

There's too much s***** web form dev out there knowing nothing about how the web works. It's daunting to see how much of these guys have a job when you get into a new org to help. Some of those guys can't even do a simple task in Javascript and CSS. And they can call themselves web devs go figure ...

If you do it purely for fun then try all languages and chose the one you prefer. Despite what a lot of people here will tell you there's no perfect language. They all have + and -. Ruby on rail is a good choice even if it's not used a lot. ASP.NET MVC is another good one. Php/Zend/... and even perl can be fun too from a programmer perspective. Stay away, very far away, from web form. Please do myself this favor. Personally when i want to have some fun i stay away from any framework and return to what dev used to be before people forget how to properly code because of frameworks (or maybe frameworks was created because too much people did not know how to code ;)).

Link to comment
Share on other sites

  • 0

There are 10 times more PHP projects, but there are fewer Django (Python) developers. I get recruiters begging me for leads on Django developers pretty often because they are harder to find.

True. If I had to pick one to start out, with no need to do either, I'd go with Python. It's a better language, it's more useful in general, and I think it's going to grow from here out.

That said, if I wanted to pick up an existing system, or develop something for other people to use today, PHP.

Link to comment
Share on other sites

  • 0

At the end of the day, php and python are both... ****. Python 2.x to 3.x broke almost everything for what reason? ABSOLUTELY NO REASON AT ALL!

PHP 5.4 removes safe mode completely and breaks PHP-GTK support and suhosain patch... WHY!? ABSOLUTELY NO REASON AT ALL!

Whichever you pick is equally as **** as the one you didn't pick, so it doesn't really matter.

Link to comment
Share on other sites

  • 0

PHP can run very easily on all the major web server products out there, great documentation to learn with and follows a C++ like syntax. Due to the similarities/blatant copying of Perl functions, it's very fast to produce something quickly.

Link to comment
Share on other sites

  • 0

Almost every web site uses HTML and Javascript, client-side. That's where I'd start. After that, server-side, there are many choices: Javascript is one again (Node.js), C# (ASP.NET), Ruby (RoR), Python (Django), PHP... Although I haven't learned it personally, PHP looks like one frighteningly bad language, so if you can avoid it, by all means, avoid it.

Link to comment
Share on other sites

  • 0

PHP only runs in process with the server IF you are using Apache/Mod_PHP,,, otherwise you use PHP-FPM and it really isn't "a fair bit harder" to install or configure...

Yeah, I'm not entirely sure why I said it was hard, I actually have nginx+PHP-FPM setup on this very computer. And I'd say Apache+mod_php is a fairly common setup, every single web host I've ever used has done it that way.

Link to comment
Share on other sites

  • 0

It's a bit of a tough call. Python is a good language, and infinitely better than PHP (faster too), but PHP is more common, so if you're looking for employability from your skillset, you're more likely to find work in PHP systems than Python systems (although both are pretty common).

Personally, I'd go the Python route. Be sure to check out ASP.NET (C#) and Ruby too, both nice languages and well supported for web development.

Link to comment
Share on other sites

  • 0

I'd dispute python being faster than PHP. Hiphop is by far the fastest PHP compiler/server, much faster than python, and out of all the world's largest/most visted sites, you've got google running whatever they use, MS using php and ASP.net, facebook using PHP, twitter using... jsp? I've yet to see a large scale site use python.

Link to comment
Share on other sites

  • 0

I'd dispute python being faster than PHP. Hiphop is by far the fastest PHP compiler/server, much faster than python, and out of all the world's largest/most visted sites, you've got google running whatever they use, MS using php and ASP.net, facebook using PHP, twitter using... jsp? I've yet to see a large scale site use python.

Last I checked Twitter uses Ruby on Rails for the UI and SCALA for the backend.

Link to comment
Share on other sites

  • 0

my god so many people hate php .... I find it so useful :/

It's popular to hate on it. There's also a lot of terrible PHP information out there, which propagates bad code. I'm sure if you Google you can find a few thousand guides on how to create a username / password system in PHP that relies on storing information in plain text with out checking for SQL injections.

On the other hand, PHP's documentation is stellar, and it runs basically anywhere.

Link to comment
Share on other sites

  • 0

Python Good:

Consistent, more respectable, better language overall and in practice. Teaches better ways to program almost purely by accident. usable outside of web development, decent documentation, excellent community. forced white spacing. Minimal 'boiler plating'. truly object oriented. Easy readability. "Google's language"

Python Bad:

Less documentation, less employable, can be argued that it's slower than PHP with some default configurations, my tests confirm this. Harder to implement on shared servers, even if its supported (which it isn't always). forced white spacing. Versions aren't backwards compatible from 3 to 2 (this can be a small or large issue)

PHP Good:

Huge documentation, easier to use for web development, widely supported, lives nicely side-by-side HTML, much more likely to get you a job, C style syntax is arguably more transferable. Can be very fast (hiphop). "Facebooks language (kind of)"

PHP Bad:

Huge documentation, reputation (which I think is not entirely PHP's fault), terribly inconsistent syntax and naming, many online tutorials teach you a bad way to do many things (which is where reputation gets ruined IMO), objects are a hack. Poor readability.

Overall: Although I'm almost primarily a Python developer, I usually use PHP for web development. It's fast, easy and gets the job done. It can be a little messy, and most 'code' that comes from it is hard to follow because it's all over the place. The choice is almost impossible for me, but I slightly recommend PHP. If you were to ever think about doing programming outside of web development I'd say to go with Python instead.

Hope this helps.

Link to comment
Share on other sites

  • 0

I'd say PHP for quick developments and simple projects. If you're just generally looping through results from a database and doing very basic stuff I think it fits the bill. Read the article someone else mentioned about all the language inconsistencies though - the good thing is a quick google for what you are trying to achieve usually yields some results.

Although I've never used Python for web development, you will get the benefits of a cleaner more structured language, compiled code, proper object orientation and unit testing

Link to comment
Share on other sites

  • 0

I'd dispute python being faster than PHP. Hiphop is by far the fastest PHP compiler/server, much faster than python, and out of all the world's largest/most visted sites, you've got google running whatever they use, MS using php and ASP.net, facebook using PHP, twitter using... jsp? I've yet to see a large scale site use python.

Perhaps my knowledge is out of date then. Last time I checked benchmarks, Python spanked PHP and ruby in speed tests, but checking the interwebs it seems that may no longer be true. Trouble with determining languages used for the web is that it's hard to tell who uses what. I'd assume that Google use a lot of Python though, since the benevolent dictator works there. I had heard that Youtube used it at one point too, although I don't know if it still does.

IIRC, Twitter used to use JSP, but they've moved to Ruby now. I'm keen to start learning RoR, I love Ruby as a language, and it seems to be gaining some serious momentum in web development.

Link to comment
Share on other sites

  • 0

Read the article someone else mentioned about all the language inconsistencies though - the good thing is a quick google for what you are trying to achieve usually yields some results.

A good part of this article has be debunked. I'm too lazy to post link but do a simple google search. Anyone who write such a long blog post to critize a language clearly has an agenda. You know i hate web forms with a passion. I don't waste my time writing a 20 pages blog about it. I just don't use it when i can avoid it.

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.