Features Flashcards

1
Q

Where are uploaded files stored by default?

A

In the server’s default temporary directory.

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

How can you upload multiple files with PHP?

A

Use a different name for input.

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

Does PHP support PUT requests?

A

Yes. First you would configure Apache to handle PUT requests with a specific PHP script,

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

What does allow_furl_open do?

A

It allows you to use HTTP and FTP urls with most of the functions that take a filename as a parameter.

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

Can you use PHP to write to files on an FTP server?

A

Yes, but if you try to overwrite a file that already exists, the fopen() call will fail.

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

What are the 4 possible states of a connection status in PHP?

A

0 - NORMAL
1 - ABORTED
2 - TIMEOUT
3 - ABORTED AND TIMEOUT

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

What does register_shutdown_function() do?

A

It registers a function to be executed on shutdown.

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

How can you trigger something to happen if a client aborts a connection?

A

Check if the client disconnected with connection_aborted().

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

How can you determine the connection status?

A

Call connection_status().

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

What are persistent database connections?

A

Links that do not close when the execution of your script ends. When a persistent connection is requested, PHP checks if there’s already an identical persistent connection (that remained open from earlier) - and if it exists, it uses it. If it does not exist, it creates the link. An ‘identical’ connection is a connection that was opened to the same host, with the same username and the same password (where applicable).

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

When are persistent database connections particularly helpful?

A

When connection overhead is high.

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

What are a couple of caveats to keep in mind when using persistent connections?

A
  1. When using table locking on a persistent connection, if the script for whatever reason cannot release the lock, then subsequent scripts using the same connection will block indefinitely and may require that you either restart the httpd server or the database server.
  2. When using transactions, a transaction block will also carry over to the next script which uses that connection if script execution ends before the transaction block does.

In either case, you can use register_shutdown_function() to register a simple cleanup function to unlock your tables or roll back your transactions. Better yet, avoid the problem entirely by not using persistent connections in scripts which use table locks or transactions (you can still use them elsewhere).

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