0

My Composer is not Working anymore because I reinstalled PHP.

How to resolve Composer dependency issues after reinstalling PHP on my Laravel project.

Cannot run program "/opt/homebrew/Cellar/php/8.4.5_1/bin/php" No such file or directory

This is the new Path: /opt/homebrew/bin/php

I want to Reload the Composer because I think it's messing up dependencies

Is there a way to Change the Path what I found so far didn't Work, or can I just delete the Composer and install a new one, or would that destroy my Project again?

I tried this inferred php script:

<?php
// Den aktuellen PHP-Pfad herausfinden
$currentPhpPath = exec('which php');

// Den neuen PHP-Pfad festlegen
$newPhpPath = '/usr/local/php/bin/php'; // Ändere diesen Pfad zu deinem gewünschten PHP-Pfad

// Überprüfen, ob der neue PHP-Pfad existiert
if (file_exists($newPhpPath)) {
    // Den aktuellen Pfad setzen
    putenv("PATH=$newPhpPath:" . getenv("PATH"));
    echo "PHP-Pfad erfolgreich geändert zu: " . $newPhpPath;
} else {
    echo "Fehler: Der angegebene PHP-Pfad existiert nicht.";
}
?>
3
  • which operating system? which shell? what is your PATH? have you considered to add the new location to the PATH? was the old location in the PATH? why do you think you have to re-install your PHP project? do you know about the shells hash special built-in?
    – hakre
    Commented yesterday
  • you're supposed to put the executable's parent folder in your path, but you put the executable in your path. it's supposed to be just $newPhpPath = '/opt/homebrew/bin';
    – hanshenrik
    Commented yesterday
  • I'm not sure why you're unable to reinstall Composer. Commented 18 hours ago

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.