Symfony "no PHP binaries detected"
Asked Answered
D

4

8

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?

Dyson answered 4/10, 2020 at 15:58 Comment(1)
In my case, skipping symfony and using this approach was the solution.Cosper
D
26

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.

Dyson answered 4/10, 2020 at 16:4 Comment(1)
Extra note: This solution was found by typing "symfony --help" in command line. Seems that is still a valid option sometimes. :)Dyson
R
7
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.

Rhodesia answered 14/6, 2021 at 1:31 Comment(0)
G
0

It seems you might have moved or deleted the PHP binary that Symfony was using, or Symfony is unable to detect the PHP binary. Running symfony local:php:refresh can help Symfony find the correct PHP binary to use.

Gebhardt answered 28/7 at 11:55 Comment(0)
P
-1

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!

Pop answered 1/8, 2022 at 5:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.