Skip to main content

Using PHP webserver to run Drupal

Member for

2 years 2 months
Submitted by admin on

If you need to test Drupal, use the PHP web server with the following code. For an explanation of the PHP build-in web server please review this article.

:~ composer create-project drupal/recommended-project drupal 
:~ cd drupal php -d memory_limit=256M web/core/scripts/drupal quick-start demo_umami

To use a different port of directory the `-S` and `-t` flags are useful as well.

:~ composer create-project drupal/recommended-project drupal
:~ php -S localhost:8002 -t drupal -d memory_limit=256M web/core/scripts/drupal quick-start demo_umami

When running tests on a Drupal module using Sqlite a need to alter phpunit.xml in core to the following is a must.

 // The port number of your php server is bound to in the terminal.
 <env name="SIMPLETEST_BASE_URL" value="http://localhost:8002"/>
 // Path to where .sqlite is storing your website.
 <env name="SIMPLETEST_DB" value="sqlite://localhost/sites/default/files/.sqlite"/>