Sometimes you just want to check a SilverStripe version, module or theme fast and dont want to setup the whole stack.
Then simply use PHPs built-in webserver to serve your SilverStripe site.
php -S localhost:8000 ./framework/main.php
Now you can call http://localhost:8000 to check your SilverStripe website.
Or, a bit more verbose, use https://github.com/assertchris/silverstripe-serve
which is a nice wrapper around this.
In case you also need a vanilla database with default pages, you can add the environment file in mysite/_config.php:
create the file ./_ss_environment.php:
define('SS_DATABASE_SERVER', 'localhost'); define('SS_DATABASE_USERNAME', 'root'); define('SS_DATABASE_PASSWORD', ''); define('SS_DATABASE_NAME', 'SS_Mysite'); define('SS_DEFAULT_ADMIN_USERNAME', 'admin'); define('SS_DEFAULT_ADMIN_PASSWORD', 'admin');
and run in the console:
framework/sake dev/build flush=1
If your user is allowed to create databases (for dev purposes on the local machine i simply use the root user) you will now have a new database with default pages.
When the project gets into serious development phase i would recommend to setup a real environment setup with apache/nginx with f.e docker. (Post on this is coming soon :))
One Reply to “SilverStripe with php built-in server”
RT @nerdpress_org: SilverStripe with php built-in server https://t.co/YSEz0voPD2 #silverstripe #php #dev
Comments are closed.