mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Updated MAMP install docs, added Homebrew install docs
* Removed the `php.ini` configuration bits from both MAMP and Homebrew instructions, both actually come with reasonable defaults now (high `memory_limit`, `error_reporting` on full, `date.timezone` set). * Removed chapter about package install, we should favour composer now * Compressed the install wizard instructions
This commit is contained in:
parent
83a3c4b166
commit
27727df096
@ -1,75 +1,49 @@
|
||||
# Mac OSX
|
||||
# Mac OSX with MAMP
|
||||
|
||||
This topic covers setting up your Mac as a Web Server and installing SilverStripe.
|
||||
This topic covers setting up your Mac as a web server and installing SilverStripe.
|
||||
|
||||
While OSX Comes bundled with PHP and Apache (Thanks Apple!) Its not quite ideal for SilverStripe so for setting up a
|
||||
webserver on OSX we suggest using [MAMP](http://www.mamp.info/en/index.php) or using [MacPorts](http://www.macports.org/)
|
||||
to manage your packages.
|
||||
OSX comes bundled with PHP and Apache, but you're stuck with the versions it ships with.
|
||||
It is also a bit harder to install additional PHP modules required by SilverStripe.
|
||||
[MAMP](http://www.mamp.info/en/) is a simple way to get a complete webserver
|
||||
environment going on your OSX machine, without removing or altering any system-level configuration.
|
||||
|
||||
If you want to use the default OSX PHP version then you will need to recompile your own versions of PHP with GD. Providing instructions
|
||||
for how to recompile PHP is beyond the scope of our documentation but try an online search.
|
||||
Check out the [MAC OSX with Homebrew](other_installation_options/Mac_OSX_Homebrew)
|
||||
for an alternative, more configurable installation process.
|
||||
|
||||
## Installing MAMP
|
||||
## Requirements
|
||||
|
||||
If you have decided to install using MacPorts you can skip this section.
|
||||
Please check the [system requirements](http://www.mamp.info/en/documentation/) for MAMP,
|
||||
you'll need a fairly new version of OSX to run it.
|
||||
|
||||
Once you have downloaded and Installed MAMP start the Application and Make sure everything is running by clicking the
|
||||
MAMP icon. Under `Preferences -> PHP` make sure Version 5 is Selected.
|
||||
## MAMP Installation
|
||||
|
||||
Open up `/Applications/MAMP/conf/PHP5/php.ini` and make the following configuration changes:
|
||||
* [Download MAMP](http://www.mamp.info/en/)
|
||||
* Install and start MAMP
|
||||
* Check out your new web server environment on `http://localhost:8888`
|
||||
|
||||
memory_limit = 64M
|
||||
## SilverStripe Installation
|
||||
|
||||
Once you make that change open the MAMP App Again by clicking on the MAMP Icon and click Stop Servers then Start
|
||||
Servers - this is so our changes to the php.ini take effect.
|
||||
[Composer](http://getcomposer.org) is a dependancy manager for PHP, and the preferred way to
|
||||
install SilverStripe. It ensures that you get the correct set of files for your project.
|
||||
Composer uses your MAMP PHP executable to run and also requires [git](http://git-scm.com)
|
||||
to automatically download the required files from GitHub and other repositories.
|
||||
|
||||
## Installing SilverStripe
|
||||
In order to install Composer, we need to let the system know where to find the PHP executable.
|
||||
Open or create the `~/.bash_profile` file in your home folder, then add the following line:
|
||||
`export PATH=/Applications/MAMP/bin/php/php5.5.22/bin:$PATH`
|
||||
You'll need to adjust the PHP version number (`php5.5.22`). The currently running PHP version is shown on `http://localhost:8888/MAMP/index.php?page=phpinfo`.
|
||||
Run `source ~/.bash_profile` for the changes to take effect. You can verify that the correct executable
|
||||
is used by running `which php`. It should show the path to MAMP from above.
|
||||
|
||||
### Composer
|
||||
[Composer (a dependancy manager for PHP)](http://getcomposer.org) is the preferred way to install SilverStripe and ensure you get the correct set of files for your project.
|
||||
Now you're ready to install Composer: Run `curl -sS https://getcomposer.org/installer | php`.
|
||||
We recommend that you make the `composer` executable available globally,
|
||||
which requires moving the file to a different folder. Run `mv composer.phar /usr/local/bin/composer`.
|
||||
More detailed installation instructions are available on [getcomposer.org](https://getcomposer.org/doc/00-intro.md#installation-linux-unix-osx).
|
||||
You can verify the installation by typing the `composer` command, which should show you a command overview.
|
||||
|
||||
Composer uses your MAMP PHP executable to run and also requires [git](http://git-scm.com) (so it can automatically download the required files from GitHub).
|
||||
Finally, we're ready to install SilverStripe through composer:
|
||||
`composer create-project silverstripe/installer /Applications/MAMP/htdocs/silverstripe/`.
|
||||
After finishing, the installation wizard should be available at `http://localhost:8888/silverstripe`.
|
||||
The MAMP default database credentials are user `root` and password `root`.
|
||||
|
||||
#### Install composer using MAMP
|
||||
1. First create an alias for our bash profile, using your preferred terminal text editor (nano, vim, etc) open `~/.bash_profile`.
|
||||
|
||||
2. Add the following line (adjusting the version number of PHP to your installation of MAMP): `alias phpmamp='/Applications/MAMP/bin/php/php5.4.10/bin/php'`.
|
||||
|
||||
3. The run `. ~/.bash_profile` to reload the bash profile and make it accessible.
|
||||
|
||||
4. This will create an alias, `phpmamp`, allowing you to use the MAMP installation of PHP. Please take note of the PHP version, in this case 5.4.10, as with different versions of MAMP this may be different. Check your installation and see what version you have, and replace the number accordingly (this was written with MAMP version 2.1.2).
|
||||
|
||||
5. With that setup, we are ready to install `composer`. This is a two step process if we would like this to be installed globally (only do the first step if you would like `composer` installed to the local working directory only).
|
||||
- First, run the following command in the terminal: `curl -sS https://getcomposer.org/installer | phpmamp`
|
||||
|
||||
We are using `phpmamp` so that we correctly use the MAMP installation of PHP from above.
|
||||
|
||||
- Second, if you want to make composer available globally, we need to move the file to '/usr/local/bin/composer'. To do this, run the following command:
|
||||
`sudo mv composer.phar /usr/local/bin/composer`
|
||||
|
||||
Terminal will ask you for your root password, after entering it and pressing the 'return' (or enter) key, you'll have a working global installation of composer on your mac that uses MAMP.
|
||||
|
||||
6. You can verify your installation worked by typing the following command:
|
||||
`composer`
|
||||
It'll show you the current version and a list of commands you can use.
|
||||
|
||||
7. Run the following command to get a fresh copy of SilverStripe via composer:
|
||||
|
||||
`composer create-project silverstripe/installer /Applications/MAMP/htdocs/silverstripe/`
|
||||
|
||||
8. You can now [use composer](http://doc.silverstripe.org/framework/en/getting_started/composer/) to manage future SilverStripe updates and adding modules with a few easy commands.
|
||||
|
||||
|
||||
### Package Download
|
||||
|
||||
[Download](http://silverstripe.org/software/download/) the latest SilverStripe installer package. Copy the tar.gz or zip file to the 'Document Root' for MAMP - By Default its `/Applications/MAMP/htdocs`.
|
||||
Don't know what your Document Root is? Open MAMP Click `Preferences -> Apache`.
|
||||
|
||||
Extract the tar.gz file to a folder, e.g. `silverstripe/` (you always move the tar.gz file first and not the other way
|
||||
around as SilverStripe uses a '.htaccess' file which is hidden from OSX so if you move SilverStripe the .htaccess file
|
||||
won't come along.
|
||||
|
||||
### Run the installation wizard
|
||||
Once you have a copy of the required code (by either of the above methods), open your web browser and go to `http://localhost:8888/silverstripe/`. Enter your database details - by default with MAMP its user `root` and password `root` and select your account details. Click "Check Details".
|
||||
|
||||
Once everything is sorted hit "Install!" and Voila, you have SilverStripe installed
|
||||
We have a separate in-depth tutorial for [Composer Installation and Usage](composer).
|
@ -0,0 +1,118 @@
|
||||
# Mac OSX with Homebrew
|
||||
|
||||
This topic covers setting up your Mac as a web server and installing SilverStripe.
|
||||
|
||||
OSX comes bundled with PHP, but you're stuck with the version and modules it ships with.
|
||||
If you run projects on different PHP versions, or care about additional PHP module support
|
||||
and other dependencies such as MariaDB, we recommend an installation through [Homebrew](http://brew.sh/).
|
||||
|
||||
Check out the [MAC OSX with MAMP](../Mac_OSX) for an alternative installation process
|
||||
which packages up the whole environment into a convenient application.
|
||||
|
||||
## Requirements
|
||||
|
||||
Since we're compiling PHP, some build tooling is required.
|
||||
Run the following command to install Xcode Command Line Tools.
|
||||
|
||||
xcode-select --install
|
||||
|
||||
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:
|
||||
|
||||
brew tap homebrew/dupes
|
||||
brew tap homebrew/php
|
||||
|
||||
We're installing PHP 5.5 here, with the required `mcrypt` module:
|
||||
|
||||
brew install php55 php55-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.
|
||||
|
||||
## Install the Database (MariaDB/MySQL)
|
||||
|
||||
brew install mariadb
|
||||
unset TMPDIR
|
||||
mysql_install_db --user=`whoami` --basedir="$(brew --prefix mariadb)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
|
||||
mysql.server start
|
||||
'/usr/local/opt/mariadb/bin/mysql_secure_installation'
|
||||
|
||||
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.
|
||||
|
||||
Edit the existing configuration at `/etc/apache2/httpd.conf`,
|
||||
and uncomment/add the following lines to activate the required modules:
|
||||
|
||||
LoadModule rewrite_module libexec/apache2/mod_rewrite.so
|
||||
LoadModule php5_module /usr/local/opt/php55/libexec/apache2/libphp5.so
|
||||
|
||||
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:
|
||||
|
||||
<Directory "/Users/<user>/Sites">
|
||||
Options FollowSymLinks Multiviews
|
||||
MultiviewsMatch Any
|
||||
AllowOverride All
|
||||
Require all granted
|
||||
</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:
|
||||
|
||||
User <user>
|
||||
Group staff
|
||||
|
||||
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 starting the webserver, you should see a simple "Forbidden" page generated by Apache
|
||||
when accessing `http://localhost`.
|
||||
|
||||
## SilverStripe Installation
|
||||
|
||||
[Composer](http://getcomposer.org) is a dependancy manager for PHP, and the preferred way to
|
||||
install SilverStripe. It ensures that you get the correct set of files for your project.
|
||||
Composer uses the PHP executable we've just installed. It also needs [git](http://git-scm.com)
|
||||
to automatically download the required files from GitHub and other repositories.
|
||||
|
||||
Run `curl -sS https://getcomposer.org/installer | php` to install the `composer` executable.
|
||||
We recommend that you make the executable available globally,
|
||||
which requires moving the file to a different folder. Run `mv composer.phar /usr/local/bin/composer`.
|
||||
More detailed installation instructions are available on [getcomposer.org](https://getcomposer.org/doc/00-intro.md#installation-linux-unix-osx).
|
||||
You can verify the installation by typing the `composer` command, which should show you a command overview.
|
||||
|
||||
Finally, we're ready to install SilverStripe through composer:
|
||||
`composer create-project silverstripe/installer /Users/<user>/Sites/silverstripe/`.
|
||||
After finishing, the installation wizard should be available at `http://localhost/silverstripe`.
|
||||
The Homebrew MariaDB default database credentials are user `root` and password `root`.
|
||||
|
||||
We have a separate in-depth tutorial for [Composer Installation and Usage](composer).
|
@ -37,8 +37,7 @@ For more flexibility, you can set up either of the following web servers, and us
|
||||
Mac OS X comes with a built-in webserver, but there are a number of other options:
|
||||
|
||||
* [Install using MAMP](installation/mac_osx)
|
||||
* Install using the built-in webserver (no docs yet)
|
||||
* Install using MacPorts (no docs yet)
|
||||
* [Install using Homebrew](installation/other_installation_options/mac_osx_homebrew)
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user