Fresh CentOS 7, first Laravel Installation.Composer install breaks - laravel

I am fallowing this tutorial:
http://linoxide.com/linux-how-to/install-laravel-php-centos-7-ubuntu-15-04/
And on step 5) when running composer install in the project directory it starts to do staff, as expected, until this happened:
Illuminate\Foundation\ComposerScripts::postInstall
> php artisan optimize
PHP Fatal error: Undefined constant 'Illuminate\Session\TokenMismatchException' in /var/www/laravel-develop/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 779
PHP Fatal error: Undefined constant 'Illuminate\Session\TokenMismatchException' in /var/www/laravel-develop/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 779
Script php artisan optimize handling the post-install-cmd event returned with error code 255
What is the problem?
Thanks, Aleks

start creating a project (after updating composer) instead of downloading the referenced file do the following
from your terminal type in cd /var/www/
then type composer create-project laravel/laravel laravel-develop
your composer should download the latest version of Laravel
try it this way feel free to ask any questions.
Good Luck

Related

How to install Laravel v5.2.15 when I have already installed v5.6.12?

I am trying to install a lower version of laravel when I have already installed a higher version in my htdocs. But it throws an error.
C:\xampp\htdocs\laravel-6>composer create-project laravel/laravel=5.2.15 s6
Installing laravel/laravel (v5.2.15)
- Installing laravel/laravel (v5.2.15): Loading from cache
Created project in s6
> php -r "copy('.env.example', '.env');"
> php artisan clear-compiled
PHP Warning: require(C:\xampp\htdocs\laravel-6\s6\bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in C:\xampp\htdocs\laravel-6\s6\bootstrap\autoload.php on line 17
PHP Stack trace:
PHP 1. {main}() C:\xampp\htdocs\laravel-6\s6\artisan:0
PHP 2. require() C:\xampp\htdocs\laravel-6\s6\artisan:16
PHP Fatal error: require(): Failed opening required 'C:\xampp\htdocs\laravel-6\s6\bootstrap/../vendor/autoload.php' (include_path='C:\xampp\php\PEAR') in C:\xampp\htdocs\laravel-6\s6\bootstrap\autoload.php on line 17
PHP Stack trace:
PHP 1. {main}() C:\xampp\htdocs\laravel-6\s6\artisan:0
PHP 2. require() C:\xampp\htdocs\laravel-6\s6\artisan:16
Warning: require(C:\xampp\htdocs\laravel-6\s6\bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in C:\xampp\htdocs\laravel-6\s6\bootstrap\autoload.php on line 17
Call Stack:
0.0007 344912 1. {main}() C:\xampp\htdocs\laravel-6\s6\artisan:0
0.0016 346488 2. require('C:\xampp\htdocs\laravel-6\s6\bootstrap\autoload.php') C:\xampp\htdocs\laravel-6\s6\artisan:16
Fatal error: require(): Failed opening required 'C:\xampp\htdocs\laravel-6\s6\bootstrap/../vendor/autoload.php' (include_path='C:\xampp\php\PEAR') in C:\xampp\htdocs\laravel-6\s6\bootstrap\autoload.php on line 17
Call Stack:
0.0007 344912 1. {main}() C:\xampp\htdocs\laravel-6\s6\artisan:0
0.0016 346488 2. require('C:\xampp\htdocs\laravel-6\s6\bootstrap\autoload.php') C:\xampp\htdocs\laravel-6\s6\artisan:16
Script php artisan clear-compiled handling the pre-update-cmd event returned with error code 255
But when I tried installing laravel v5.6.12, it gets installed easily again. Please tell me a way around to install a lower version of laravel while keeping the higher version. Thanks.
Errors:Updates suggested by a member
I was suggested to download laravel's particular version manually and I did also tried to update composer but still facing problem. The error that has occurred is shown below:
Have you tried using this command to install a clean copy of laravel 5.2.15?
composer create-project --prefer-dist laravel/laravel laravelProjectFolder "5.2.15"

anyone got an error i get while installing teepluss/theme in laravel

I wanted to install teepluss/theme so I added it to my composer.json
but now I get this error:
[Symfony\Component\Debug\Exception\FatalThrowableError]
Class 'SuperClosure\Serializer' not found
I was capable to solve the first error by adding >"jeremeamia/superclosure": "^2.0"
but now when I add >Teepluss\Theme\ThemeServiceProvider::class, in app.php providers I get a new error :
> [ErrorException] Illegal offset type in unset
here's what i got in the script in composer.json
If you already run composer update, you can try run this script
php artisan config:cache
and
php artisan cache:clear.It can help you resolve that problem

Laravel Installer throwing error

I'm getting this error when calling the bash command
laravel new project
php -r "copy('.env.example', '.env');"
php artisan clear-compiled
Warning: require(/Users/Dale/Desktop/Outstanding Projects/project/bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in /Users/Dale/Desktop/Outstanding Projects/project/bootstrap/autoload.php on line 17
Fatal error: require(): Failed opening required '/Users/Dale/Desktop/Outstanding Projects/project/bootstrap/../vendor/autoload.php' (include_path='.:') in /Users/Dale/Desktop/Outstanding Projects/project/bootstrap/autoload.php on line 17
Script php artisan clear-compiled handling the post-install-cmd event returned with an error
Anyone come across this before.
I assume you used composer to install Laravel.
Laravel can't find your autoload.php file in vendor directory. Try composer install and composer dumpautoload. Also check if autoload.php is in directory.
Path to autoload.php should be in bootstrap/autoload.php file, check if path is correct with your system.

Laravel Forge deploy errors from Composer update

My application works fine locally and is running on Digital Ocean. But I am getting the following two alternate deploy errors on Laravel Forge.
If I run:
composer update --no-dev
php artisan optimize
then I get the following error on Forge:
[RuntimeException]
The lock file does not contain require-dev information, run install with the --no-dev option or run update to install those packages.
If I run:
composer update
php artisan optimize
then I get this on Forge:
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Generating autoload files
PHP Fatal error: Call to undefined method
Illuminate\Foundation\Application::getCachedCompilePath() in /home/forge/default/vendor/laravel/framework/src/Illuminate/Foundation/Console/ClearCompiledCommand.php on line 28
PHP Stack trace:
PHP 1. {main}() /home/forge/default/artisan:0
PHP 2. Illuminate\Foundation\Console\Kernel->handle() /home/forge/default/artisan:36
PHP 3. Symfony\Component\Console\Application->run() /home/forge/default/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:94
PHP 4. Symfony\Component\Console\Application->doRun() /home/forge/default/vendor/symfony/console/Symfony/Component/Console/Application.php:126
PHP 5. Symfony\Component\Console\Application->doRunCommand() /home/forge/default/vendor/symfony/console/Symfony/Component/Console/Application.php:195
PHP 6. Illuminate\Console\Command->run() /home/forge/default/vendor/symfony/console/Symfony/Component/Console/Application.php:874
PHP 7. Symfony\Component\Console\Command\Command->run() /home/forge/default/vendor/laravel/framework/src/Illuminate/Console/Command.php:101
PHP 8. Illuminate\Console\Command->execute() /home/forge/default/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:257
PHP 9. Illuminate\Container\Container->call() /home/forge/default/vendor/laravel/framework/src/Illuminate/Console/Command.php:115
PHP 10. call_user_func_array:{/home/forge/default/storage/framework/compiled.php:925}() /home/forge/default/storage/framework/compiled.php:925
PHP 11. Illuminate\Foundation\Console\ClearCompiledCommand->fire() /home/forge/default/storage/framework/compiled.php:925
[Symfony\Component\Debug\Exception\FatalErrorException]
Call to undefined method Illuminate\Foundation\Application::getCachedCompilePath()
Script php artisan clear-compiled handling the post-install-cmd event returned with an error
[RuntimeException
Error Output: PHP Fatal error: Call to undefined method Illuminate\Foundation\Application::getCachedCompilePath() in /home/forge/default/vendor/laravel/framework/src/Illuminate/Foundation/Console/ClearCompiledCommand.php on line 28
PHP Stack trace:
PHP 1. {main}() /home/forge/default/artisan:0
PHP 2. Illuminate\Foundation\Console\Kernel->handle() /home/forge/default/artisan:36
PHP 3. Symfony\Component\Console\Application->run() /home/forge/default/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:94
PHP 4. Symfony\Component\Console\Application->doRun() /home/forge/default/vendor/symfony/console/Symfony/Component/Console/Application.php:126
PHP 5. Symfony\Component\Console\Application->doRunCommand() /home/forge/default/vendor/symfony/console/Symfony/Component/Console/Application.php:195
PHP 6. Illuminate\Console\Command->run() /home/forge/default/vendor/symfony/console/Symfony/Component/Console/Application.php:874
PHP 7. Symfony\Component\Console\Command\Command->run() /home/forge/default/vendor/laravel/framework/src/Illuminate/Console/Command.php:101
PHP 8. Illuminate\Console\Command->execute() /home/forge/default/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:257
PHP 9. Illuminate\Container\Container->call() /home/forge/default/vendor/laravel/framework/src/Illuminate/Console/Command.php:115
PHP 10. call_user_func_array:{/home/forge/default/storage/framework/compiled.php:925}() /home/forge/default/storage/framework/compiled.php:925
PHP 11. Illuminate\Foundation\Console\ClearCompiledCommand->fire() /home/forge/default/storage/framework/compiled.php:925
What am I doing wrong?
probably the easiest thing to do here is this.
in your local development environment double check your composer.json file for any items in the "require" section which should be in the "require-dev" section and move them if need be
Delete your local composer.lock file
Run composer install composer update -vvv
Test your application locally
When satisfied that everything is working in line with your expectations commit your composer.lock file back to your version control system and redeploy the application on Forge
If you continue to get errors on deploy and there is nothing else of worth on the server I'd destroy your old server instance then create a new server on Forge. Have it run the build with the new composer.lock file and I'm sure it will get you past this issue. :-D
On another note which may help, generally on deployment I'll favour composer install over composer update on the basis I'll have tested functionality based on specific versions of dependencies which are recorded in the composer.lock file. Following that approach means application behaviour should be more predictable. You'll risk encoutering unpredictable behaviour where you or one of your dependencies relies on a library which is always the latest version (e.g. dev-master) since the code could be changing very frequently.

laravel 4 install issue when using composer install

When I run
composer.phar install
I get this error almost at the end of the installation, any ideas?
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Generating autoload files
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /home/belendez/public_html/laravel/artisan on line 46
Parse error: syntax error, unexpected T_STRING in /home/belendez/public_html/laravel/artisan on line 46
Script php artisan optimize handling the post-install-cmd event returned with an error
I look into the suggested link and it appears that somehow in the middle of the installation it changes from 5.3 to 5.2! If I try to start installation using 5.2 it returns right a way: class 'Phar' not found. Any ideas?
It seems that issuing only a php command will pick up another version of the interpreter. Try to change all the references to php in your composer.phar file to the one you want actually to be executed (in your case it seems /opt/php53/bin/php).
You can confirm that by simply launching a php -v directly from the command line to see what version your server will pick up

Resources