5 ms·
It greatly depends on what you compare PHP to, but to highlight a handful of disadvantages, * PHP is considered extremely weak performance-wise * There is poo
by shmichael 17y ago
It greatly depends on what you compare PHP to, but to highlight a handful of disadvantages,
* PHP is considered extremely weak performance-wise
* There is poor to no support of multithreading
* There is no eventing system
* As a web framework, it sins in mixing code & design (opposed to e.g. Django-Python or Ruby on Rails)
(If the term "framework" seems unfit, think of "web-targeted toolkits")
- dangrover 17y agoPHP is not a framework.
- illumen 17y agoThis essay from Rasmus is interesting: http://toys.lerdorf.com/archives/38-The-no-framework-PHP-MVC-framework.html http://toys.lerdorf.com/archives/38-The-no-framework-PHP-MVC... In a way php is a framework.
- Ixiaus 17y agoWhile one could argue for PHP being a "language" upon which frameworks are built, it really is just a framework. A low level framework that is. Frameworks built on top of it are just higher-level more abstract frameworks. I come from 4+ years of using it professionally and most of the higher level frameworks I'm talking about (Kohana, Zend, CodeIgniter, etc...) really only exist to overcome a lot of PHP's more abstract weaknesses (even though they can't really do much about the interpreter implementation). I can easily say that something written in Python, Scheme, or whatever-you-choose will run a lot better, take less time to build, and be easier to manage down the road. The primary problem in this industry is that the majority of web application programmers grew upon PHP and are running their own IP Consulting shops or startups by now and have zero experience with other languages, therefore making them much less interested in trying to adopt a different web development paradigm when an aspiring web developer with Python/Erlang/Scheme/Ruby skills under their belt try to build something with that tool chain in their employ. The less knowledge and/or experience with other languages you have, the more rooted in what you are comfortable with you are. Education is a good thing, that is what I love about Hacker News; the people here experiment with new languages and trying out new technologies for their projects/products - which is much more progressive than the enterprise situation.
- Jach 17y agoYou have some points, but I think they're not very strong. PHP seems fast enough for many popular and large websites, I'm not sure how important multithreading is to most web applications out there, same with events, and the last criticism is in the PHP community thought of as a feature. PHP easily suffices as a quick, simple templating language when you don't feel like you need to bring in Smarty or some other thing specific to templating.
- pvg 17y agoI wonder what you're comparing PHP to. PHP is faster than Ruby and about the same speed as Python. Threading is not a pressing need in the sort of environment PHP typically runs - multiprocess web servers. Python and Ruby, when used for web apps also manage just fine with 'little to no support of multithreading'. And as someone else pointed out, it's not a framework to begin with (although there are PHP frameworks). The language is not without its warts and limitations but I don't think they're the ones you've listed.
- shmichael 17y agoLet's put the term "framework" aside. The Wikipedia article states it is "a basic conceptual structure used to solve or address complex issues, usually a set of tools, materials or components". I believe a scripting language that is pre-designed for website design could be considered a framework, but it's not that important whether there is a consensus. I'd like to see your source for the performance claim. To my own I can bring e.g. http://xodian.net/serendipity/index.php?/archives/27-Benchmark-PHP-vs.-Python-vs.-Perl-vs.-Ruby.html http://xodian.net/serendipity/index.php?/archives/27-Benchma... http://blog.dhananjaynene.com/2008/07/performance-comparison-c-java-python-ruby-jython-jruby-groovy/ http://blog.dhananjaynene.com/2008/07/performance-comparison... I found threading a great shortcoming of PHP. I had web services that required data from several sources and was in need of querying in parallel. there are about 370,000 results for +php +multithreading on Google so I assume it's more than just myself.
- pvg 17y agoThe benchmarks you're linking are pretty limited (especially the first one that tests just instantiation and method dispatch). Also synthetic but somewhat more comprehensive - http://shootout.alioth.debian.org/u32/benchmark.php?test=all&lang=php&lang2=ruby http://shootout.alioth.debian.org/u32/benchmark.php?test=all... As I said, if threading is a problem in PHP, it's as much of a problem in Ruby and Python. Common workaround is async message queueing with a great number of solutions available for all of these languages. There's a parallel curl available in recent versions of PHP that covers the simple 'multiple data services' case reasonably well.
- idlewords 17y ago"PHP is considered extremely weak performance-wise" Compared to what? Assembler? There are valid criticisms to be made of PHP, but poor performance is not one of them.
- shmichael 17y agoI'd be happy to learn, but you'd have to expand the one-liner.
- jacquesm 17y agoI am involved with two very high volume sites, one is written in Java using tomcat as the server and it needs 3 servers to handle between 650K and 1.5M uniques daily, server load is ok but fairly high, the other is a PHP based service that serves up 1.8 million pages on a good day to 50K uniques, the server load on that box is a relaxed 0.6. When used properly PHP is performing quite well. Note that this is without any front-end caching, each page gets generated anew.
- bensummers 17y agoAre these two sites doing equivalent work? Without knowing what kind of work these sites are doing, this isn't really a useful comparison.
- jacquesm 17y agoYes, absolutely. Otherwise I wouldn't have used them as examples. They are basically implementations of the same kind of site but on different platforms, the one more successful than the other. In terms of raw performance I'd say the java environment is a little bit faster, but not by much. In terms of programmer performance I'd say the PHP environment is a lot faster than the java environment. The java I would qualify as more maintainable though, but it is less stable in production than PHP (we see the occasional freeze on java, the apache/PHP stuff seems to run itself for year after year without any issues). Both use mysql db backends.
- wvenable 17y ago> PHP is considered extremely weak performance-wise I don't know, it seems a lot of the very high trafficked sites (Facebook, Yahoo) run PHP. Yes benchmarks do show PHP doing poorly, but when was the last time anyone used PHP to crunch numbers? It's apparently fast at what it needs to be fast for. > There is poor to no support of multithreading That is not a flaw. PHP is a share nothing architecture; each request is completely independent. This is a good match for the stateless nature of HTTP. Multithreading isn't at all appropriate for PHP and I can't think of a scenario where it would be needed. > There is no eventing system PHP is a programming language not a framework. I'd make more of a comment about the various PHP frameworks but "eventing system" seems kind of vague. Maybe you can clarify this a bit and then I'll comment. > As a web framework, it sins in mixing code & design (opposed to e.g. Django-Python or Ruby on Rails) Nobody mixes in code & design in PHP anymore -- you won't find it terribly common among the various PHP frameworks. I do use it from time to time as a debugging aid and my compiling template engine uses it as the compilation target.
- shmichael 17y ago> I don't know, it seems a lot of the very high trafficked sites (Facebook, Yahoo) run PHP I'm completely for PHP as a simple and accessible language. The previous author wanted to hear about the shortcomings of PHP and I tried to provide some. PHP sites such as Wikipedia probably need more servers (since every request is a separate process). They might be saving a lot of manpower by using PHP, so it might be an OK tradeoff. By the way, Facebook uses Erlang for its performance-critical parts (such as chat). > PHP is a share nothing architecture; each request is completely independent. You could still use an agent-like messaging system for shared-nothing multithreaded/multiprocessed environment. > I'd make more of a comment about the various PHP frameworks but "eventing system" seems kind of vague. Maybe you can clarify this a bit and then I'll comment. e.g. When using cURL you must poll the handler until the request is complete. Obviously you'd need multithreading to achieve a better control flow in such a scenario. > Nobody mixes in code & design in PHP anymore I've written and debugged some wordpress plugins, and I can't say I came to the same conclusion as you...
- wvenable 17y ago