Affecting PHP's Behavior Flashcards
What is APC?
Alternative PHP Cache, a free and open opcode cache for PHP.
Are any external libraries needed to build APC?
No.
Is APC bundled with PHP?
No. It’s a PECL extension.
What are the two primary decisions to be made configuring APC?
- How much memory is going to be allocated to APC: apc.shm_size.
- Whether APC will check if a file has been modified on every request: apc.stat.
What is APCIterator?
It makes it easier to iterate over large APC caches.
What is APD?
The Advanced PHP Debugger.
What function is used to start an APD trace?
apd_set_pprof_trace().
What is bcompiler?
An extension for compiling PHP scripts.
What is BLENC?
BLowfish ENCoder for PHP source scripts. It encodes your source code with the blowfish algorithm.
How do you encrypt a PHP script with BLENC?
You must encrypt each script with the blenc_encrypt() function.
Is any installation necessary for using the error handling functions?
No, they are part of the PHP core.
What is the default error reporting level?
E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED
Why is $arr[item] better written as $arr[‘item’]?
Because PHP first tries to treat item as a constant, if it’s not enclosed in single quotes.
Can PHP constants be used in httpd.conf?
No.
What does the display_errors .ini setting do?
It prints errors to the screen, for development environments.
If track_errors is enabled, where will the last error message be located?
In $php_errormsg
What are the fatal error constants?
E_ERROR, E_CORE_ERROR, E_COMPILE_ERROR, E_RECOVERABLE_ERROR.
Describe debug_backtrace()
Generates a backtrace. It returns an array of associative arrays with error details.
Describe error_log()
Takes four parameters: the error message (should not contain null character), the message_type, which says where the error should go, the destination, and extra_headers, which is used when message_parameter is set to 1. Possible message types are:
0 - default option. Message is sent to PHP’s system logger, using the operating system’s system logging mechanism, or a file, depending on what the error_log configuration directive is set to.
1 - message is sent by email to the address in the destination.
2 - no longer an option.
3 - message is appended to the file destination. A newline is NOT automatically added to the message string.
4 - message is sent directly to the SAPI logging handler.
What does error_log return?
TRUE on success or FALSE on failure.
What does error_reporting return if the optional level is not set?
It returns the current error reporting level.
Why should you use a named constant with error_reporting, instead of a bitmask?
To ensure future compatibility.
What integer is given to error_reporting to report all errors?
-1
What is restore_error_handler() for?
It reverts to the previous error handler after changing it using set_error_handler(). It always returns TRUE.