issue with composer when deploying using Envoyer - laravel-5

I'm having trouble deploying my laravel app using envoyer, the error accuer in installing composer dependencies, here it is:
Generating autoload files
Illuminate\Foundation\ComposerScripts::postInstall
php artisan optimize
[RuntimeException]
No supported encrypter found. The cipher and / or key length are invalid.
it's my first time and I'm having lots of errors and don't really know how to fix them , I'd appreciate the help thanks

You need to generate key using command php artisan generate:key
As .env is not present in production so change app.php under config file to Something like below
'key' => env('APP_KEY','base64:42KCuY7E8Zc+JHrUZFyta4yspqLAjcVZeZVvymrjZBI=')
This would solve your problem.

Related

Invalid API key: You must be granted a valid key tmdb laravel 5.5

i am trying to install php-tmdb/laravel on my laravel 5.5 but getting error on basic test
Invalid API key: You must be granted a valid key
i try with google and found this link https://github.com/php-tmdb/laravel/issues/38
but its not working or can't understand
help me
auto discovery in this package is not working correctly
just add this on providers
config/app.php
Tmdb\Laravel\TmdbServiceProvider::class,
everything is working fine now
According to the github README.md https://github.com/php-tmdb/laravel
After you install the package, run this command to publish the configuration file:
php artisan vendor:publish --provider="Tmdb\Laravel\TmdbServiceProviderLaravel5"
then edit this file: config/tmdb.php in your application with your api key.
The configuration file should look like this:
https://github.com/php-tmdb/laravel/blob/master/src/config/tmdb.php
Notice 'api_key' => '', fill this in and then re-run your code/test.
Here's where you get your API key from: https://developers.themoviedb.org/3/getting-started
After changing the config, for good measure; clear your config cache with this command:
php artisan config:clear
edit /vendor/php-tmdb/laravel/src/config/tmdb.php
find 'api_key' => '', and add your key here.

php artisan optimize returns (Invalid filename provided.)

I was trying to publish my new laravel project using Forge+DigitalOcean but I get the error message (We were unable to install a project on your server) due to php artisan optimize command returning Invalid filename provided. error.
So I modified my .env file and set APP_DEBUG to false and tried to run the command locally. I got the following error:
php artisan optimize -v
Generating optimized class loader Compiling common classes
[RuntimeException] Invalid filename provided.
Exception trace: () at /home/bubut/Code/TalalAttendance/vendor/classpreloader/classpreloader/src/ClassPreloader.php:105
ClassPreloader\ClassPreloader->getCode() at
/home/bubut/Code/TalalAttendance/vendor/laravel/framework/src/Illuminate/Foundation/Console/OptimizeCommand.php:89
Illuminate\Foundation\Console\OptimizeCommand->compileClasses() at
/home/bubut/Code/TalalAttendance/vendor/laravel/framework/src/Illuminate/Foundation/Console/OptimizeCommand.php:70
Illuminate\Foundation\Console\OptimizeCommand->fire() at n/a:n/a
call_user_func_array() at
/home/bubut/Code/TalalAttendance/bootstrap/cache/compiled.php:1138
Illuminate\Container\Container->call() at
/home/bubut/Code/TalalAttendance/vendor/laravel/framework/src/Illuminate/Console/Command.php:150
Illuminate\Console\Command->execute() at
/home/bubut/Code/TalalAttendance/vendor/symfony/console/Command/Command.php:258
Symfony\Component\Console\Command\Command->run() at
/home/bubut/Code/TalalAttendance/vendor/laravel/framework/src/Illuminate/Console/Command.php:136
Illuminate\Console\Command->run() at
/home/bubut/Code/TalalAttendance/vendor/symfony/console/Application.php:827
Symfony\Component\Console\Application->doRunCommand() at
/home/bubut/Code/TalalAttendance/vendor/symfony/console/Application.php:191
Symfony\Component\Console\Application->doRun() at
/home/bubut/Code/TalalAttendance/vendor/symfony/console/Application.php:122
Symfony\Component\Console\Application->run() at
/home/bubut/Code/TalalAttendance/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:100
Illuminate\Foundation\Console\Kernel->handle() at
/home/bubut/Code/TalalAttendance/artisan:36
Laravel allows you to specify additional files to be compiled -- generally files that are used on every request in the application.
The file list is specified in /config/compile.php in the files array. If you have specified a file there but it does not exist (or the location is wrong) then artisan will throw that error when trying to compile it.
Same thing happened to me and removing the non-existent file from the list fixed my problem.
Same issue toady, and after debugging in Illuminate\Foundation\Console\OptimizeCommand, I found that some symfony components missing in vendor folder, even with composer install/update command for some reason.
Remove contents under vendor folder, then do composer update to see if missing components back. Or git clone whole project and composer update. Note that composer install will check composer.lock, if it existing and components missing there, issue triggered.
Note: For additional information
If your files are in a folder inside app folder, this is how you should list them.
'files' => [
'app/your_folder_name/file_a.php',
'app/your_folder_name/file_b.php',
'app/your_folder_name/file_c.php',
]
Hope this helps anyone who one to compile their custom functions.

