Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

fclose(): Argument #1 ($stream) must be of type resource, bool given

I just restart my laravel 8.0 project and I got this below error, please what could be wrong, this happens anytime I run "PHP artisan serve"

   TypeError

  fclose(): Argument #1 ($stream) must be of type resource, bool given

  at C:\Users\owner\Laravel-App\test-app\vendor\symfony\process\Pipes\WindowsPip
es.php:74
     70▕                         fclose($this->lockHandles[$pipe]);
     71▕                     }
     72▕                     $this->lockHandles[$pipe] = $h;
     73▕
  ➜  74▕                     if (!fclose(fopen($file, 'w')) || !$h = fopen($file
, 'r')) {
     75▕                         flock($this->lockHandles[$pipe], \LOCK_UN);
     76▕                         fclose($this->lockHandles[$pipe]);
     77▕                         unset($this->lockHandles[$pipe]);
     78▕                         continue 2;
       continue 2;

  1   C:\Users\owner\Laravel-App\test-app\vendor\symfony\process\Pipes\WindowsPi
pes.php:74
      fclose()

  2   C:\Users\owner\Laravel-App\test-app\vendor\symfony\process\Process.php:130
4
      Symfony\Component\Process\Pipes\WindowsPipes::__construct()
like image 968
sheriff123 Avatar asked Feb 08 '21 21:02

sheriff123


3 Answers

You can open the task manager then look for CLI (with the php logo) background process, if you find it then kill task

like image 160
Ahmad Ridhoni Avatar answered Oct 19 '22 19:10

Ahmad Ridhoni


I had a Laravel application running that I forgot about (in the terminal of another IDE). Ctl + C (killing) that allowed me to get past this error msg.

like image 24
Andrew Koper Avatar answered Oct 19 '22 17:10

Andrew Koper


Don't restart, don't uninstall, don't panic !

If you are on Windows Machine then follow these below step :

  1. Click the Start charm.

  2. Type cmd, right-click the Command Prompt tile, and then click Run as administrator.

  3. Type tasklist /v | find "php" press enter and find the PID of php.exe

  4. Kill the process by taskkill /PID <PID> /F

  5. You are done.

like image 2
sta Avatar answered Oct 19 '22 19:10

sta