TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

10yr+ PHP Dev Wondering: Python vs. PHP for Web Applications?

9 pointsby dirtflingerover 10 years ago
10yr+ PHP Dev wondering: Python vs PHP for Web Applications? Please don't let this drag onto a bitter fanboy debate about which programming language syntax is better...I just want to hear your story if you have used both PHP and Python in your web development years.

11 comments

gedrapover 10 years ago
I was a PHP dev for ~6 years, switched to Python about a year ago.<p>* Once you know PHP, it&#x27;s really fast to get shit done. Can&#x27;t deny that.<p>* After staying with one language for so many years, it&#x27;s crucial to try something new. You might not like it, but there might be some parts that could inspire you. It&#x27;s really toxic to be stuck in one mindset for a very long time.<p>* Anecdotal, but I found an average Python dev to be better than average PHP dev (oh god, all those custom PHP frameworks I had to maintain and rescue projects from death).<p>* Python has great libraries for statistics, machine learning, image processing, etc - it&#x27;s very universal.<p>* There is loads of great info about Python on the Internet and transition should be smooth once you get used to not putting semicolon ;)<p>* I found that there are more better paying jobs in Python.<p>All in all, why not to try?
jamestnzover 10 years ago
I&#x27;ve developed for the web (ranging from small one-script hacks, up to large commercial applications) for about 15 years. Much of this work has been in PHP, often using the CodeIgniter framework [1]. As far as PHP goes, I do like CI; it provides some semblance of an MVC environment, a predictable URL&#x2F;parameter routing scheme, view templates, and so on. I have a CI custom controller I inherit from to publish my REST endpoints. Generally CI projects will tend toward a somewhat common&#x2F;predictable structure, enhancing maintainability and team development.<p>But over the years I&#x27;ve also inherited some absolutely abhorrent PHP nightmare projects, whose design&#x2F;coding decisions truly boggle the imagination. Often based on no framework at all, and apparently motivated largely by the developer&#x27;s desire to use as many PHP and SQL features as possible in the same project.<p>Latterly I&#x27;ve been using python for some web projects. I played briefly with django, but I&#x27;ve found myself settling on Flask [2], a very nice &quot;microframework&quot; which is super easy to get running with, and which gives a great balance between power and stay-out-of-my-way-ness. It has a simple URL routing system based on function decorators and regex, the ability to factor your apps into reusable components based around your python modules, jinja2 templates, etc. I use sqlalchemy for db access.<p>Honestly I find it much more of a pleasure to be coding python&#x2F;flask vs PHP&#x2F;codeigniter, but due to team and project constraints it isn&#x27;t always possible to go that way.<p>[1] <a href="https://ellislab.com/codeigniter/" rel="nofollow">https:&#x2F;&#x2F;ellislab.com&#x2F;codeigniter&#x2F;</a><p>[2] <a href="http://flask.pocoo.org/" rel="nofollow">http:&#x2F;&#x2F;flask.pocoo.org&#x2F;</a>
candlover 10 years ago
I don&#x27;t use PHP at all, but one thing I envy PHP (and Perl) users is that they have excellent libraries to interact with SQL databases in the form of PDO (PHP) and DBI (Perl). There&#x27;s no direct equivalent of this in Python which is a shame. The mantra in Python land is to use ORMs which I am not a fan of.
评论 #8937162 未加载
评论 #8937543 未加载
评论 #8937241 未加载
dscrdover 10 years ago
PHP seems to fall apart in the seams when trying to reach a higher abstraction level. For instance, Symfony 2 tries very hard to include modern OO techniques in there, but the end result is that its performance is incredibly bad. Also, the OO basis is ripped from Java (which is not a perfect fit in some places, given that Java is a more static language), which I do not enjoy at all.<p>Python isn&#x27;t the fastest dog out there, but doesn&#x27;t fare so badly with the abstractions, and its OO style suits a dynamic language better. It doesn&#x27;t try to be a Java.<p>Neither language will give you much protection against programming errors, nor optimize your code very well like many of the new hip languages (Rust, Go, Nim) do.
devonbleakover 10 years ago
For mass hosting of web applications written by untrusted 3rd parties I like PHP better because I can restrict what they can do via php.ini and there seems to be better support for static analysis.<p>That said most of the stuff I write myself lately is in Python.
smt88over 10 years ago
I&#x27;ve used both, but I can&#x27;t answer this without knowing what you want to use it for.<p>I don&#x27;t know that I&#x27;ve ever heard anyone say that they prefer PHP over Python, so I doubt you&#x27;ll get that response on here.<p>I&#x27;m honestly not a huge fan of either. Are you deciding whether to learn Python? What you want to use going forward?<p>Honestly having 10+ years of PHP experience probably makes it a hands-down winner (for you personally) in terms of productivity. It&#x27;d be a while before you&#x27;d see any real productivity gains from Python.<p>That said, there are maintainability considerations for each language, and Python wins in some of those categories.
评论 #8937886 未加载
salukiover 10 years ago
Before you decide checkout the Laravel PHP framework.<p><a href="http://laravel.com" rel="nofollow">http:&#x2F;&#x2F;laravel.com</a><p><a href="http://laracasts.com" rel="nofollow">http:&#x2F;&#x2F;laracasts.com</a><p>Taylor has done a great job on it.
raoul_dukeover 10 years ago
If you&#x27;re talking frameworks, I prefer Python. Django is a juggernaut and getting better and better with each release. PHP frameworks come in all shapes and sizes, but I haven&#x27;t found one that feels as comfortable as Django. If you&#x27;re taking a generally static site though and need a few bits of dynamism, I&#x27;d stick with PHP as it&#x27;ll be lighter and get the job done fine.
jhildingsover 10 years ago
The hardest part about Python it&#x27;s not Python itself but rather the server environment &#x2F; deployment things. PHP is just save files and visit apache server, Python had a much steeper curve to learn all those things around.<p>And then of course it&#x27;s the spacing issues which is hard to understand at first glance
0942v8653over 10 years ago
I think if your website is mainly just a bunch of templates then PHP&#x27;s html-by-default will make things easier. Same for making small changes to a static site. But if you&#x27;re doing something any more dynamic than that I&#x27;d prefer Python.
robodaleover 10 years ago
14 year American .NET Web developer here. Your question is invalid.