I recently was reading this Stack Overflow post
When to generating a New Application Key in Laravel?
where colleagues mentioned that you can run:
php artisan key:generate
and this will generate a new APP_KEY for your cloned Laravel project. This being a legitimate concern when collaborating and using Github for version control, however, when I tried to run that command I got this error:
ldco2016#DCortes-MacBook-Pro-3 ~/Projects/photogallery (master)$ php artisan key:generate [ruby-2.2.1]
PHP Warning: require(/Users/ldco2016/Projects/photogallery/bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in /Users/ldco2016/Projects/photogallery/bootstrap/autoload.php on line 17
PHP Stack trace:
PHP 1. {main}() /Users/ldco2016/Projects/photogallery/artisan:0
PHP 2. require() /Users/ldco2016/Projects/photogallery/artisan:16
Warning: require(/Users/ldco2016/Projects/photogallery/bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in /Users/ldco2016/Projects/photogallery/bootstrap/autoload.php on line 17
Call Stack:
0.0002 240112 1. {main}() /Users/ldco2016/Projects/photogallery/artisan:0
0.0003 242776 2. require('/Users/ldco2016/Projects/photogallery/bootstrap/autoload.php') /Users/ldco2016/Projects/photogallery/artisan:16
PHP Fatal error: require(): Failed opening required '/Users/ldco2016/Projects/photogallery/bootstrap/../vendor/autoload.php' (include_path='.:') in /Users/ldco2016/Projects/photogallery/bootstrap/autoload.php on line 17
PHP Stack trace:
PHP 1. {main}() /Users/ldco2016/Projects/photogallery/artisan:0
PHP 2. require() /Users/ldco2016/Projects/photogallery/artisan:16
Fatal error: require(): Failed opening required '/Users/ldco2016/Projects/photogallery/bootstrap/../vendor/autoload.php' (include_path='.:') in /Users/ldco2016/Projects/photogallery/bootstrap/autoload.php on line 17
Call Stack:
0.0002 240112 1. {main}() /Users/ldco2016/Projects/photogallery/artisan:0
0.0003 242776 2. require('/Users/ldco2016/Projects/photogallery/bootstrap/autoload.php') /Users/ldco2016/Projects/photogallery/artisan:16
So its not so straightforward and error free. Can anyone lend a hand as to how to generate a new APP_KEY when working on a cloned Laravel project?
You must first install composer and run composer install so that laravel can access the commands.
Related
I wanted to create a new project in Laravel yesterday but I have a problem. If i put "laravel new project", it will display this error
[UnexpectedValueException]
Could not parse version constraint project: Invalid version string
"project"
If I want create a new project via composer "composer create-project --prefer-dist laravel/laravel project", it will return this error
[ErrorException]
"continue" targeting switch is equivalent to "break". Did you mean to
use " continue 2"?
But in this situation project will be create but I have w problem with run it,
I write "php artisan serv" and it return this
PHP Warning: require(/home/michal/project/vendor/autoload.php):
failed to open stream: No such file or directory in
/home/michal/project/artisan on line 18 PHP Stack trace: PHP 1.
{main}() /home/michal/project/artisan:0 PHP Fatal error: require():
Failed opening required '/home/michal/project/vendor/autoload.php'
(include_path='.:/usr/share/php') in /home/michal/project/artisan on
line 18 PHP Stack trace: PHP 1. {main}()
/home/michal/project/artisan:0
How I can solve my problem?
PS. My composer version is 1.5.6
I am trying to run the server but keep getting these messages when running php app/console server:run:
PHP Warning: require(/var/www/html/symfony_demo/app/../vendor/autoload.php): failed to open stream: No such file or directory in /var/www/html/symfony_demo/app/autoload.php on line 11
PHP Stack trace:
PHP 1. {main}() /var/www/html/symfony_demo/app/console:0
PHP 2. require() /var/www/html/symfony_demo/app/console:17
PHP Fatal error: require(): Failed opening required '/var/www/html/symfony_demo/app/../vendor/autoload.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/html/symfony_demo/app/autoload.php on line 11
PHP Stack trace:
PHP 1. {main}() /var/www/html/symfony_demo/app/console:0
PHP 2. require() /var/www/html/symfony_demo/app/console:17
If I run php bin/console server:run I get this message:
Could not open input file: bin/console
The only change I have made recently was use winSCP to copy my files from the remote server to my local PC. Can someone help me with the errors?
EDIT: Like an idiot I copied over the wrong project.
EDIT: Still didn't fix my issue.
You most likely didn't run composer install or forgot to copy the vendor directory.
I tried updating my code and structure to Symfony 3.0. Doing the usual composer update, I've got this error when composer execute post-update-cmd :
Fatal error: Class 'AppKernel' not found in C:\wamp\www\tharmofos\bin\console on line 20
Call Stack:
0.0002 235192 1. {main}() C:\wamp\www\tharmofos\bin\console:0
Fatal error: require_once(): Failed opening required 'C:\wamp\www\tharmofos\vendor\jms\security-extra-bundle\Tests\Functiona
l/../../vendor/autoload.php' (include_path='.;C:\php\pear') in C:\wamp\www\tharmofos\vendor\jms\security-extra-bundle\Tests\
Functional\AppKernel.php on line 5
Call Stack:
0.0002 235192 1. {main}() C:\wamp\www\tharmofos\bin\console:0
0.0249 1144472 2. Symfony\Component\Debug\ErrorHandler::handleFatalError() C:\wamp\www\tharmofos\vendor\symfony\sym
fony\src\Symfony\Component\Debug\ErrorHandler.php:0
0.0263 1162640 3. Symfony\Component\Debug\ErrorHandler->handleException() C:\wamp\www\tharmofos\vendor\symfony\symf
ony\src\Symfony\Component\Debug\ErrorHandler.php:600
0.0292 1260456 4. Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler->handleError() C:\wamp\w
ww\tharmofos\vendor\symfony\symfony\src\Symfony\Component\Debug\ErrorHandler.php:530
0.0292 1262144 5. Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler->getClassCandidates() C:
\wamp\www\tharmofos\vendor\symfony\symfony\src\Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler.php:
62
2.5849 1595232 6. Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler->findClassInPath() C:\wa
mp\www\tharmofos\vendor\symfony\symfony\src\Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler.php:118
2.6446 1600616 7. Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler->convertFileToClass() C:
\wamp\www\tharmofos\vendor\symfony\symfony\src\Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler.php:
143
2.6453 1642120 8. require_once('C:\wamp\www\tharmofos\vendor\jms\security-extra-bundle\Tests\Functional\AppKernel.p
hp') C:\wamp\www\tharmofos\vendor\symfony\symfony\src\Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandl
er.php:188
Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the post-update-cmd event terminated wit
h an exception
[RuntimeException]
An error occurred when executing the ""cache:clear --no-warmup"" command:
Fatal error: Class 'AppKernel' not found in C:\wamp\www\tharmofos\bin\console on line 20
Call Stack:
0.0002 235192 1. {main}() C:\wamp\www\tharmofos\bin\console:0
Fatal error: require_once(): Failed opening required 'C:\wamp\www\tharmofos\vendor\jms\security-extra-bundle\Tests\Func
tional/../../vendor/autoload.php' (include_path='.;C:\php\pear') in C:\wamp\www\tharmofos\vendor\jms\security-extra-bun
dle\Tests\Functional\AppKernel.php on line 5
Call Stack:
0.0002 235192 1. {main}() C:\wamp\www\tharmofos\bin\console:0
0.0249 1144472 2. Symfony\Component\Debug\ErrorHandler::handleFatalError() C:\wamp\www\tharmofos\vendor\symfon
y\symfony\src\Symfony\Component\Debug\ErrorHandler.php:0
0.0263 1162640 3. Symfony\Component\Debug\ErrorHandler->handleException() C:\wamp\www\tharmofos\vendor\symfony
\symfony\src\Symfony\Component\Debug\ErrorHandler.php:600
0.0292 1260456 4. Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler->handleError() C:\w
amp\www\tharmofos\vendor\symfony\symfony\src\Symfony\Component\Debug\ErrorHandler.php:530
0.0292 1262144 5. Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler->getClassCandidates
() C:\wamp\www\tharmofos\vendor\symfony\symfony\src\Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHa
ndler.php:62
2.5849 1595232 6. Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler->findClassInPath()
C:\wamp\www\tharmofos\vendor\symfony\symfony\src\Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandl
er.php:118
2.6446 1600616 7. Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler->convertFileToClass
() C:\wamp\www\tharmofos\vendor\symfony\symfony\src\Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHa
ndler.php:143
2.6453 1642120 8. require_once('C:\wamp\www\tharmofos\vendor\jms\security-extra-bundle\Tests\Functional\AppKer
nel.php') C:\wamp\www\tharmofos\vendor\symfony\symfony\src\Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatal
ErrorHandler.php:188
As of now, I tried to delete the vendor folder and did a composer install but I keep getting this error.
When I try accessing my website, I get this error :
Fatal error: Class 'Symfony\Bundle\FrameworkBundle\FrameworkBundle' not found in C:\wamp\www\tharmofos\app\AppKernel.php on line 11
I think it's a problem with the structure update.
Do you have any clue ?
I found out how to get rid of this error by autoloading AppKernel.php in composer.json : https://github.com/symfony/symfony-standard/issues/868
If it can help, I often forget to upgrade a Symfony Standard file (like app/console, web/app.php, web/app_dev.php, app/config/routing_dev.yml...) when upgrading a project to 3.0.
It leads to this error.
I'm trying to learn Symfony but so far just keep getting hung up on installation and things other than the actual development of my app.
I try to create a new Symfony project on my Windows machine using the installer. I'm following the instructions exactly as it says in the book. I can successfully download the symfony.phar but when I run:
php symfony.phar
I get the following error:
PHP Warning: Phar::mapPhar(symfony.phar): failed to open stream: No such file or directory in symfony.phar on line 9
PHP Stack trace:
PHP 1. {main}() symfony.phar:0
PHP 2. Phar::mapPhar() symfony.phar:9
Warning: Phar::mapPhar(symfony.phar): failed to open stream: No such file or directory in symfony.phar on line 9
Call Stack:
0.0017 227224 1. {main}() symfony.phar:0
0.0017 227920 2. Phar::mapPhar() symfony.phar:9
PHP Fatal error: Uncaught exception 'PharException' with message 'unable to open phar for reading "symfony.phar"' in symfony.phar:9
Stack trace:
#0 symfony.phar(9): Phar::mapPhar('default.phar')
#1 {main}
thrown in symfony.phar on line 9
Fatal error: Uncaught exception 'PharException' with message 'unable to open phar for reading "symfony.phar"' in symfony.phar on line 9
PharException: unable to open phar for reading "symfony.phar" in symfony.phar on line 9
Call Stack:
0.0017 227224 1. {main}() symfony.phar:0
0.0017 227920 2. Phar::mapPhar() symfony.phar:9
I can't find anything that helps with this.
The reason appears to be that in my Windows command prompt I was in a sub directory of C:\Users\Me\My Documents. Neither the symfony.phar, nor Composer will work from this directory. It has to be from C:\Users\Me\Documents which is the actual phsyical location, as opposed to My Documents which is just a virtual directory.
I don't know the technicalities of exactly why it doesn't work though.
Can anybody tell how to get working APIGen on windows. I have installed ApiGen using PEAR and the file of ApiGen resides in
C:\wamp\bin\php\php5.3.13
there are two types of file here one with batch extension and other with file extension both having name apigen.
I am getting below error while using apigen command.
Warning: require(Texy.php): failed to open stream: No such file or directory in C:\wamp\bin\php\php5.3.13\apigen on line 48
Call Stack:
0.0015 792712 1. {main}() C:\wamp\bin\php\php5.3.13\apigen:0
0.0141 1646736 2. class_exists() C:\wamp\bin\php\php5.3.13\apigen:64
0.0142 1647048 3. ApiGen\{closure}() C:\wamp\bin\php\php5.3.13\apigen:0
Fatal error: require(): Failed opening required 'Texy.php' (include_path='.;C:\wamp\bin\php\php5.3.13\pear') in C:\wamp\bin\php\php5.3.13\apigen on line 48
Call Stack:
0.0015 792712 1. {main}() C:\wamp\bin\php\php5.3.13\apigen:0
0.0141 1646736 2. class_exists() C:\wamp\bin\php\php5.3.13\apigen:64
0.0142 1647048 3. ApiGen\{closure}() C:\wamp\bin\php\php5.3.13\apigen:0
PHP Warning: require(Texy.php): failed to open stream: No such file or directory in C:\wamp\bin\php\php5.3.13\apigen on line 48
PHP Stack trace:
PHP 1. {main}() C:\wamp\bin\php\php5.3.13\apigen:0
PHP 2. class_exists() C:\wamp\bin\php\php5.3.13\apigen:64
PHP 3. ApiGen\{closure}() C:\wamp\bin\php\php5.3.13\apigen:0
PHP Fatal error: require(): Failed opening required 'Texy.php' (include_path='.;C:\wamp\bin\php\php5.3.13\pear') in C:\wamp\bin\php\php5.3.13\apigen on line 48
PHP Stack trace:
PHP 1. {main}() C:\wamp\bin\php\php5.3.13\apigen:0
PHP 2. class_exists() C:\wamp\bin\php\php5.3.13\apigen:64
PHP 3. ApiGen\{closure}() C:\wamp\bin\php\php5.3.13\apigen:0
Please follow these step (refer from this page https://github.com/ApiGen/ApiGen/wiki/installation-on-windows)
Install apigen.phar in directory you want. For example: C:\PHPCLI
Add C:\PHPCLI to Windows Path
In case that you or anyone don't know how to add Path in Windows. Right click on My Computer icon on desktop or start menu and click on Properties.
On left side of Windows properties page, click on Advanced system settings.
Click Environment Variables...
You can add C:\PHPCLI to Path in user variables or system variables. Choose one.
Click OK to all.
Open command line and enter cd C:\PHPCLI
Enter in command line again: echo #php "%~dp0apigen.phar" %*>apigen.bat
Close command line and open new command line. Test by enter this command apigen --help
It should display ApiGen help message.