Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

return ss3 example to docs #9866

11 changes: 11 additions & 0 deletions docs/en/00_Getting_Started/01_Installation/03_Windows.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ See the [Composer documentation](https://getcomposer.org/doc/00-intro.md#install

Once you have installed the above, open a command line and use the following command to get a fresh copy of SilverStripe stable code installed into a 'silverstripe' sub-folder (note here we are using gitbash paths).

```shell
$ cd /c/wamp/www
$ composer create-project silverstripe/installer ./silverstripe
```

### Zip download
Expand Down Expand Up @@ -66,4 +69,12 @@ control.

Due to some changes to `mod_dir` in [Apache 2.4](http://httpd.apache.org/docs/current/mod/mod_dir.html#DirectoryCheckHandler) (precedence of handlers), index.php gets added to the URLs as soon as you navigate to the homepage of your site. Further requests are then handled by index.php rather than `mod_rewrite` (framework/main.php). To fix this place the following within the `mod_rewrite` section of your .htaccess file:

```apacheconf
<IfModule mod_rewrite.c>
# Turn off index.php handling requests to the homepage fixes issue in apache >=2.4
<IfModule mod_dir.c>
DirectoryIndex disabled
</IfModule>
# ------ #
</IfModule>
```
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,15 @@ Run the following command to install Xcode Command Line Tools.

```

Now you can install Homebrew itself:

```
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

```

## Install PHP

First we're telling Homebrew about some new repositories to get the PHP installation from:

```
Expand All @@ -32,11 +36,15 @@ First we're telling Homebrew about some new repositories to get the PHP installa

```

We're installing PHP 5.6 here, with the required `mcrypt` module:

```
brew install php55 php55-mcrypt
brew install php56 php56-mcrypt

```

There's a [Homebrew Troubleshooting](https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/Troubleshooting.md) guide if Homebrew doesn't work out as expected (run `brew update` and `brew doctor`).

Have a look at the [brew-php-switcher](https://github.com/philcook/brew-php-switcher)
project to install multiple PHP versions in parallel and switch between them easily.

Expand All @@ -51,11 +59,15 @@ project to install multiple PHP versions in parallel and switch between them eas

```

To start the database server on boot, run the following:

```
ln -sfv /usr/local/opt/mariadb/*.plist ~/Library/LaunchAgents

```

You can also use `mysql.server start` and `mysql.server stop` on demand.

## Configure PHP and Apache

We're not installing Apache, since OSX already ships with a perfectly fine installation of it.
Expand All @@ -69,10 +81,15 @@ and uncomment/add the following lines to activate the required modules:

```

Change the `DocumentRoot` setting to your user folder (replacing `<user>` with your OSX user name):
```

```
DocumentRoot "/Users/<user>/Sites"

```

Now find the section starting with `<Directory "/Library/WebServer/Documents">` and change it as follows,
again replacing `<user>` with your OSX user name:

```
Expand All @@ -84,6 +101,8 @@ again replacing `<user>` with your OSX user name:
</Directory>

```

We also recommend running the web server process with your own user on a development environment,
since it makes permissions easier to handle when running commands both
from the command line and through the web server. Find and adjust the following options,
replacing the `<user>` placeholder:
Expand All @@ -94,20 +113,27 @@ replacing the `<user>` placeholder:

```

Now start the web server:

```
sudo apachectl start

```

Every configuration change requires a restart:

```
sudo apachectl restart

```

You can also load this webserver on boot:

```
sudo launchctl load -w /System/Library/LaunchDaemons/org.apache.httpd.plist

```
After staring the webserver, you should see a simple "Forbidden" page generated by Apache
when accessing `http://localhost`.

## SilverStripe Installation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,17 @@ Vagrant downloads and sets up an entire operating system.
Most of this requires using only the command line and text editor or IDE.

Create a folder where your vagrant will be in and browse to the folder in the command line:

```shell
mkdir virtuallythere
cd virtuallythere
```

### Creating the Vagrantfile
Create/Browse to the folder you’ll be developing in:

```shell
vagrant init
```

In its current state, you could start the vagrant machine and it will run, but you won't be able to do much with it yet.
Expand All @@ -38,11 +45,17 @@ In its current state, you could start the vagrant machine and it will run, but y
Open the `Vagrantfile` that was created in your vagrant folder with your preferred text editor.

Look for the line which describes the box you are going to use:

```ruby
config.vm.box = "base"
```

This defines what pre-built Operating System the vagrant machine will be using. We'll be changing `base` to something closer to what we’d like, perhaps similar to your production server, you can find a range of boxes [listed here](https://atlas.hashicorp.com/search)

We've chosen to use `RHEL7.0`, but you can easily change it to suit your needs.

```ruby
config.vm.box = "box-cutter/centos70"
```

*Important*: Because this is redhat, the shell commands used later on will be using `yum install` instead of `apt-get install` for Debian based boxes.
Expand All @@ -52,23 +65,43 @@ Now we’ll add the vagrant machine to our computer’s private network, this wi
So this will be your own development environment!

To do that, look for this line:

```ruby
# config.vm.network "private_network", ip: "192.168.33.10"
```

First we’ll need to uncomment it, so delete only the `#` at the start of the line, then add a hostname IP address of your choice to use.

```ruby
config.vm.hostname = "virtuallythere.dev"
config.vm.network "privatenetwork", ip: "10.1.2.50"
```

### Syncing files
Next we’ll sync our website folder to the virtual machine, so it has the files needed to run SilverStripe. There are many different ways to do this, depending on your own preferences and possibly different boxes.

To keep things simple, we’re going to sync our vagrant folder to the virtual machine, so everything in your vagrant folder will be visible to the virtual machine.

Find this line:

```ruby
config.vm.synced_folder "../data", "/vagrant_data"
```

Then change to match this:

```ruby
config.vm.synced_folder ".", "/vagrant"
```

### Setting resources
This step is optional, but it is recommended to configure the virtual machine resources allocated to it, so it doesn’t take more resources than it should, something like this should be enough to start with:

```ruby
config.vm.provider "virtualbox" do |vb|
vb.memory = "1024"
vb.name = "virtuallythere"
end
```

*Important*: This is for Virtualbox again, change “virtualbox” to the virtual platform that you are using, you might need to make sure the setting `vb.memory` is supported by the platform you’re using because it may be different.
Expand All @@ -77,13 +110,36 @@ This step is optional, but it is recommended to configure the virtual machine re
Now we need to setup our environment using shell scripts, this will install software that you need for your server to be working and usable. You could even customise the setup to be closer like your production server.

For now find these lines:

```ruby
# config.vm.provision "shell", inline: <<-SHELL
# sudo apt-get update
# sudo apt-get install -y apache2
# SHELL
```

And modify it to call a shell script in your vagrant folder:

```ruby
config.vm.provision "shell", path: "setup.sh"
```

*Important*: We’re using shell script because we’re using a Linux server, please use the scripting language that your server environment supports.

Now to create the `setup.sh` file. This script will setup `php+modules`, `mariadb/mysql` and `apache`, the ones I had listed is the minimal required to get SilverStripe started and working out of the box.

```shell
yum update -y --disableplugin=fastestmirror
systemctl restart sshd
yum install -y httpd httpd-devel mod_ssl
yum -y install php php-common php-mysql php-pdo php-mcrypt* php-gd php-xml php-mbstring
echo "Include /vagrant/apache/*.conf" >> /etc/httpd/conf/httpd.conf
echo "date.timezone = Pacific/Auckland" >> /etc/php.ini
systemctl start httpd.service
systemctl enable httpd.service
yum install -y mariadb-server mariadb
systemctl start mariadb.service
systemctl enable mariadb.service
```

*Important*: Again, as noted above, this uses RHEL so `yum install` is used, please remember to change to `apt-get install` or other packaging tool as necessary.
Expand All @@ -92,15 +148,56 @@ Save `setup.sh` in the same folder as your Vagrantfile.

### Setting up Apache
If you inspect the script I’ve included above, you’ll notice this line:

```shell
echo "Include /vagrant/apache/*.conf" >> /etc/httpd/conf/httpd.conf
```

This will allow us to customise our apache, particularly the VirtualHost part

Earlier in the post, I had defined a hostname:

```ruby
config.vm.hostname = "virtuallythere.dev"
```
We’ll need to create a conf file for this hostname in a apache folder, create the folder first:

We’ll need to create a conf file for this hostname in an Apache folder, create the folder first:

```bash
mkdir apache
```

We'll save a `vagrant.conf` file in the newly created apache folder, and inside we’ll define the VirtualHost:

```apache
ServerRoot "/etc/httpd"
<Directory />
AllowOverride none
Require all denied
</Directory>
DocumentRoot "/vagrant/public"
<Directory "/vagrant/public">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
<VirtualHost *:80>
ServerName virtuallythere.dev
ServerAlias www.virtuallythere.dev
DocumentRoot /vagrant/public
LogLevel warn
ServerSignature Off
<Directory /vagrant/public>
Options +FollowSymLinks
Options -ExecCGI -Includes -Indexes
AllowOverride all
Require all granted
</Directory>
# SilverStripe specific
<LocationMatch assets/>
php_flag engine off
</LocationMatch>
</VirtualHost>
```

### Download SilverStripe
Expand All @@ -109,8 +206,10 @@ As mentioned above, you could install SilverStripe by [Composer](https://getcomp

### We’re ready for launch
That’s all! When that’s done, run:
```

```shell
vagrant up
```

If you've been following this guide, you can browse to http://virtuallythere.dev/install if you are using a new installation, or go to http://virtuallythere.dev if you are using an existing SilverStripe installation. If you've modified the hostname, follow the new hostname you've chosen.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ This is an op-code cacher which speeds up PHP execution on Windows.
php_tidy.dll

```

* Go to **Configure error reporting** and check **Development machine**
* Go to **Manage all settings** and set the following:

```
Expand All @@ -145,6 +147,8 @@ This is an op-code cacher which speeds up PHP execution on Windows.

```

Tweak the above values as necessary if your requirements differ.

## Folder permissions for PHP

Now we need to set up folder permissions for PHP. Open the php.ini and find the paths for sessions and file uploads. They will look like this:
Expand All @@ -155,6 +159,8 @@ Now we need to set up folder permissions for PHP. Open the php.ini and find the

```

Two other important folders to set the permissions on are `assets` and `silverstripe-cache` (if used) in your web root.

You will need to give **Modify** permission to **IUSR** user. To do it right click the folder and choose **Properties**. Then open the security tab, press **Edit** and add the **IUSR** user to the list by clicking the **Add** button. Afterwards tick **Modify** under **Allow** for that user. Repeat these steps for each folder.

![](../../../_images/iis7-iusr-permissions.jpg)
Expand Down Expand Up @@ -183,10 +189,12 @@ Inside the newly created _ss_environment.php file, insert the following code:

```

Insert the password you created for SQL Server earlier into the **SS_DATABASE_PASSWORD** field that is currently empty.

* Grab the latest stable version from here: http://www.silverstripe.org/stable-download
* Extract contents to **C:\inetpub\wwwroot\ss**

After gettng the code installed, make sure you set the folder permissions properly (see *Folder permissions for PHP* above).
After getting the code installed, make sure you set the folder permissions properly (see *Folder permissions for PHP* above).

## Install the SilverStripe SQL Server module ("mssql")

Expand Down
Loading