-
Notifications
You must be signed in to change notification settings - Fork 2
Installation (Unix Linux)
This page uses some paths as examples to explain where files could be located, depending on your system. These are:
/var/git/SmoothPHP
/var/git/MyOwnProject
/var/www/myproject
All examples in this document will follow these paths.
It is recommended to clone this GitHub repository as your working area.
For example,
# mkdir -p /var/git/
# cd /var/git/
# git clone https://github.com/Ikkerens/SmoothPHP.git
In most cases I recommend using symlinks to set up a separate directory as working directory. Your working directory will look somewhat like this:
- framework - Symlink to SmoothPHP/framework
-
public - Directory created upon installation
- .htaccess - Symlink to SmoothPHP/public/.htaccess
- index.php - Copied from SmoothPHP/public/index.php
- src - Symlink to your project directory.
- cache - Automatically generated by the framework
This layout can be achieved by executing the following commands.
# mkdir -p /var/www/myproject/
# cd /var/www/myproject/
# ln -s /var/git/SmoothPHP/framework
# ln -s /var/git/MyOwnProject src
# mkdir public
# cd public
# ln -s /var/git/SmoothPHP/public/.htaccess
# cp /var/git/SmoothPHP/public/index.php ./
This part assumes you already have a working apache environment on your system.
You will need these apache modules activated:
- mod_rewrite
You will need a minimal virtualhost to describe this project:
<VirtualHost *:80>
ServerName myproject.tld
ServerAlias www.myproject.tld
DocumentRoot /var/www/myproject/public
<Directory /var/www/myproject/public>
AllowOverride All
Order Allow,Deny
Allow from All
</Directory>
</VirtualHost
As you can see this config points to the public
directory of the working directory. Any other directories are not supposed to be accessed from the outside.
In a production environment there are some optional optimizations to be made. The two most notable:
- The php_apc(u) module - SmoothPHP takes full advantage of this module by caching runtime components of the framework.
-
The debug flag
- At the time of writing you can find the following line of code on index.php, line 14:
define('__ENV__', 'dev');
- By changing this parameter to 'prod', caching will be more aggressive on the framework. For example:
define('__ENV__', 'prod');
- The ENV define can hold 3 values:
- 'dev' - Disables almost all caching (except image resizing and template compilation)
- 'debug' - Has all caching methods enabled, but still outputs errors to the browser.
- 'prod' - Has all caching methods enabled, but will no longer output errors to the browser.
- At the time of writing you can find the following line of code on index.php, line 14:
This wiki is part of the SmoothPHP Project and is entirely licensed under The MIT License.