With older versions of Drupal you could not run Drupal without Apache or Nginx to perform the URL rewrites needed to use the application with clean URLs.
New versions of Drupal (8+) come with a
.ht.router.php file that is specifically used to run local development instances with just the built-in PHP web server. No Apache, no Wamp, no Mamp, no Xampp. Just the built-in PHP server.
In addition, you don't have to use MySQL an setup a separate database. Drupal supports SQLite3 so can completely skip any MySQL setup.
This means you can run a local Drupal development environment with nothing but PHP.
- No Apache
- No MySQL
- No Wamp,Xampp,Mamp
- Just PHP
Following the method in this guide works on Windows, Mac, and Linux equally.
There are a few easy steps for this procedure:
- Check PHP configuration - make sure you have the right modules
- Run the built-in PHP web server - point it at the router file
- Configure Drupal - run through the install/setup wizard in the browser
Check PHP configuration
You will need to make sure your PHP has the SQLite PDO module.
You can see what modules are enabled with
# List enabled modules php -m
You should see these two entries somewhere in the list:
If you don't see it in the list, you can check in your
php.ini file for the
pdo_sqlite extension. Make sure the line does not begin with a semicolin (
;) or it means the extension is commented out and disabled. I also recommend turning on
openssl since they are so commonly used.
Download the latest version from https://www.drupal.org/project/drupal.
Navigate in your terminal to the directory where Drupal resides.
Then start the built-in PHP web server, pointing the router option
.ht.router.php file provided by Drupal.
php -S localhost:9999 .ht.router.php
In your browser, visit http://localhost:9999/. If you have not configured Drupal yet, it should present you with the setup screen. It will let you know if you have any missing PHP modules first, then it will let you configure the database. Choose the SQLite option. Fill out the final information like the admin user account and you are all done.
After reading this guide you should understand how to setup a simple local development environment for Drupal 8+ using just PHP without MySQL or Apache. This is not a proper environment for production but it good for development.