Its entirely possible to write a poorly organized bowl of spaghetti using Ruby if you leave Rails out of the picture. I would venture to say the same is true for any programming language.
PHP was born before the idea of an open source framework had been propagated, it spread around the web before many of the paradigms and patterns had evolved to what they are today, and unfortunately it failed to gain acceptance by the elite programmers that have carved a community out using those other languages.
The other languages' respective frameworks have large, organized communities which have attracted very smart people that have put large swaths of functionality in place, before you ever have to write a line of code.
Its playing catch-up now, but there are good examples of PHP out there and it most certainly can be used in an elegant, high-quality manner.