I cloned an existing laravel5
project from github repository. In my root using Mac terminal I ran composer install
I got out put of dependency installation and at some point when output reached
> php artisan clear-compiled
I got the following error
Fatal error: Cannot redeclare createDirIfNotExist() (previously declared in /Users/applebook/projects/referral-system/Laravel5/laravel/config/constants.php:14) in /Users/applebook/projects/referral-system/Laravel5/laravel/config/constants.php on line 20
Script php artisan clear-compiled handling the pre-update-cmd event returned with an error
I'm stuck here since past few hours, nothing is working out. any command artisan
, php artisan --version
composer update
is giving me same error.
Can anyone help me get through this ? Also if anybody suggest me a good tutorial setting up existing laravel5 project on mac os x
?
File under config/constants.php
have the following code:
//Ariel //define('FILE_PATH', "/Users/ariel_inter/git"); //define('INVOICES_PATH', FILE_PATH . "/invoices"); //define('PROFILE_PATH', FILE_PATH . "/profiles");
//Server define('FILE_PATH', "/var/www/files"); define('INVOICES_PATH', FILE_PATH . "/invoices"); define('PROFILE_PATH', FILE_PATH . "/profiles");
function createDirIfNotExist($pathDir, $octalPermissions) { $result = TRUE; if (!file_exists($pathDir)) { $result = mkdir($pathDir, $octalPermissions, TRUE); } return $result; }
function getContentTypeByExtensionFile($ext) { $result = "";
if($ext === 'pdf') {
return "application/pdf";
} else if($ext === 'png') {
return "image/png";
} else if($ext === 'jpg') {
return "image/jpeg";
} else if($ext === 'jpeg') {
return "image/jpeg";
}
return $result;
}`
From your error , i can suggest, the function createDirIfNotExist has been loaded more then once, here is some suggestions to fix it: