language before, this was my first real project.
What are the big differences to the Java (web) development experience?
- interpreted (no compiler to check for errors, just a parser)
- dynamically typed (->no "parse-time" type checking in the IDE ..)
- essential procedural, object handling completely rewrittten from version 4 to 5 now basic oo functionality
- hunderts of statically callable base function; e.g. very easy to download & store a file: $contents = file_get_contents($url)
- Very "close" to the HTTP request-response model
- the script execution is determined by the HTTP request (e.g. check ignore_user_abort )
- MySQL and Postgres integration modules for persistence
- Caching, Pooling is different due to the fact that a PHP process in its pure form only lives during one Web request:
3 ways a PHP can run in a Web Server:
- as CGI wrapper: instance of the php interpreter created and destroyed for every page request
- module (e.g. mod_php, mod_fastcgi) in a multiprocessor web server like Apache. Apache/FastCGI can reuse php instances
- plugin to web server
This means that connection pooling is not really possible.
Caching:
- page scope: not necessary in php. All variables within includes are acessible
- request scope: not supported natively, but can be implemented via session
- session scope: see PHP Session. Data stored within a text file in php/tmp or similar. Data must be serializable (It is not possible to serialize PHP built-in objects!)
- application scope: does not exist - Generally faster code-test iterations.
- Quick infrastructure setup: Apache, php, Apache-php integration (e.g. mod_php), Editor.
- More difficult to manage complex/larger projects because:
- interpreted & dynamically typed: errors only found at runtime
- Exception handling difficult
- OO-shortcomings
- ...
No comments:
Post a Comment