Theres no reason you can't use PHP for large projects. After all, Facebook is built on PHP. There will be issues however but there are issues with any large project.
What makes PHP so pervasive is the low barrier to entry and cheap hosting. It runs as an Apache extension and you can pretty much just start coding. If you go to more enterprise platforms such as .Net or Java, they have a much higher barrier to entry but they also come with a lot of infrastructure to help you make applications that scale.
For example, the database abstraction in PHP is (imho) woeful. It's vendor specific. With MySQL, people tend to do things like:
function get_users($surname) {
mysql_query("select * from users where surname = '$surname'");
...
}
which is bad for several reasons:
- It makes poor use of the query cache;
- It doesn't handle escaping of characters (which, of course, can be done with
mysql_escape_string()
but you'll be surprised how often people don't do this); and
- It's fairly easy to code in such a way as to allow SQL injection attacks.
Personally I prefer mysqli for all the above reasons but it has it's own problems: namely that using LONGTEXT fields crashes mysql and has done since at least 2005 with still no fix (yes I and several others have raised a bug).
Compare this to Java (with which I'm more familiar) and JPA or Ibatis are vastly better ORM solutions with higher startup costs but they will help you on an enterprise scale.
So you're not prohibited from doing large projects on PHP. It's simply harder in that you have to do increasingly more work yourself to replicate what other platforms provide you.
That being said, PHP + memcached/APC + beanstalkd goes a long way.
Oh that's the other problem: PHP doesn't really support background processing or threading. You need something else for that (or standalone scripts). If you're using something else, why not use that for the Web stuff too (eg Java, Ruby, .Net, etc)?