dongxu8533486 2016-02-01 12:38
浏览 221

php artisan clear-compiled失败

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;

}`

  • 写回答

1条回答 默认 最新

  • dongtu7567 2016-02-01 14:26
    关注

    From your error , i can suggest, the function createDirIfNotExist has been loaded more then once, here is some suggestions to fix it:

    1. global search function createDirIfNotExist from all you project, if you find other files contains this function , only keep one in your project,
    2. if above didn't solve you problem, you need to debug where this file (which have function createDirIfNotExist) been include, then try fix it to include_once/require_once.
    3. cut function createDirIfNotExist to a helper function,laravel create helper function
    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog