Script php artisan optimize handling the post install cmd event returned with error code 255

When runnning composer install on my laravel project I get the error: Script php artisan clear-compiled handling the post-install-cmd event returned with error code 255 Any advice on what could...

When runnning composer install on my laravel project I get the error:

Script php artisan clear-compiled handling the post-install-cmd event returned with error code 255

Any advice on what could be the issue? Note composer installs all the vendor packages. The full output is below:

[user@some_path]$ composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating autoload files
> php artisan clear-compiled
Script php artisan clear-compiled handling the post-update-cmd event returned with error code 255

asked Mar 3, 2017 at 3:53

sazr's user avatar

1

Makse sure your storage/ & bootstrap/cache directory writeable.

Make sure your .env file doesent contain any spaces.

Ex:
key=value istead of key=va lue

remove the
bootstrap/cache/config.php file.
then

composer dumpautoload
composer update

Try to remove /bootstrap/compiled.php ( if you have it )

answered Mar 3, 2017 at 10:01

Zoltán Jére's user avatar

Zoltán JéreZoltán Jére

5944 silver badges15 bronze badges

1

step 1 — Check your php version. If your laravel is old , then it wont support 7.x, you need to switch (check this if you are using mac) to PHP 5.6 in this case.

Step 2 — remove composer.lock and run composer install

answered May 13, 2018 at 11:48

Serjas's user avatar

SerjasSerjas

2,1744 gold badges21 silver badges35 bronze badges

The only thing that command does is delete the bootstrap/cache/services.php file, if it exists. Most likely, the file exists, but the permissions aren’t set correctly to allow you to delete it.

answered Mar 3, 2017 at 4:16

patricus's user avatar

patricuspatricus

57.7k15 gold badges144 silver badges145 bronze badges

i found the solution. Here is list of extensions that causes this problem.

extension=php_pdo_pgsql.dll
extension=php_pdo_sqlite.dll
extension=php_pgsql.dll
extension=php_pdo_mysql.dll

you have to uncomment all of these extensions from your php.ini

E:wamp64binphpphp7.1.9php.ini

Note :: Must check your database credential into your .env file

answered Apr 5, 2018 at 4:24

Vishal's user avatar

VishalVishal

5711 gold badge7 silver badges8 bronze badges

I assume the problem can come from multiple sources. In my case, I had a syntax error in my config/app.php. Reverted to a previous version and the remade my edits.

answered Dec 11, 2018 at 21:06

user3280979's user avatar

Just run the npm install command from any terminal then re-run composer to install all your dependencies.

answered Sep 25, 2022 at 4:06

ABDO-AR's user avatar

— C:\Users\saleventa9\proyectos\Homestead\codigo\test\vendor\laravel\framework\src\Illuminate\Container\Container.php(805): Illuminate\Containe in C:\Users\saleventa9\proyectos\Homestead\codigo\test\vendor\laravel\framework\src\Illuminate\Container\Container.php on line 741 nn

Script php artisan optimize handling the post-update-cmd event returned with error code 255 n

that errors is just for config\app.php or may can be any required proyect after do «php artisan config:publish» command? n

rnWe don’t learn tools for the sake of learning tools. Instead, we learn them because they help us accomplish a particular goal. With that in mind, in this series, we’ll use the common desire for a blog — with categories, tags, comments, email notifications, and more — as our goal. Laravel will be the tool that helps us get there. Each lesson, geared toward newcomers to Laravel, will provide instructions and techniques that will get you to the finish line. rn rn

Источник

Script php artisan optimize handling the post install cmd event returned with error code 255

I am getting an error when I run composer update: n

Generating autoload filesn> Illuminate\Foundation\ComposerScripts::postUpdaten> php artisan optimizenn n [Symfony\Component\Debug\Exception\FatalErrorException] n Call to undefined function apache_request_headers() n nnScript php artisan optimize handling the post-update-cmd event returned with error code 255n n

Problem is in my custom error handler, loaded through a service provider: n

private function include_request_headers()n<n // Include request headers in log entryn if( $request_headers = \apache_request_headers() )n <n $this->log_entry .= ‘Request headers:’ . PHP_EOL;nn foreach( $request_headers as $k => $v )n <n $this->log_entry .= «\t» . $k . ‘ = ‘ . $v . PHP_EOL;n >n >n>n n

Service Provider: n

I realize that this may not be proper usage of a service provider, since I’m not actually binding something to the container. n

The apache_request_headers function definitely exists on my server. I had to add the backslash in front of it, because without it the error above thinks apache_request_headers is part of the App\Exceptions namespace. n

I did move the loading of this service provider to the top of the stack in config/app.php, because I want to have it load as soon as possible. If I comment out the section that is throwing the error, composer update works fine, and even with uncommenting the error handler works fine too. n

