I maintain a site that receives over half a million pageviews per day, not including API requests of XML feeds. This site runs on 3 medium range commodity web servers and 2 database servers, and there's plenty of capacity left.<p>Don't let the scaling police and architecture astronauts fool you: with the right architecture in place (i.e. a framework like Cake or Zend) and a smart scaling strategy (opcode caching, object caching, page caching, etc), PHP is a great choice for web applications.<p>Sure PHP has a low barrier to entry, which can lead to poor coding practices, but that shouldn't be a reason for people to express an absolute hate for it. Rather, it's important to stress continual education regardless of which programming language you choose.
PHP is without a doubt the worst structured language I've ever coded in. Probably the crappiest language after VBscript.<p>But I use it for anything web-based because it gives me guaranteed results, anytime, anywhere, on whatever scale on whatever budget. I just wouldn't use it for sites with complex business logic, but let's face it, most websites, even the big ones, are hardly rocket-science in that respect.<p>What I love most is the dynamic of the PHP community. For instance, when RoR arrived on the scene, the response wasn't to dis RoR or run scared, but more like "that's so cool, let's see if we can bring PHP to that level". And there is more sharing of knowledge and experience (and code) going on inside the PHP-community then any other developer community I know.<p>More then any development platform I know, PHP is alive and constantly developing, but still as easy to deploy and easy to learn as ever.
Ruby and Python seem to be the current preferred languages.<p>I've used PHP for a while -- a few years -- and haven't developed a particular loathing for it. That's saying something, since I'm disgusted by most of the tools I'm forced to use.<p>It's certainly capable enough and isn't hard to use. It's also more ubiquitous, and therefore arguably more portable, than Ruby or Python, although dealing with differences between PHP versions is a pretty royal pain.<p>Pretty much any reasonably skilled programmer can do a job in PHP without too much trouble. You'll get more cred for using Python or Ruby though.
PHP is a brilliant language for small to medium-small sites.<p>Since most medium-small sites have an irrepressible tendency to grow into medium and even large sites, I'd stay away from PHP for anything other than a quick and simple site.<p>Ruby and Python are much more sustainable in the medium term and even the long term, and just as quick to throw applications together. Sure, they won't last forever, and eventually you may have to rewrite critical bits in another language, but in the meantime it works to release something quickly and keep improving it for a few years.<p>Daniel
It's strange that nobody has mentioned that Yahoo! uses PHP to power a lot of their software, and it obviously scales very well if you know what you're doing.<p>They also remarked that they are looking into using Symfony framework in their software.
PHP gives you more slack than any other language. . .<p>which is just enough rope to hang yourself with.<p>To be honest, part of it will depend on your style and part of it will depend on your discipline.<p>I'm a fan of Python. PHP is not my style. I like one way of doing things. I like namespaces. I don't like all the extra syntax that I feel is useless ({};$).<p>But that's just me personally. Many people hate python for those reasons - it's constraining.<p>Objectively, PHP allows you to do what you want easily. The only problem is that taking those shortcuts can come back to bite you later. If you appropriately use include(), make sure to template out design, and avoid some of those oh-so-irresistible hacky things, you'll be fine. Digg has done well with PHP.<p>The problem is that it's hard to know exactly where you're screwing up sometimes. For example, in python, every name used in a python source was defined either in that file or in one of the imports. That makes it trivial to figure out why that "I can't find that name" error is occurring. With PHP, that name could be meant to be included 10 files back. They simply all carry over.<p>So, is PHP bad? I personally think it is, but I'm a little conservative an authoritarian when it comes to programming rather than PHP's more loose style. Can PHP's style help you? Yes.
PHP is the VBScript of the open source world. It's available on almost every web host, and it seems to be what beginners learn first. While I'm sure it's possible to write things in a safe and mantainable way, most code examples you see will be from beginners and will have problems with the OWASP top 10. You can't look to the built in libraries for inspiration beacuse they're usually poorly designed.
Just because there have been success stories in a language (cold fusion and myspace, php and facebook) doesn't mean it's right for you. It took me one website and only 1000 lines of code to decide against PHP. If you've used it longer and like it, it's probably fine.
I currently do a lot of work in PHP, and although it isn't my favorite language to work with (braindead built-in library, for one), it's hard to argue with the results we get.<p>For the good of your soul, use a framework. We currently like Zend Framework, but I've heard good things about CakePHP and Symfony. If you stick with the framework and follow a sane MVC strategy you'll fix most of the problems you'll have using PHP as an HTML templating language.
We do a lot of work in PHP, but wouldn't even consider it if it wasn't for clean MVC frameworks like Code Igniter.<p>To be honest, it doesn't feel much like PHP on the average bit of coding. It feels like a "real" language most of the time because of the framework. They have one of the best user guides I've ever run into (click Table of Contents at top):
<a href="http://codeigniter.com/user_guide/" rel="nofollow">http://codeigniter.com/user_guide/</a>
i believe that every language has its perks, and PHP has quite a few. as far as back-ends go, there are a few types
-xml/json webservices
-low memory application servers(blogs, shopping sites, etc..)
-high memory application servers(data mining, indexing, processing, game servers)<p>i think php is a great low memory solution, when you get into higher memory loads for the app to process, you do not want to reload everything back in to ram for each request. php is single threaded per request, and as such you don't have access to sockets, or other event based activities on the server side.<p>i agree with the statement in general, that you should go with what you know to be the most efficient language for the task.
Having dealt with a lot of really awful PHP in my programming career (including some of my earlier stuff), it tends to unfairly taint my view of the language.<p>It's not terrible, but I've found that the clunky syntax for slightly more advanced stuff (e.g. anonymous blocks) really discourages some labor-saving and repetition-avoiding coding practices that a language like Ruby encourages.<p>It's a really good fit for small-scale sites with well-defined requirements. But it requires some well-thought-out conventions to scale well, the sort of stuff you can't come up with unless you've done it wrong a couple of times yourself. Unless you borrow someone else's work by using one of the frameworks out there.
PHP is the lazy man language. Sure, its messy and has bad convention. It gives you bad habits unless you use a framework...<p>But then of course we should all take a step back and realize that Facebook is built on PHP, haha.
Go for the framework that lets you develop quicker. The truth is that there's no framework on earth that has solved the 'scaling' problem for you. Anyone who says '<framework x> doesn't scale' in all probability has never scaled anything.<p>Scaling isn't even a real, real problem you need to worry about until you're a top 1000 site at minimum, or > 10MM page views a day. At numbers past that, no framework is going to magically solve your database partitioning problems.
PHP simply requires discipline, which unfortunately many people in the PHP world lack due to its initial target audience. Provided you find real hackers and not just designer-turned-coder types, PHP is totally workable.<p>Mind you, when you're getting into the more functional side of Ruby or Python, PHP starts to show its limits as a language. But it's still fast to code in and to do so well if you know what you're doing.
<a href="http://us3.php.net/manual/en/ref.array.php" rel="nofollow">http://us3.php.net/manual/en/ref.array.php</a><p>PHP's standard library is not object oriented<p>75 array functions<p>47 of them start with array_<p>28 do not<p>Out of the 28 that do not, you have such greats as: usort, sort, rsort, asort, arsort, krsort, uksort, uasort<p>Nuf said.
PHP is my preference for web development. However, you can do anything with any language. The part that has the most influence on how easy or hard it is usually the framework, not the language.<p>On that note, I am tired of articles comparing PHP to Rails. It's like comparing a Honda to the metal used to build another car.
i've been using it for all of my websites for about 6 years. It's robust enough to do just about anything. it's just close enough to see C to be familiar and just different enough to slightly irk you. I'm getting to ready to roll out my first Ruby site though.
I used PHP heavily for a few years (~70% PHP, 20% perl, 10% Java), and enjoyed it for awhile. However, it seems like it is impossible to create clean and well-divided code in PHP. This weighed on me heavily, as I had two 10,000 line projects that I was the sole maintainer for. Even if you managed to create well-structured code, it was always very... ugly (too many unnecessary symbols $, ->, etc). It wasn't much fun to work in every day.<p>I'm using Ruby now and I would never go back.<p>Here's my rough order of language preference for server-side languages that I have experience in:
Ruby > Python > C# > PHP > Perl > Visual Basic > Java > C
It's a fine backend language for a small to medium sized website, but you need to be aware that at a certain size (in terms of complexity of the application you are building) you'll often find yourself fighting against the language. That's not to say you can't build large applications in PHP, just that you need a great deal of discipline to do so. You'll either need to adopt one of the MVC frameworks (Symfony for example) or roll your own. A lot of the features in the framework you chose will be workarounds for limitations in PHP itself (such as its lack of decent namespacing and poorly designed database access primitives).
I'm not sure if this is a troll question. Elaborate on why you are asking. You are asking: "what do you think of pudding" instead of "hey, I'm having a dinner party and can't decide between apple pie and pudding, help me!"
I build absolutely everything on the top of PHP and the WACT framework. The latter ensures that my code stays maintainable and well-organized. It also emphasizes the use of design patterns. I'd never switch to anything else when it comes to web development and I'd have left the industry if there was no WACT. That's why I became one of its core contributors.
I use PHP for basic stuff where I don't care much about performance or anyone else maintaining it. It's installed on pretty much every web host and it's easy enough to whip stuff up in. I haven't done a big web site in a long time, but I can't imagine using anything other than Python for it.
I have a lot of respect for PHP, for having made web programming accessible to people who otherwise would have struggled with something like Java.<p>However, I never want to use it again myself. I'm tired of digging through horrible code written by people without a clue.
Bottom line is: PHP can get the job done (cheap and fast) and scales pretty well. I have been using Zend Framework for almost a year now - with the release of 1.5, I recommend it above anything else (other PHP MVC Framework).
If it's the right tool for the job then use it.<p>Our app is nearly entirely client side, with a little server side PHP glue. Something like Rails would be overkill.
I'll admit, I'm a rookie. I've spent a few months now learning and writing PHP...is my effort in vain? Should I ditch PHP and dive into Ruby with a Rails framework?
amrithk, what type of website are you thinking of building ? Your question gives me as little clue as, "what language should I use to write software???
Its been informative learning about your experiences. What do you mean by frameworks? Something like a backend scripting language, a templating tool (like Smarty or PHPTal), etc?