laravel PackageServiceProvider not found; moving from workbench to vendor

This is basically a problem of moving a laravel package from workbench to vendor, but the solutions in other threads have not worked in this case:
I have a package iateadonut/signup.
I created a fresh laravel installation (laravel_test), and, just for testing sake, I put iateadonut/signup in laravel_test/workbench/.
I put Iateadonut\Signup\SignupServiceProvider, in the 'providers' array in app.php.
I then run:
/laravel_test> php artisan dump-autoload
and get:
Generating optimized class loader
Running for workbench [iateadonut/signup]...
My package is successfully installed.
On a fresh installation of laravel (laravel_test), I then put iateadonut/signup in larael_test/vendor.
I put Iateadonut\Signup\SignupServiceProvider, in the 'providers' array in app.php.
I then run:
/laravel_test> php artisan dump-autoload
and get:
PHP Fatal error: Class 'Iateadonut\Signup\SignupServiceProvider' not found in /var/www/html/laravel_test/bootstrap/compiled.php on line 4214
{"error":{"type":"Symfony\Component\Debug\Exception\FatalErrorException","message":"Class 'Iateadonut\Signup\SignupServiceProvider' not found","file":"/var/www/html/laravel_test/bootstrap/compiled.php","line":4214}}
Any idea what could be wrong?
Here is a more google friendly version in case someone else is looking for this:
PHP Fatal error: Class 'Vendor\Package\PackageServiceProvider' not found in /var/www/html/laravel/bootstrap/compiled.php on line 4214
{"error":{"type":"Symfony\Component\Debug\Exception\FatalErrorException","message":"Class 'Vender\Package\PackageServiceProvider' not found","file":"/var/www/html/laravel/bootstrap/compiled.php","line":4214}}
Try to remove the the bootstrap/compiled.php file and try your composer dumpautoload again

LAMP Laravel ErrorException mcrypt_get_iv_size(): Module initialization failed

I installed laravel in my new pc and i'm getting this error:
ErrorException mcrypt_get_iv_size(): Module initialization failed
I copied the project from my old pc. mcrypt is installed and enabled, and other pages that do not use laravel are working. I'm running ubuntu 14.04
I created a new laravel project (using laravel new command) and when i try to access i get:
"Whoops, looks like something went wrong."
I opened the log and the error was:
production.ERROR: exception 'ErrorException' with message
'mcrypt_get_iv_size(): Module initialization failed
any ideas?
On app/config/app.php just change:
'cipher' => MCRYPT_RIJNDAEL_256,
Run php artisan key:generate on your command line to refresh your application key.
Then clear your cache and sessions and try again.
I had this same problem today, and it was because of how Laravel 4.2 uses the new encryption method.
Make sure you run php 7.0, and add this string "MCRYPT_RIJNDAEL_256" (without the quotes) to the cipher in app.php. after generate a new key (php artisan key:generate) and add the new key.
This works for me.
Another solution:
Add "tomgrohl/laravel4-php71-encrypter": "^1.1" to the require of your composer.json
Run composer update
Add 'AES-256-CBC' to the cipher in app/config/app.php
Done!

Laravel 4 - unserialize(): Error at offset 0 of 32 bytes

When I install Laravel 4, I receive this error:
ErrorException
unserialize(): Error at offset 0 of 32 bytes
C:\xampp\htdocs\blog\laravel\bootstrap\compiled.php
return unserialize($this->stripPadding($this->mcryptDecrypt($value, $iv)));
If I modify return like this:
return unserialize(base64_decode($this->stripPadding($this->mcryptDecrypt($value, $iv))));
Then the error goes away. But of course every time I run composer update this change will be undone.
What could be the reason of this problem?
I appreciate any help.
Update: This only happens when I use Auth::check().
Update 2: Now it only works with base64_decode() removed. It's like if the xampp installation has become self-aware. Jesus!
Refer to this issue: laravel/framework#1526
A change in the encryption mechanism is the cause. My solution was to empty out the sessions and views that were cached in the storage folder, then run php artisan key:generate and relaunch the server. I'm not sure which part of the process fixed the issue, but I haven't seen it since.
The command > php artisan cache:clear fixed the problem for me.
I did not have to restart the server
Can you post what you're doing that causes this error? You shouldn't be modifying the core - because as you said, updates will overwrite it.
You have to set a news Key, use the following command:
php artisan key:generate
After that test again to run the Laravel Application
php artisan serve

Resources