Assuming that you’re actually running an Apache server — since I would imagine you’d see this error if trying to execute it on an nginx server — what happens when you comment out that bit of your error handler? Is another error thrown? Could it also be having a problem since a command line request isn’t routed through Apache? n»,»bodyInMarkdown»:»Assuming that you’re actually running an Apache server — since I would imagine you’d see this error if trying to execute it on an nginx server — what happens when you comment out that bit of your error handler? Is another error thrown? Could it also be having a problem since a command line request isn’t routed through Apache?»,»replies»:[],»user»:<«id»:37851,»username»:»trip.somers»,»avatar»:»//unavatar.io/github/trip-somers»,»experience»:<«award_count»:»2″,»level»:3,»points»:»12,080″,»pointsUntilNextLevel»:»2,920″>,»achievements»:[<«id»:16,»name»:»Ten Thousand Strong»,»description»:»Earned once your experience points hits 10,000.»,»level»:»intermediate»,»icon»:»ten-thousand-strong.svg»>],»reported»:null,»staff»:false,»subscribed»:false,»profile»:<«full_name»:null,»bio»:null,»twitter»:»»,»github»:»trip-somers»,»website»:»»,»employment»:»»,»job_title»:»»,»location»:»Plano, TX»,»flag»:null,»available_for_hire»:1>,»dateSegments»:<«created_diff»:»6 years ago»>,»settings»:<«show_profile»:true>,»links»:<«profile»:»https://laracasts.com/@trip.somers»>>,»likes»:[],»created_at»:»2016-11-01T13:39:49.000000Z»,»links»:<«delete»:»/discuss/replies/291008″,»like»:»/discuss/replies/291008/likes»,»best_answer»:»/discuss/conversations/39726/best»>,»best_answer»:false,»dateSegments»:<«createdDiff»:»6 years ago»>>,<«id»:315030,»conversation_id»:39726,»body»:»

The same error also occurred on my project right after I made a new entry to the app.php->providers, n

Turns out I was missing a comma (,) at the end of the entry even though it was the last in the list. n

Источник

Script php artisan optimize handling the post install cmd event returned with error code 255

I am getting an error when I run composer update: n

Generating autoload filesn> Illuminate\Foundation\ComposerScripts::postUpdaten> php artisan optimizenn n [Symfony\Component\Debug\Exception\FatalErrorException] n Call to undefined function apache_request_headers() n nnScript php artisan optimize handling the post-update-cmd event returned with error code 255n n

Problem is in my custom error handler, loaded through a service provider: n

private function include_request_headers()n<n // Include request headers in log entryn if( $request_headers = \apache_request_headers() )n <n $this->log_entry .= ‘Request headers:’ . PHP_EOL;nn foreach( $request_headers as $k => $v )n <n $this->log_entry .= «\t» . $k . ‘ = ‘ . $v . PHP_EOL;n >n >n>n n

Service Provider: n

I realize that this may not be proper usage of a service provider, since I’m not actually binding something to the container. n

The apache_request_headers function definitely exists on my server. I had to add the backslash in front of it, because without it the error above thinks apache_request_headers is part of the App\Exceptions namespace. n

I did move the loading of this service provider to the top of the stack in config/app.php, because I want to have it load as soon as possible. If I comment out the section that is throwing the error, composer update works fine, and even with uncommenting the error handler works fine too. n

Assuming that you’re actually running an Apache server — since I would imagine you’d see this error if trying to execute it on an nginx server — what happens when you comment out that bit of your error handler? Is another error thrown? Could it also be having a problem since a command line request isn’t routed through Apache? n»,»bodyInMarkdown»:»Assuming that you’re actually running an Apache server — since I would imagine you’d see this error if trying to execute it on an nginx server — what happens when you comment out that bit of your error handler? Is another error thrown? Could it also be having a problem since a command line request isn’t routed through Apache?»,»replies»:[],»user»:<«id»:37851,»username»:»trip.somers»,»avatar»:»//unavatar.io/github/trip-somers»,»experience»:<«award_count»:»2″,»level»:3,»points»:»12,080″,»pointsUntilNextLevel»:»2,920″>,»achievements»:[<«id»:16,»name»:»Ten Thousand Strong»,»description»:»Earned once your experience points hits 10,000.»,»level»:»intermediate»,»icon»:»ten-thousand-strong.svg»>],»reported»:null,»staff»:false,»subscribed»:false,»profile»:<«full_name»:null,»bio»:null,»twitter»:»»,»github»:»trip-somers»,»website»:»»,»employment»:»»,»job_title»:»»,»location»:»Plano, TX»,»flag»:null,»available_for_hire»:1>,»dateSegments»:<«created_diff»:»6 years ago»>,»settings»:<«show_profile»:true>,»links»:<«profile»:»https://laracasts.com/@trip.somers»>>,»likes»:[],»created_at»:»2016-11-01T13:39:49.000000Z»,»links»:<«delete»:»/discuss/replies/291008″,»like»:»/discuss/replies/291008/likes»,»best_answer»:»/discuss/conversations/39726/best»>,»best_answer»:false,»dateSegments»:<«createdDiff»:»6 years ago»>>,<«id»:315030,»conversation_id»:39726,»body»:»

