I had to do some PHP 2-3 years ago. I had always had a negative view of PHP prior to that despite knowing almost nothing about it, which I think is a not uncommon experience.
Anyway, there are lots of things that offend people about PHP that are basically inexcusable: like the inconsistency in parameter order (needle, haystack or the other way around?) and the inconsistent use of underscores in API method calls.
But all of that is just noise. Use something like PHPStorm, Netbeans, Komodo or whatever and it'll tell you the right order or if the function doesn't exist (I know some people are still in love with their raw text editors; I'm not one of them). And you learn quickly enough the right names and orders.
One thing I love about PHP is the simplicity of it. Edit the file, save, refresh in the browser. I love this short feedback loop. It was a refreshing change from doing Web apps in Java (for example), which added a compile/build/package step in between.
After doing this I investigated the common frameworks (CodeIgniter, Kohana, Zend, etc) and frankly I was horrified.
These things are so hideously overcomplicated. It's like a zealous Java programmer tried to recreate "Super-Struts" in PHP in a devilish plan to destroy all of the advantages of PHP while leaving a lot of the negatives.
The number of times I got bitten in the ass or just wasted time trying to figure out how the "magic" in Zend worked was infuriating.
Take something as simple as a controller. This is stupidly easy to implement yourself that any sort of generic framework is just going to bring you pointless crap you don't care about to the stuff you do by a factor of probably 10:1.
The ORM side was even worse. Java is kinda built for ORMs. It has stateful Web containers. PHP isn't (and doesn't).
The one bright spot I found was templating. It is common to say "why use a templating language with PHP when PHP is a templating language?" and you have an entire valid position. I too have said this.
That being said, I found Smarty to be incredibly useful just from the point of view of caching parts of the page and creating my own plugins/extensions for tasks that were common to me. Smarty had other issues like I wasn't completley fond of it's caching model and the speed, prior to Smarty 3 at least (which I've never used), was also questionable.
But despite all that I liked it a lot.
So can you use PHP without a framework? Sure you can. Not only that, I'd highly suggest it if you know what you're doing.
One of php's main advantages is the availability of many options.
You have the option to do web apps in plain php.
You have the option to do web apps in many mature frameworks.
Languages like ruby and python lack this. Can you do a website in plain ruby as easily?
How many mature ruby web frameworks are there in ruby?
There are many in php. Zend Framework, Agavi, Kohana, CodeIgniter, Prado, Yii, Symfony and many others.
Of course some stuff in php suck hard. I would personally love an string-object to replace all the stupid str_*() functions, but php is in the right direction of adding features. (My last issues are fixed by 5.3's late static bindings)
And im surprised how php community quickly adopts changes. PHP 5.3 breaks compatibility but i see more people using it everyday.
I think despite all the negativity, PHP is going to stay for long-term.
I've written websites in plain Ruby, as CGI scripts running on Apache. I actually find this easier that PHP, as Ruby doesn't have nearly as many weird inconsistencies. I think I'm pretty unusual in being one of the few Ruby programmers who didn't immediately begin with learning Rails.
Ruby with Passenger can be used for a simple website. Throw in Sinatra with Datamapper or ActiveRecord and you've got a lightweight setup - with better options for string manipulation than PHP :)
"The number of times I got bitten in the ass or just wasted time trying to figure out how the "magic" in Zend worked was infuriating."
This is true for all frameworks in all languages. Instead of doing the Unix thing and providing well-behaved libraries that do one thing well, people build a pile of opinionated spaghetti. To quote HN user mahmud:
Everytime I tried to use any of these PHP frameworks, I got frustated because they demand you to be stucked inside the "convention over configuration" and you can't do anything more complicated into your code without having to read a lot of docs about how to make something outside the "normal code". You always have to inherit you controller from something else.
While I agree about the Zend framework, Symphony and others trying too hard to be full of features, frameworks like Code igniter are really light. Sure for some very very basic projects it might still be too much, but for an actuel interactive websites chances are higher of it missing features than having too many ...
Can you give an exemple of something it does by default that is "pointless crap" ?
Pointless crap is subjective. Zend_SOAP, I imagine, would for many be considered "pointless crap", but having it available means I don't have to go looking for a SOAP library when I need it to interface with a gateway.
People always confuse features with bloat. Disk space is cheap, and these frameworks aren't hurting things by having additional features.
Now, complexity I can get behind, but stop relating complexity to weight or bloat. CI is less complex than ZF because it does substantially less. It requires developers to do more to accomplish the same tasks ZF developers can do a lot faster. However, it takes a lot more work to get to that point.
Personally, I'm glad we have these choices. We can choose the right tool for the job. =)
Really about Zend? We use Zend Framework extensively and find that while we can roll our own (and I certainly have), it is a well-documented MVC framework that provides a decent foundation for our applications. Zend probably only solves 10% of our issues - the remaining 90% are very application-specific logic.
As for the edit/compile/deploy/run cycle in Java web app development, the Play Framework pretty much reduces that to just edit/refresh. It's really amazing.
I've done two projects with Play and both development cycles are extremely fast.
Anyway, there are lots of things that offend people about PHP that are basically inexcusable: like the inconsistency in parameter order (needle, haystack or the other way around?) and the inconsistent use of underscores in API method calls.
But all of that is just noise. Use something like PHPStorm, Netbeans, Komodo or whatever and it'll tell you the right order or if the function doesn't exist (I know some people are still in love with their raw text editors; I'm not one of them). And you learn quickly enough the right names and orders.
One thing I love about PHP is the simplicity of it. Edit the file, save, refresh in the browser. I love this short feedback loop. It was a refreshing change from doing Web apps in Java (for example), which added a compile/build/package step in between.
After doing this I investigated the common frameworks (CodeIgniter, Kohana, Zend, etc) and frankly I was horrified.
These things are so hideously overcomplicated. It's like a zealous Java programmer tried to recreate "Super-Struts" in PHP in a devilish plan to destroy all of the advantages of PHP while leaving a lot of the negatives.
The number of times I got bitten in the ass or just wasted time trying to figure out how the "magic" in Zend worked was infuriating.
Take something as simple as a controller. This is stupidly easy to implement yourself that any sort of generic framework is just going to bring you pointless crap you don't care about to the stuff you do by a factor of probably 10:1.
The ORM side was even worse. Java is kinda built for ORMs. It has stateful Web containers. PHP isn't (and doesn't).
The one bright spot I found was templating. It is common to say "why use a templating language with PHP when PHP is a templating language?" and you have an entire valid position. I too have said this.
That being said, I found Smarty to be incredibly useful just from the point of view of caching parts of the page and creating my own plugins/extensions for tasks that were common to me. Smarty had other issues like I wasn't completley fond of it's caching model and the speed, prior to Smarty 3 at least (which I've never used), was also questionable.
But despite all that I liked it a lot.
So can you use PHP without a framework? Sure you can. Not only that, I'd highly suggest it if you know what you're doing.