Preparation:
1. Install MySQL
Download from the official MySQL webpage is strongly recommended.
2. Set up PHP
This step requires the modification of two files: Apache2 configuration file and php.ini
.
These files can be edited using a terminal editor like vi or nano, or a simple text editor such as TextEdit or Atom.
a. Edit Apache2 configuration file:
Code Block |
---|
|
sudo vi /private/etc/apache2/httpd.conf |
b. Uncomment the following line:
Code Block |
---|
LoadModule php5_module libexec/apache2/libphp5.so |
c. If you can't locate the php.ini
file on your machine, it's probably under php.ini.default
. Create a new php.ini
file based on defaults:
Code Block |
---|
|
sudo cp /private/etc/php.ini.default /private/etc/php.ini |
d. Open the file in a text editor (in this example, in vi):
Code Block |
---|
|
sudo vi /private/etc/php.ini |
e. Locate date.timezone
and pdo_mysql.default_socket
and provide them with values as in the example below:
Code Block |
---|
date.timezone = "Europe/Warsaw"
pdo_mysql.default_socket = /tmp/mysql.sock |
f. Increase memory_limit
value for eZ Platform:
Code Block |
---|
memory_limit = 4G |
3. Set up virtual host and start Apache2
a. Edit Apache2 configuration file:
Code Block |
---|
|
sudo vi /private/etc/apache2/httpd.conf |
b. Uncomment and modify the following lines:
Code Block |
---|
LoadModule vhost_alias_module libexec/apache2/mod_vhost_alias.so
LoadModule rewrite_module libexec/apache2/mod_rewrite.so |
c. Comment the following line:
Code Block |
---|
Include /private/etc/apache2/extra/httpd-vhosts.conf |
d. Add the following line to the file:
Code Block |
---|
Include /private/etc/apache2/users/*.conf |
e. Change permissions for virtual hosts storage directory (775):
Code Block |
---|
sudo chmod -R 775 /private/etc/apache2/users
sudo chmod 775 /private/etc/apache2 |
4.
Edit hosts fileThis step is allows you to use ez1.lh as an address to access running Platform from a web browser. You can substitute the address with the address you intend to use to access your installation (remember to change it in all other command on this page as well):
Code Block |
---|
|
sudo vi /private/etc/hosts |
a. Add host name redirection:
Code Block |
---|
127.0.0.1 ez1.lh |
5. Start Apache2 daemon using terminal
Code Block |
---|
|
sudo apachectl start |
65. Install Composer globally
Composer is a dependency manager that allows you to install packages directly in the project. It is also checking all packages' versions on a regular basis to make sure they are up-to-date and to avoid inconsistencies.
Code Block |
---|
|
curl -sS https://getcomposer.org/installer | php
mkdir -p /usr/local/bin
mv php -d memory_limit=-1 composer.phar /usr/local/bin/composer |
7Create new database (you can substitute ez1
with the database name you want to use):
Code Block |
---|
|
/usr/local/mysql/bin/mysql -u root -e 'create database ez1;' |
87. Install Brew package manager
Brew is a package manager for OS X, if you haven't used it already you are going to love what it does!
Code Block |
---|
|
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" |
9a. Install PEAR/PECL extension:
Code Block |
---|
|
cd /usr/lib/php
curl -O https://pear.php.net/go-pear.phar
php -d detect_unicode=0 go-pear.phar
sudo php install-pear-nozlib.phar
sudo pear channel-update pear.php.net
sudo pecl channel-update pecl.php.net
sudo pear upgrade-all
sudo pear config-set auto_discover 1 |
b. Install autoconf:
Code Block |
---|
|
brew install autoconf |
c. Install intl:
Code Block |
---|
|
brew install icu4c
sudo pecl install intl |
d. The path to the ICU libraries and headers is: /usr/local/opt/icu4c/
.
Edit /private/etc/php.ini
and add following line:
Code Block |
---|
|
extension=intl.so |
e. Enable opcache extension for PHP (suggested, but not required) by adding:
Code Block |
---|
|
zend_extension=opcache.so |
Installation:
10a. Go to the folder with your installation and set up directory permissions:
Code Block |
---|
|
chmod 775 ../ez1.lh
chmod 775 ../../workspace
chmod 775 ../../../Documents |
b. Clone eZ Platform repository:
Code Block |
---|
|
git clone https://github.com/ezsystems/ezplatform.git |
c. Check out the latest stable version (e.g. v1.0.1) or skip this step to use latest dev release from master branch. To see the list of all available tags type git tag
.
Code Block |
---|
|
git checkout v1.0.1 |
d
b. Download archive from share.ez.no/downloads. Extract the eZ Platform archive to a directory, then execute post install scripts.
Code Block |
---|
cd /<directory>/
php -d memory_limit=-1 composer.phar run-script post-install-cmd |
c. Copy the virtual host template:
Code Block |
---|
|
sudo cp doc/apache2/vhost.template /private/etc/apache2/users/ez1.lh.conf |
ed. Edit the new virtual host:
Code Block |
---|
|
sudo vi /private/etc/apache2/users/ez1.lh.conf |
fe. Modify virtual host file based on dev environment (or use template below): vhost.template.
Replace the ---USER_ID---
variable (used in lines 10 and 17) with your current user ID. Use whoami
command to get effective user ID of the currently logged user. If you want to use the default virtual host template (delivered with eZ Platform package) all you have to do is set up lines 7, 8, 9, 10, 17, 25 and 33:
Code Block |
---|
# Official VirtualHost configuration for Apache 2.x
# Note: This is meant to be tailored for your needs, expires headers might for instance not work for dev.
# Params: %IP_ADDRESS%, %PORT%, %HOST%, %HOST_ALIAS%, %BASEDIR%, %ENV% and %PROXY%
# NameVirtualHost %IP_ADDRESS%
<VirtualHost *:80>
ServerName ez1.lh
ServerAlias ez1.lh
DocumentRoot "/Users/ ---USER_ID--- /Documents/workspace/ez1.lh/web"
DirectoryIndex app.php
# Enabled for Dev environment
# LogLevel debug
# "web" folder is what we expose to the world, all rewrite rules further down is relative to it.
<Directory "/Users/ ---USER_ID--- /Documents/workspace/ez1.lh/web">
# If using php configured in FastCGI mode, you might also need to add "ExecCGI" to the line below
Options FollowSymLinks
AllowOverride None
# depending on your global Apache settings, you may need to uncomment and adapt:
# for Apache 2.2 and earlier:
#Allow from all
# for Apache 2.4:
Require all granted
</Directory>
## eZ Platform ENVIRONMENT variables, used for customizing app.php execution (not used by console commands)
# Environment.
# Possible values: "prod" and "dev" out-of-the-box, other values possible with proper configuration
# Defaults to "prod" if omitted (uses SetEnvIf so value can be used in rewrite rules)
SetEnvIf Request_URI ".*" SYMFONY_ENV=dev
# Whether to use custom ClassLoader (autoloader) file
# Needs to be a valid path relative to root web/ directory
# Defaults to bootstrap.php.cache, or autoload.php in debug
#SetEnv SYMFONY_CLASSLOADER_FILE "../app/autoload.php"
# Whether to use debugging.
# Possible values: 0 or 1
# Defaults to 0 if omitted, unless SYMFONY_ENV is set to: "dev"
SetEnv SYMFONY_DEBUG %USE-DEBUGGING%
# Whether to use Symfony's HTTP Caching.
# Disable it if you are using an external reverse proxy (e.g. Varnish)
# Possible values: 0 or 1
# Defaults to 1 if omitted, unless SYMFONY_ENV is set to: "dev"
#SetEnv SYMFONY_HTTP_CACHE 1
# Whether to use custom HTTP Cache class if SYMFONY_HTTP_CACHE is enabled
# Value must be a autoloadable cache class
# Defaults to to use "AppCache"
#SetEnv SYMFONY_HTTP_CACHE_CLASS "\Vendor\Project\MyCache"
# Defines the proxies to trust.
# Separate entries by a comma
# Example: "proxy1.example.com,proxy2.example.org"
# By default, no trusted proxies are set
#SetEnv SYMFONY_TRUSTED_PROXIES "%PROXY%"
<IfModule mod_rewrite.c>
RewriteEngine On
# For FastCGI mode or when using PHP-FPM, to get basic auth working.
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Needed for ci testing, you can optionally remove this.
RewriteCond %{ENV:SYMFONY_ENV} "behat"
RewriteCond %{REQUEST_URI} ^/php5-fcgi(.*)
RewriteRule . - [L]
# Cluster/streamed files rewrite rules. Enable on cluster with DFS as a binary data handler
#RewriteRule ^/var/([^/]+/)?storage/images(-versioned)?/.* /app.php [L]
RewriteRule ^/var/([^/]+/)?storage/images(-versioned)?/.* - [L]
# Makes it possible to place your favicon at the root of your eZ Platform instance.
# It will then be served directly.
RewriteRule ^/favicon\.ico - [L]
# Uncomment the line below if you want your favicon be served from the standard design.
# You can customize the path to favicon.ico by bundle name and/or path.
#RewriteRule ^/favicon\.ico /bundles/my-bundle/images/favicon.ico [L]
# Give direct access to robots.txt for use by crawlers (Google, Bing, Spammers...)
RewriteRule ^/robots\.txt - [L]
# Platform for Privacy Preferences Project ( P3P ) related files for Internet Explorer
# More info here : http://en.wikipedia.org/wiki/P3p
RewriteRule ^/w3c/p3p\.xml - [L]
# The following rule is needed to correctly display assets from eZ Platform / Symfony bundles
RewriteRule ^/bundles/ - [L]
# Additional Assetic rules for environments different from dev,
# remember to run php app/console assetic:dump --env=prod
RewriteCond %{ENV:SYMFONY_ENV} !^(dev)
RewriteRule ^/(css|js|font)/.*\.(css|js|otf|eot|ttf|svg|woff) - [L]
RewriteRule .* /app.php
</IfModule>
# Everything below is optional to improve performance by forcing
# clients to cache image and design files, change the expires time
# to suite project needs.
<IfModule mod_expires.c>
<LocationMatch "^/var/[^/]+/storage/images/.*">
# eZ Platform appends the version number to image URL (ezimage
# datatype) so when an image is updated, its URL changes too
ExpiresActive on
ExpiresDefault "now plus 10 years"
</LocationMatch>
</IfModule>
</VirtualHost> |
g. f. Restart Apache 2 server:
Code Block |
---|
|
sudo apachectl restart |
hg. Install required dependencies using Composer:
Code Block |
---|
|
composer install |
When Composer asks you for the token you must log in to your GitHub account and edit your profile. Go to the Personal access tokens link and Generate new token with default settings. Be aware that the token will be shown only once, so do not refresh the page until you paste the token into Composer prompt. This operation is performed only once when you install eZ Platform for the first time.
ih. Change directory permissions:
Code Block |
---|
|
rm -rf app/cache/* app/logs/*
sudo chmod +a "_www allow delete,write,append,file_inherit,directory_inherit" app/{cache,logs,config} web
sudo chmod +a "`whoami` allow delete,write,append,file_inherit,directory_inherit" app/{cache,logs,config} web |
ji. Install eZ Platform:
Code Block |
---|
php app/console ezplatform:install clean |
You will be able to see your page under http://ez1.lh (or the address you chose in preparation). Please note that a clean install of eZ Platform doesn’t include DemoBundle anymore.
1110. Optional
a. Install PHP 5.6 with opcache extension:
Code Block |
---|
|
brew install -v homebrew/php/php56
chmod -R ug+w $(brew --prefix php56)/lib/php
brew install -v php56-opcache |
b. Add proper date.timezone
settings:
Code Block |
---|
|
sudo vi /usr/local/etc/php/5.6/php.ini |
c. Uncomment and modify:
Code Block |
---|
date.timezone = "Europe/Warsaw"
(…)
Increase memory_limit value for eZ Platform:
memory_limit = 4G
(…)
|
d. Disable errors showing:
Code Block |
---|
display_errors = Off |
e. Change default PHP parser used by Apache:
Code Block |
---|
|
sudo vi /private/etc/apache2/httpd.conf |
f. Find and comment the following line:
Code Block |
---|
# LoadModule php5_module libexec/apache2/libphp5.so |
g. Add below:
Code Block |
---|
|
LoadModule php5_module /usr/local/opt/php56/libexec/apache2/libphp5.so |
e. Install intl extension for PHP 5.6:
Code Block |
---|
|
brew install php56-intl |
f. Restart Apache:
Code Block |
---|
|
sudo apachectl restart |