The same error also occurred on my project right after I made a new entry to the app.php->providers, n

Turns out I was missing a comma (,) at the end of the entry even though it was the last in the list. n

A forum is a deceptively complex thing. Sure, it’s made up of threads and replies, but what else might exist as part of a forum? What about profiles, or thread subscriptions, or filtering, or real-time notifications? As it turns out, a forum is the perfect project to stretch your programming muscles. In this series, we’ll work together to build one with tests from A to Z. «,»path»:»/series/lets-build-a-forum-with-laravel»,»strippedBody»:»A forum is a deceptively complex thing. Sure, it’s made up of threads and replies, but what else might exist as part of a forum? What about profiles, or thread subscriptions, or filtering, or real-time notifications? As it turns out, a forum is the perfect project to stretch your programming muscles. In this series, we’ll work together to build one with tests from A to Z.»,»thumbnail»:»https://ik.imagekit.io/laracasts/series/thumbnails/lets-build-a-forum.png»,»large_thumbnail»:»https://laracasts.s3.amazonaws.com/series/thumbnails/social-cards/lets-build-a-forum-with-laravel.png»,»svgThumbnail»:»https://ik.imagekit.io/laracasts/series/thumbnails/svg/lets-build-a-forum.svg»,»slug»:»lets-build-a-forum-with-laravel»,»episodeCount»:102,»difficultyLevel»:»Intermediate»,»customUrl»:null,»version»:null,»version_notes»:null,»complete»:1,»wallpaper»:»»,»archived»:1,»runTime»:»19h 29m»,»taxonomy»:<«name»:»Frameworks»,»path»:»https://laracasts.com/browse/frameworks»>,»hasChapters»:false,»isLarabit»:0,»isCreatorSeries»:0,»progress»:<«started»:false,»completionPercentage»:0,»episodesCompleted»:0,»completed»:false,»nextEpisodePosition»:1>,»lastUpdated»:»Mar 17, 2021″>,<«id»:142,»className»:»Laracasts\Series»,»title»:»Laravel 8 From Scratch»,»body»:»

rnWe don’t learn tools for the sake of learning tools. Instead, we learn them because they help us accomplish a particular goal. With that in mind, in this series, we’ll use the common desire for a blog — with categories, tags, comments, email notifications, and more — as our goal. Laravel will be the tool that helps us get there. Each lesson, geared toward newcomers to Laravel, will provide instructions and techniques that will get you to the finish line. rn rn

Источник

Script php artisan optimize handling the post install cmd event returned with error code 255

I am getting an error when I run composer update: n

Generating autoload filesn> Illuminate\Foundation\ComposerScripts::postUpdaten> php artisan optimizenn n [Symfony\Component\Debug\Exception\FatalErrorException] n Call to undefined function apache_request_headers() n nnScript php artisan optimize handling the post-update-cmd event returned with error code 255n n

Problem is in my custom error handler, loaded through a service provider: n

private function include_request_headers()n<n // Include request headers in log entryn if( $request_headers = \apache_request_headers() )n <n $this->log_entry .= ‘Request headers:’ . PHP_EOL;nn foreach( $request_headers as $k => $v )n <n $this->log_entry .= «\t» . $k . ‘ = ‘ . $v . PHP_EOL;n >n >n>n n

Service Provider: n

I realize that this may not be proper usage of a service provider, since I’m not actually binding something to the container. n

The apache_request_headers function definitely exists on my server. I had to add the backslash in front of it, because without it the error above thinks apache_request_headers is part of the App\Exceptions namespace. n

I did move the loading of this service provider to the top of the stack in config/app.php, because I want to have it load as soon as possible. If I comment out the section that is throwing the error, composer update works fine, and even with uncommenting the error handler works fine too. n

