Title: Given a PHP built-in web server to serve :subdir
Published: June 12, 2025
Last modified: July 21, 2026

---

# Given a PHP built-in web server to serve :subdir

## In this article

 * [Usage](https://make.wordpress.org/cli/handbook/references/behat-steps/given-a-php-built-in-web-server-to-serve-subdir/?output_format=md#usage)
 * [Related](https://make.wordpress.org/cli/handbook/references/behat-steps/given-a-php-built-in-web-server-to-serve-subdir/?output_format=md#related)

Start a PHPPHP PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely-
used open source general-purpose scripting language that is especially suited for
web development and can be embedded into HTML. [https://www.php.net/manual/en/index.php](https://www.php.net/manual/en/index.php)
built-in web server in the given subdirectory.

---

## 󠀁[Usage](https://make.wordpress.org/cli/handbook/references/behat-steps/given-a-php-built-in-web-server-to-serve-subdir/?output_format=md#usage)󠁿

    ```
    Scenario: My example scenario
      Given a WP installation
      And a PHP built-in web server to serve 'WordPress'
    ```

_Behat steps documentation is generated from the WP-CLIWP-CLI WP-CLI is the Command
Line Interface for WordPress, used to do administrative and development tasks in
a programmatic way. The project page is [http://wp-cli.org/](http://wp-cli.org/)
[https://make.wordpress.org/cli/](https://make.wordpress.org/cli/) codebase on every
release. To suggest improvements, please submit a pull request._

---

## 󠀁[Related](https://make.wordpress.org/cli/handbook/references/behat-steps/given-a-php-built-in-web-server-to-serve-subdir/?output_format=md#related)󠁿

 * **[Given an empty directory](https://make.wordpress.org/cli/handbook/behat-steps/given-an-empty-directory/)**–
   Creates an empty directory.
 * **[Given /^an? (empty|non-existent) ([^\s]+) directory$/](https://make.wordpress.org/cli/handbook/behat-steps/given-an-empty-non-existent-directory/)**–
   Creates or deletes a specific directory.
 * **[Given an empty cache](https://make.wordpress.org/cli/handbook/behat-steps/given-an-empty-cache/)**–
   Clears the WP-CLI cache directory.
 * **[Given /^an? ([^\s]+) (file|cache file):$/](https://make.wordpress.org/cli/handbook/behat-steps/given-an-file-cache-file/)**–
   Creates a file with the given contents.
 * **[Given /^"([^"]+)" replaced with "([^"]+)" in the ([^\s]+) file$/](https://make.wordpress.org/cli/handbook/behat-steps/given-replaced-with-in-the-file/)**–
   Search and replace a string in a file using regex.
 * **[Given /^that HTTP requests to (.\*?) will respond with:$/](https://make.wordpress.org/cli/handbook/behat-steps/given-that-http-requests-to-will-respond-with/)**–
   Mock HTTPHTTP HTTP is an acronym for Hyper Text Transfer Protocol. HTTP is the
   underlying protocol used by the World Wide Web and this protocol defines how 
   messages are formatted and transmitted, and what actions Web servers and browsers
   should take in response to various commands. requests to a given URLURL A specific
   web address of a website or web page on the Internet, such as a website’s URL
   www.wordpress.org.
 * **[Given WP files](https://make.wordpress.org/cli/handbook/behat-steps/given-wp-files/)**–
   Download WordPress files without installing.
 * **[Given wp-config.php](https://make.wordpress.org/cli/handbook/behat-steps/given-wp-config-php/)**–
   Create a wp-config.php file using `wp config create`.
 * **[Given a database](https://make.wordpress.org/cli/handbook/behat-steps/given-a-database/)**–
   Creates an empty database.
 * **[Given /^a WP( \d[^\s]+)? install(?:ation)?$/](https://make.wordpress.org/cli/handbook/behat-steps/given-a-wp-installation/)**–
   Installs WordPress.
 * **[Given /^a WP( [^\s]+)? install(?:ation)? in [‘"]?([^’"]+)[‘"]?$/](https://make.wordpress.org/cli/handbook/behat-steps/given-a-wp-installation-in/)**–
   Installs WordPress in a given directory.
 * **[Given a WP install(ation) with Composer](https://make.wordpress.org/cli/handbook/behat-steps/given-a-wp-installation-with-composer/)**–
   Installs WordPress with Composer.
 * **[Given a WP install(ation) with Composer and a custom vendor directory :vendor_directory](https://make.wordpress.org/cli/handbook/behat-steps/given-a-wp-installation-with-composer-and-a-custom-vendor-directory-vendor-directory/)**–
   Installs WordPress with Composer and a custom vendor directory.
 * **[Given /^a WP multisite (subdirectory|subdomain)?\s?(install|installation)$/](https://make.wordpress.org/cli/handbook/behat-steps/given-a-wp-multisite-subdirectory-subdomaininstall-installation/)**–
   Installs WordPress MultisiteMultisite Multisite is a WordPress feature which 
   allows users to create a network of sites on a single WordPress installation.
   Available since WordPress version 3.0, Multisite is a continuation of WPMU or
   WordPress Multiuser project. WordPress MultiUser project was discontinued and
   its features were included into WordPress core. [Advanced Administration Handbook -> Create A Network.](https://developer.wordpress.org/advanced-administration/multisite/create-network/).
 * **[Given these installed and active plugins:](https://make.wordpress.org/cli/handbook/behat-steps/given-these-installed-and-active-plugins/)**–
   Installs and activates one or more plugins.
 * **[Given a custom wp-content directory](https://make.wordpress.org/cli/handbook/behat-steps/given-a-custom-wp-content-directory/)**–
   Configure a custom `wp-content` directory.
 * **[Given download:](https://make.wordpress.org/cli/handbook/behat-steps/given-download/)**–
   Download multiple files into the given destinations.
 * **[Given /^save (STDOUT|STDERR) ([\’].+[^\’])?\s?as \{(\w+)\}$/](https://make.wordpress.org/cli/handbook/behat-steps/given-save-stdout-stderr-as/)**–
   Store STDOUT or STDERR contents in a variable.
 * **[Given /^a new Phar with (?:the same version|version "([^"]+)")$/](https://make.wordpress.org/cli/handbook/behat-steps/given-a-new-phar-with-the-same-version-version/)**–
   Build a new WP-CLI Phar file with a given version.
 * **[Given /^a downloaded Phar with (?:the same version|version "([^"]+)")$/](https://make.wordpress.org/cli/handbook/behat-steps/given-a-downloaded-phar-with-the-same-version-version/)**–
   Download a specific WP-CLI Phar version from GitHubGitHub GitHub is a website
   that offers online implementation of git repositories that can easily be shared,
   copied and modified by other developers. Public repositories are free to host,
   private repositories require a paid subscription. GitHub introduced the concept
   of the ‘pull request’ where code changes done in branches by contributors can
   be reviewed and discussed before being merged by the repository owner. [https://github.com/](https://github.com/).
 * **[Given /^save the (.+) file ([\’].+[^\’])?as \{(\w+)\}$/](https://make.wordpress.org/cli/handbook/behat-steps/given-save-the-file-as/)**–
   Stores the contents of the given file in a variable.
 * **[Given a misconfigured WP_CONTENT_DIR constant directory](https://make.wordpress.org/cli/handbook/behat-steps/given-a-misconfigured-wp-content-dir-constant-directory/)**–
   Modify wp-config.php to set `WP_CONTENT_DIR` to an empty string.
 * **[Given a dependency on current wp-cli](https://make.wordpress.org/cli/handbook/behat-steps/given-a-dependency-on-current-wp-cli/)**–
   Add `wp-cli/wp-cli` as a Composer dependency.
 * **[Given a PHP built-in web server](https://make.wordpress.org/cli/handbook/behat-steps/given-a-php-built-in-web-server/)**–
   Start a PHP built-in web server in the current directory.

First published

June 12, 2025

Last updated

July 21, 2026

Edit article

[ Improve it on GitHub: [article_title] ](https://github.com/wp-cli/handbook/edit/main/behat-steps/given-a-php-built-in-web-server-to-serve-subdir.md)

Changelog

[ See list of changes: [article_title] ](https://github.com/wp-cli/handbook/commits/main/behat-steps/given-a-php-built-in-web-server-to-serve-subdir.md)

[  Previous: Given a PHP built-in web server](https://make.wordpress.org/cli/handbook/references/behat-steps/given-a-php-built-in-web-server/)

[  Next: Given a WP install(ation) in :subdir](https://make.wordpress.org/cli/handbook/references/behat-steps/given-a-wp-installation-in-subdir/)