×ܽáһЩ³£¼ûLaravel¹ýʧ¼°Æä½â¾ö¼Æ»®
laravelÊÇÒ»¿î¹ãÊܽӴý¡¢Ò×ÓÚʹÓÃÇÒ¹¦Ð§Ç¿Ê¢µÄphp¿ò¼Ü¡£Ëü´øÀ´ÁËÐí¶à±ãµ±µÄ¹¦Ð§£¬ÒÔ¼°ÄÚÖõĹýʧ±¨¸æϵͳ£¬Ê¹µÃ¿ª·¢Ö°Ô±¿ÉÒÔ¿ìËÙ·¢Ã÷Ï¢Õù¾öÎÊÌâ¡£µ«×ÝÈ»ÔÆÔÆ£¬ÈÔÈ»»á·ºÆðһЩ³£¼û¹ýʧ£¬ÏÂÃæÊÇһЩ³£¼ûlaravel¹ýʧ¼°Æä½â¾ö¼Æ»®¡£
δÕÒµ½Ó¦ÓóÌÐòÃÜÔ¿
ÔÚÔËÐÐLaravelÓ¦ÓóÌÐòʱ£¬¿ÉÄ᷺ܻÆð¹ýʧÐÂÎÅ£º¡°Î´ÕÒµ½Ó¦ÓóÌÐòÃÜÔ¿¡±¡£ ÕâÊÇÓÉÓÚLaravel²»ÊÇĬÈÏÌìÉúÓ¦ÓóÌÐòÃÜÔ¿µÄ¡£ÎªÁËÐÞ¸´´Ë¹ýʧ£¬ÇëÔÚÄúµÄÖÕ¶ËÖÐʹÓÃÒÔÏÂÏÂÁîÌìÉúÃÜÔ¿£º
php artisan key: generate
µÇ¼ºó¸´ÖÆ
Õ⽫ÌìÉúÒ»¸öеÄÓ¦ÓóÌÐòÃÜÔ¿²¢Ìí¼Óµ½ÄúµÄ.envÎļþÖС£
Class ‘App\Http\Controllers\ExampleController’ not found
ÓÐʱ¼ä£¬Äú¿ÉÄÜ»áÔÚä¯ÀÀÆ÷Öп´µ½ÀàδÕÒµ½µÄ¹ýʧÐÂÎÅ£¬ÀýÈç¡°Class ‘App\Http\Controllers\ ExampleController’ not found¡±¡£ ÕâÒâζ×ÅLaravelÎÞ·¨ÕÒµ½ÄúʵÑé»á¼ûµÄ¿ØÖÆÆ÷¡£¼ì²éÄúµÄ¿ØÖÆÆ÷ÎļþÃûÒÔ¼°ÀàÉùÃ÷Ãû³ÆÊÇ·ñ׼ȷ¡£
SQLSTATE [HY000] [1045] »á¼û±»¾Ü¾ø
µ±ÄãÔËÐÐÏñmigrate»òseedÕâÑùµÄÏÂÁîʱ£¬Äã¿ÉÄÜ»áÓöµ½ÕâÑùµÄ¹ýʧ£º
SQLSTATE [HY000] [1045] Access denied for user 'homestead'@'localhost' (using password: YES)
µÇ¼ºó¸´ÖÆ
ÕâÊÇÓÉÓÚÔÚÄúµÄÊý¾Ý¿âÉèÖÃÖÐÉèÖÃÁ˹ýʧµÄƾ֤¡£¼ì²éÄúµÄ.envÎļþÖеÄÊý¾Ý¿âƾ֤²¢È·±£ËüÃÇÊÇ׼ȷµÄ¡£
ÀàûÓÐÒªÁì
LaravelµÄ°æ±¾¸üпÉÄܻᵼÖÂһЩ¾ÉµÄº¯Êý»òÒªÁì¹ýʱ»òÒѱ»ÖØÃüÃû¡£ÈôÊÇÄúÔÚ´úÂëÖÐʹÓÃÒÑÆúÓõÄÒªÁ죬Ôò¿ÉÄÜ»áÓöµ½¹ýʧÐÂÎÅ¡°ÀàûÓÐÒªÁ족¡£ ½â¾ö´ËÎÊÌâµÄ×î¼ÑÒªÁìÊÇÉó²éLaravelÎĵµ£¬ÏàʶÄÄЩҪÁì±»ÆúÓã¬ÒÔ¼°ÄÄЩҪÁì¿ÉÒÔÈ¡´úËüÃÇ¡£
ÎÞ·¨¶ÁÈ¡ÉèÖÃÎļþ
ÔÚһЩÇéÐÎÏ£¬Äú¿ÉÄÜ»áÓöµ½¹ýʧÐÂÎÅ¡°ÎÞ·¨¶ÁÈ¡ÉèÖÃÎļþ¡±£¬Õâͨ³£ÊÇÓÉÓÚȨÏÞÎÊÌâÒýÆðµÄ¡£ÇëÈ·±£ÄúµÄ.envÎļþÒÑ׼ȷÉèÖÃȨÏÞ¡£Äú¿ÉÒÔʹÓÃÒÔÏÂÏÂÁî¸ü¸ÄÎļþȨÏÞ£º
chmod 644 .env
µÇ¼ºó¸´ÖÆ
×Ô¶¯¼ÓÔØÀàʱÍÉ»¯
LaravelʹÓÃComposer×Ô¶¯¼ÓÔØÒÀÀµÏî¡£ÈôÊÇÄúÓöµ½ÁË¡°×Ô¶¯¼ÓÔØÀàʱÍÉ»¯¡±ÕâÑùµÄ¹ýʧÐÂÎÅ£¬Ôò¿ÉÄÜÊÇÓÉÓÚÒýÓùýʧµÄÃüÃû¿Õ¼äÔì³ÉµÄ¡£Çë¼ì²éÄúµÄ´úÂëÖеÄÃüÃû¿Õ¼äÊÇ·ñ׼ȷ¡£
ÒªÁìδ½ç˵
ÈôÊÇÄúÔÚLaravelÓ¦ÓóÌÐòÖÐʵÑéŲÓÃδ½ç˵µÄÒªÁ죬Ôò»á¿´µ½¡°ÒªÁìδ½ç˵¡±µÄ¹ýʧÐÂÎÅ¡£µ±ÄúʵÑéÔÚδµ¼ÈëÃüÃû¿Õ¼äµÄ¿ØÖÆÆ÷ÖÐŲÓÃÄ£×Óʱ£¬Õâ¿ÉÄܻᱬ·¢¡£
È·±£ÄúÒѽ«×¼È·µÄÃüÃû¿Õ¼äµ¼Èëµ½ÄúµÄ¿ØÖÆÆ÷»òÈκÎÐèҪŲÓøÃÒªÁìµÄÎļþÖС£
ÎÞ·¨·¿ªÁ÷
ÄúµÄLaravelÓ¦ÓóÌÐò¿ÉÄÜ»áÔÚʵÑé·¿ªÎļþ»òĿ¼ʱÅ׳ö¡°ÎÞ·¨·¿ªÁ÷¡±µÄ¹ýʧÐÂÎÅ¡£Õâͨ³£ÊÇÓÉÓÚûÓÐÐëÒªµÄÎļþ»òĿ¼ȨÏÞÒýÆðµÄ¡£Òª½â¾ö´ËÎÊÌ⣬¿ÉÒÔ¸ü¸ÄÏìÓ¦µÄÎļþ»òĿ¼ȨÏÞ£¬ÒÔÈ·±£ËüÃǿɶÁ¿Éд£º
chmod -R 777 storage/
µÇ¼ºó¸´ÖÆ
ЧÀÍÆ÷ÄÚ²¿¹ýʧ
¡°Ð§ÀÍÆ÷ÄÚ²¿¹ýʧ¡±ÊÇ×î³£¼ûµÄ¹ýʧ֮һ¡£Õâͨ³£ÊÇÓÉÓÚÄÚ²¿´úÂë»òÉèÖùýʧÒýÆðµÄ¡£Òª½â¾ö´ËÎÊÌ⣬¿ÉÒÔ¼ì²éÄúµÄLaravelÈÕÖ¾Îļþ»òÆôÓõ÷ÊÔģʽÒÔ»ñµÃ¸üÏêϸµÄ¹ýʧÐÂÎÅ¡£
´¦Àí³ÌÐòÀàûÓйýʧ´¦Àí³ÌÐò
Äú¿ÉÄÜ»áÔÚÓ¦ÓóÌÐòÖп´µ½¡°´¦Àí³ÌÐòÀàûÓйýʧ´¦Àí³ÌÐò¡±µÄ¹ýʧÐÂÎÅ£¬ÕâÒâζ×ÅÓ¦ÓóÌÐòÎÞ·¨ÕÒµ½ÓÃÓÚ´¦ÀíÌض¨¹ýʧµÄ¹ýʧ´¦Àí³ÌÐò¡£È·±£ÄúµÄ¹ýʧ´¦Àí³ÌÐòÀàÓëApp\Exceptions\Handler¼æÈݲ¢°üÀ¨report()ºÍrender()ÒªÁì¡£
×ÜÖ®£¬ÕâÊÇһЩLaravel¿ª·¢Àú³ÌÖпÉÄÜÓöµ½µÄ³£¼û¹ýʧ¼°Æä½â¾öÒªÁ졣ͨ¹ýÔĶÁLaravelÎĵµ¡¢Éó²é¹ýʧÐÂÎź͵÷ÊÔ¹¤¾ß£¬Äú¿ÉÒÔÇáËɵØÕï¶ÏºÍÐÞÕý¹ýʧ£¬Ìá¸ßLaravelÓ¦ÓóÌÐòµÄÎȹÌÐԺͿɿ¿ÐÔ¡£
ÒÔÉϾÍÊÇ×ܽáһЩ³£¼ûLaravel¹ýʧ¼°Æä½â¾ö¼Æ»®µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