Symfony "no PHP binaries detected"

Viewed 6234

Ive been just starting to learn Symfony PHP framework, and Ive run into some problems with its configuration.

When trying to create a new project with command line like so:

symfony new --full my_project

I kept getting a simple error message:

no PHP binaries detected

and no files were created in the current folder. I searched on the net, and found out that Symfony apparently isnt able to find the location of my php.exe, despite it already being set in my system variables. And there was no information about how to properly configure this in Symfony.

How do I fix this error?

3 Answers

Turns out Symfony already contains functions to autodetect installed PHP versions from system variables. The command to fix the Symfony configuration is this:

symfony local:php:refresh

My next attempt to create a new project work fine after that. Also, I suspect this error was the result of me installing PHP files after installing Symfony.

symfony local:php:refresh

doesn't always work. If your php is not in [/usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /usr/games /usr/local/games /snap/bin] and a few other locations (check with symfony local:php:list -vvv) then symfony won't find it.

I compiled my own PHP from source and installed versions 7.4.20 and 8.0.7 in /home/username/php/7.4 and /home/username/php/8.0. If I want to use my PHP 8.0.7, then I have to make a symlink because updating the $PATH doesn't help.

sudo ln -s /home/username/php/8.0/bin/php /usr/local/bin/php

This works and symfony finds it.

Follow below steps:

  • Step 1: download & Install xampp in your system

  • Step 2: open the xampp folder. find php folder and hit enter

  • Step 3: copy the path and paste in your system environment

  • Step 4 : run

    php -v 
    

you are good to go!

Related