Created
January 15, 2014 13:50
-
-
Save itudoben/8436575 to your computer and use it in GitHub Desktop.
Way to set up the Yii framework using environment variable in the <yii project>/protected/config/main.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// The path where to put all the logs for the API. | |
// For instance on OSX environment this would be setup as: export YII_PATH_LOG=/var/log | |
$yii_path_log = getenv('YII_PATH_LOG'); | |
if(!$yii_path_log) { | |
echo 'No YII_PATH_LOG set in user environment.'; | |
exit; | |
} | |
// The path where all the files like sessions, etc are stored during runtime. | |
// On OSX env: export YII_PATH_RUNTIME=/Library/WebServer/api_runtime | |
$yii_path_runtime = getenv('YII_PATH_RUNTIME'); | |
if(!$yii_path_runtime) { | |
echo 'No YII_PATH_RUNTIME set in user environment.'; | |
exit; | |
} | |
// The path where all the files like sessions, etc are stored during runtime. | |
// On OSX env: export YII_PATH_RUNTIME=/Library/WebServer/api_runtime | |
$yii_path_assets = getenv('YII_PATH_ASSETS'); | |
if(!$yii_path_assets) { | |
echo 'No YII_PATH_ASSETS set in user environment.'; | |
exit; | |
} | |
// uncomment the following to define a path alias | |
// Yii::setPathOfAlias('local','path/to/local-folder'); | |
// This is the main Web application configuration. Any writable | |
// CWebApplication properties can be configured here. | |
// Use it here to re define the runtime path | |
return array( | |
'basePath' => dirname(__FILE__) . DIRECTORY_SEPARATOR . '..', | |
'name' => 'my REST API', | |
'runtimePath' => getenv('YII_PATH_RUNTIME'), | |
(...) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment