Affecting PHP's Behavior Flashcards

1
Q

What is APC?

A

Alternative PHP Cache, a free and open opcode cache for PHP.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Are any external libraries needed to build APC?

A

No.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Is APC bundled with PHP?

A

No. It’s a PECL extension.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are the two primary decisions to be made configuring APC?

A
  1. How much memory is going to be allocated to APC: apc.shm_size.
  2. Whether APC will check if a file has been modified on every request: apc.stat.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is APCIterator?

A

It makes it easier to iterate over large APC caches.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is APD?

A

The Advanced PHP Debugger.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What function is used to start an APD trace?

A

apd_set_pprof_trace().

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is bcompiler?

A

An extension for compiling PHP scripts.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is BLENC?

A

BLowfish ENCoder for PHP source scripts. It encodes your source code with the blowfish algorithm.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How do you encrypt a PHP script with BLENC?

A

You must encrypt each script with the blenc_encrypt() function.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Is any installation necessary for using the error handling functions?

A

No, they are part of the PHP core.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is the default error reporting level?

A

E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Why is $arr[item] better written as $arr[‘item’]?

A

Because PHP first tries to treat item as a constant, if it’s not enclosed in single quotes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Can PHP constants be used in httpd.conf?

A

No.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What does the display_errors .ini setting do?

A

It prints errors to the screen, for development environments.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

If track_errors is enabled, where will the last error message be located?

A

In $php_errormsg

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What are the fatal error constants?

A

E_ERROR, E_CORE_ERROR, E_COMPILE_ERROR, E_RECOVERABLE_ERROR.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

Describe debug_backtrace()

A

Generates a backtrace. It returns an array of associative arrays with error details.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

Describe error_log()

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

What does error_log return?

A

TRUE on success or FALSE on failure.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

What does error_reporting return if the optional level is not set?

A

It returns the current error reporting level.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

Why should you use a named constant with error_reporting, instead of a bitmask?

A

To ensure future compatibility.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

What integer is given to error_reporting to report all errors?

A

-1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

What is restore_error_handler() for?

A

It reverts to the previous error handler after changing it using set_error_handler(). It always returns TRUE.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

What does restore_exception_handler() do?

A

It reverts to the previous exception handler after changing it using set_exception_handler(). It always returns TRUE.

26
Q

Describe set_error_handler()

A

It sets a user function to handle errors in a script. It takes a callback with a specific signature, and a list of error types (default is E_ALL | E_STRICT) for which to apply the function.

27
Q

When setting an alternate error handler, are you still able to read the current value of error_reporting?

A

Yes. However, this value will be 0 if the statement that caused the error was prepended by the @ error-control operator.

28
Q

Which error types cannot be handled with a user-defined function?

A

E_ERROR, E_PARSE, E_CORE_ERROR, E_CORE_WARNING, E_COMPILE_ERROR, E_COMPILE_WARNING, and most of E_STRICT.

29
Q

What does set_error_handler return?

A

A string containing the previously defined error handler (if any). If the built-in error handler is used, NULL is returned. NULL is also returned in case of an error such as an invalid callback. If the previous error handler was a class method, this function will return an indexed array with the class and the method name.

30
Q

What does trigger_error return?

A

FALSE if wrong error_type is specified, TRUE otherwise.

31
Q

What does user_error do?

A

It’s an alias of trigger_error.

32
Q

What does the htscanner extension do?

A

It provides the possibility of using an htaccess-like file to configure PHP per directory.

33
Q

What does inclued do?

A

Traces through and dumps the hierarchy of file inclusions and class inheritance at runtime.

34
Q

What does Memtrack do?

A

It detects the most memory hungry scripts and functions.

35
Q

How is Memtrack controlled?

A

Via INI directives which allow you to configure the way it should work.

36
Q

What does OPcache do?

A

It improves PHP performance by storing precompiled script bytecode in shared memory, thereby removing the need for PHP to load and parse scripts on each request.

37
Q

What are the Output Control functions?

A

They allow you to control when output is sent from the script.

38
Q

The Output Control functions do not affect headers sent using…

A

…header() or setcookie(), only functions such as echo and data between blocks of PHP code.

39
Q

What is the runkit extension for?

A

It provides means to modify constants, user-defined functions, and user-defined classes. It also provides for custom superglobal variables and embeddable sub-interpreters via sandboxing.

40
Q

What does the scream extension do?

A

It gives the possibility to disable the silencing error control operator, so all errors are reported.

41
Q

What is the uopz extension?

A

User Operations for Zend - it exposes Zend Engine functionality normally used at compilation and execution time in order to allow modification of the external structures that represent PHP code, and for user code to interact with the VM.

42
Q

What is the Weak References extension?

A

They provide a non-intrusive gateway to ephemeral objects. Unlike normal (strong) references, weak references do not prevent the garbage collector from freeing that object.

43
Q

What is WinCache?

A

Windows Cache Extension for PHP - an accelerator for increasing the speed of PHP applications running on Windows and Windows Server.

44
Q

What is XHProf?

A

A light-weight hierarchical and instrumentation based profiler.

45
Q

Name some extensions for manipulating audio formats.

A

ID3, KTagLib, oggvorbis, OpenAL

46
Q

What is KADM5?

A

A package that allows you to access Kerberos V administration servers.

47
Q

What is Radius?

A

A package based on the libradius (Remote Authentication Dial In User Service) of FreeBSD. It allows clients to perform authentication and accounting by means of network requests to remote servers.

48
Q

What is ncurses?

A

A software emulation of curses, a terminal control library.

49
Q

What is Newt?

A

A PHP language extension for RedHat Newt library, a terminal-based window and widget library for writing applications with user-friendly interfaces.

50
Q

What is readline?

A

The readline functions implement an interface to the GNU Readline library. These functions provide editable command lines.

51
Q

What are some compression and archive extensions?

A

Bzip2, LZF, Phar, Rar, Zip, and Zlib.

52
Q

What are some credit card processing extensions?

A

MCVE and SPPLUS

53
Q

What are some cryptography extensions?

A

Crack, Hash, Mcrypt, Mhash, OpenSSL, Password Hashing, and CSPRNG.

54
Q

What is the Crack extension for?

A

Testing password strength.

55
Q

What is Mcrypt for?

A

An interface to the mcrypt library, which supports a wide variety of block algorithms.

56
Q

What is Mhash for?

A

Creating checksums, message digests, message authentication codes, and more.

57
Q

What is OpenSSL for?

A

Generation and verification of signatures and for encrypting and decrypting data.

58
Q

What is the password hashing API for?

A

It’s an easy wrapper around crypt() to make it easy to create and manage passwords in a secure manner.

59
Q

What is the CSPRNG API?

A

The cryptographically secure pseudo-random number generator API provides an easy and reliable way to generate crypto-strong random integers and bytes for use within cryptographic contexts.

60
Q

What is the DBA abstraction layer?

A

It builds the foundation for accessing Berkeley DB style databases.

61
Q

What is the dbx module?

A

A database abstraction layer which allows you to access all supported databases using a single calling convention.

62
Q

What are the ODBC functions?

A

A standard middleware API for database management systems.