Assuming that you’re actually running an Apache server — since I would imagine you’d see this error if trying to execute it on an nginx server — what happens when you comment out that bit of your error handler? Is another error thrown? Could it also be having a problem since a command line request isn’t routed through Apache? n»,»bodyInMarkdown»:»Assuming that you’re actually running an Apache server — since I would imagine you’d see this error if trying to execute it on an nginx server — what happens when you comment out that bit of your error handler? Is another error thrown? Could it also be having a problem since a command line request isn’t routed through Apache?»,»replies»:[],»user»:<«id»:37851,»username»:»trip.somers»,»avatar»:»//unavatar.io/github/trip-somers»,»experience»:<«award_count»:»2″,»level»:3,»points»:»12,080″,»pointsUntilNextLevel»:»2,920″>,»achievements»:[<«id»:16,»name»:»Ten Thousand Strong»,»description»:»Earned once your experience points hits 10,000.»,»level»:»intermediate»,»icon»:»ten-thousand-strong.svg»>],»reported»:null,»staff»:false,»subscribed»:false,»profile»:<«full_name»:null,»bio»:null,»twitter»:»»,»github»:»trip-somers»,»website»:»»,»employment»:»»,»job_title»:»»,»location»:»Plano, TX»,»flag»:null,»available_for_hire»:1>,»dateSegments»:<«created_diff»:»6 years ago»>,»settings»:<«show_profile»:true>,»links»:<«profile»:»https://laracasts.com/@trip.somers»>>,»likes»:[],»created_at»:»2016-11-01T13:39:49.000000Z»,»links»:<«delete»:»/discuss/replies/291008″,»like»:»/discuss/replies/291008/likes»,»best_answer»:»/discuss/conversations/39726/best»>,»best_answer»:false,»dateSegments»:<«createdDiff»:»6 years ago»>>,<«id»:315030,»conversation_id»:39726,»body»:»

The same error also occurred on my project right after I made a new entry to the app.php->providers, n

Turns out I was missing a comma (,) at the end of the entry even though it was the last in the list. n

Источник

Today We are Going To Solve Script @php artisan package:discover handling the post-autoload-dump event returned with error code 255 in Php. Here we will Discuss All Possible Solutions and How this error Occurs So let’s get started with this Article.

  1. How to Fix Script @php artisan package:discover handling the post-autoload-dump event returned with error code 255 Error?

    To Fix Script @php artisan package:discover handling the post-autoload-dump event returned with error code 255 Error just Follow this steps. This error occurs because of you have missed .env file in your project and Laravel removed Exception and replaced it with Throwable. So you need to fix that in your appExceptionsHandler.php. Then update the dependencies. And after it in your composer.json file, remove classmap block from the autoload section and You have to just add new namespaced class directory mappings just like below example. "autoload": { "psr-4": { "App\": "app/", "Database\Factories\": "database/factories/", "Database\Seeders\": "database/seeders/" } }, After it  just run composer update.You can see your error is removed.

  2. Script @php artisan package:discover handling the post-autoload-dump event returned with error code 255

    To Fix Script @php artisan package:discover handling the post-autoload-dump event returned with error code 255 Error just Run these commands. First of all go to your project directory and type cd bootstrap/cache/ command and again type the del -rf *.php command, After it just update your composer composer update. And at the end run this command rve. It will solve your problem.

Solution 1 : Follow this steps

This error occurs because of you have missed .env file in your project and Laravel removed Exception and replaced it with Throwable. So you need to fix that in your appExceptionsHandler.php. Then update the dependencies. And after it in your composer.json file, remove classmap block from the autoload section and You have to just add new namespaced class directory mappings just like below example.

"autoload": {
    "psr-4": {
        "App\": "app/",
        "Database\Factories\": "database/factories/",
        "Database\Seeders\": "database/seeders/"
    }
},

After it  just run composer update.You can see your error is removed.

Solution 2 : Run these commands

First of all go to your project directory and type cd bootstrap/cache/ command and again type the del -rf *.php command, After it just update your composer composer update. And at the end run this command rve. It will solve your problem.

Solution 3 : Try composer require laravel/ui

First of all use

 php artisan serve

And after it try 

composer require laravel/ui

It will solve your error.

Conclusion

So these were all possible solutions to this error. I hope your error has been solved by this article. In the comments, tell us which solution worked? If you liked our article, please share it on your social media and comment on your suggestions. Thank you.

Also Read This Solutions

  • TypeError: worker() takes 0 positional arguments but 1 was given
  • TypeError: Cannot read properties of undefined (reading ‘id’) in Angular
  • No index signature with a parameter of type ‘string’ was found on type ‘{}’
  • Warning: Functions are not valid as a React child. This may happen if you return a Component instead of from render
  • Error: [PrivateRoute] is not a component. All component children of must be a orbash: pip: command not found

Понравилась статья? Поделить с друзьями:
  • Scarface как исправить текстуры
  • Scanning bios image in hard drive как исправить ошибку
  • Pssh exited with error code 255
  • Psql ошибка подключиться к серверу через сокет var run postgresql s pgsql 5432 не удалось
  • Psql error fatal peer authentication failed for user zabbix