# I/O and Filesystem

> Section in “New and Extended Functionality” of the book [PHP 7 Explained](https://php7explained.com/) by Sebastian Bergmann and Stefan Priebsch, published by thePHP.cc. The book covers PHP 7.0 to 7.4 and was last updated in November 2020. HTML version: <https://php7explained.com/new-and-extended-functionality/io-and-filesystem/>

## In this section

- [Support for VT100 Console Mode](https://php7explained.com/new-and-extended-functionality/io-and-filesystem/support-for-vt100-console-mode/index.html.md): As of PHP 7.2, ANSI escape sequences for colored console output also work on Windows 10, starting with build 10586, thanks to VT100 console mode support.
- [Optional Level Parameter for dirname()](https://php7explained.com/new-and-extended-functionality/io-and-filesystem/optional-level-parameter-for-dirname/index.html.md): PHP 7 adds an optional second parameter to dirname() that specifies the number of directory levels to go up; it must be a positive integer.
- [Specifying the zip Compression Method](https://php7explained.com/new-and-extended-functionality/io-and-filesystem/specifying-the-zip-compression-method/index.html.md): PHP 7 lets you set the compression method for each item in a zip archive with ZipArchive::setCompressionName() and ZipArchive::setCompressionIndex().
- [Stream-Based Compression](https://php7explained.com/new-and-extended-functionality/io-and-filesystem/stream-based-compression/index.html.md): PHP 7 adds deflate_init(), deflate_add(), inflate_init(), and inflate_add() to the zlib extension for compressing and uncompressing data incrementally.
- [Output Buffering and ignore_user_abort()](https://php7explained.com/new-and-extended-functionality/io-and-filesystem/output-buffering-and-ignore_user_abort/index.html.md): PHP 7 fixes a bug introduced in PHP 5.4 that discarded the output buffer when the client aborted a request, relevant when ignore_user_abort is used.
- [New function stream_isatty()](https://php7explained.com/new-and-extended-functionality/io-and-filesystem/new-function-stream_isatty/index.html.md): As of PHP 7.2, stream_isatty() tells CLI applications whether a given resource is a terminal (TTY), returning true if it is and false otherwise.
- [Stream Context Option on Windows](https://php7explained.com/new-and-extended-functionality/io-and-filesystem/stream-context-option-on-windows/index.html.md): PHP 7 introduces a stream context option that only works on Windows: setting blocking to true for pipe allows blocking reads on pipes.
- [Debugging PDO Prepared Statement Emulation](https://php7explained.com/new-and-extended-functionality/io-and-filesystem/debugging-pdo-prepared-statement-emulation/index.html.md): PHP 7.2 adds PDOStatement::activeQueryString(), which returns the current SQL query string to help debug the emulation of prepared statements in PDO.
- [proc_open() on Windows](https://php7explained.com/new-and-extended-functionality/io-and-filesystem/proc_open-on-windows/index.html.md): proc_open() on Windows is no longer restricted to a hardcoded maximum of 16 pipes; the number of pipes is now limited only by the available memory.
- [proc_nice() on Windows](https://php7explained.com/new-and-extended-functionality/io-and-filesystem/proc_nice-on-windows/index.html.md): As of PHP 7.2, the proc_nice() function for changing the priority of the process that runs the current PHP script is also available on Windows.
- [getrusage() on Windows](https://php7explained.com/new-and-extended-functionality/io-and-filesystem/getrusage-on-windows/index.html.md): Since PHP 7, getrusage() is also supported on Windows, where it returns information about the user time and system time spent by the running script.
- [memory_limit on Windows](https://php7explained.com/new-and-extended-functionality/io-and-filesystem/memory_limit-on-windows/index.html.md): Discusses the claim that PHP 7 on Windows now supports the memory_limit php.ini directive, which the authors could neither confirm nor deny.
- [File Deletion on Windows](https://php7explained.com/new-and-extended-functionality/io-and-filesystem/file-deletion-on-windows/index.html.md): Since PHP 7.3, file descriptors on Windows are opened in shared read/write/delete mode by default, which allows deleting files that are still open.
- [Username and Password in PDO DSN](https://php7explained.com/new-and-extended-functionality/io-and-filesystem/username-and-password-in-pdo-dsn/index.html.md): Since PHP 7.4, username and password can be specified as part of the PDO DSN, which was previously possible only when connecting to PostgreSQL.
- [New Function fpm_get_status() in PHP-FPM](https://php7explained.com/new-and-extended-functionality/io-and-filesystem/new-function-fpm_get_status-in-php-fpm/index.html.md): Since PHP 7.3, fpm_get_status() returns the status information of the FastCGI process manager when run inside PHP-FPM, for building advanced status pages.
- [getallheaders() Available in PHP-FPM](https://php7explained.com/new-and-extended-functionality/io-and-filesystem/getallheaders-available-in-php-fpm/index.html.md): As of PHP 7.3, the getallheaders() function for retrieving all request headers sent by the client is also available when PHP runs under PHP-FPM.
- [New Configuration Settings in PHP-FPM](https://php7explained.com/new-and-extended-functionality/io-and-filesystem/new-configuration-settings-in-php-fpm/index.html.md): PHP-FPM gains three configuration options: log_limit for the maximum log line size, log_buffering, and decorate_workers_output for worker output.

---

Previous: [Session Garbage Collection](https://php7explained.com/new-and-extended-functionality/session-management/session-garbage-collection/index.html.md) | Next: [Support for VT100 Console Mode](https://php7explained.com/new-and-extended-functionality/io-and-filesystem/support-for-vt100-console-mode/index.html.md)
