Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't work: 'php' could not be spawned. #11

Closed
marek1545 opened this issue May 12, 2015 · 30 comments
Closed

Don't work: 'php' could not be spawned. #11

marek1545 opened this issue May 12, 2015 · 30 comments
Labels

Comments

@marek1545
Copy link

I had funny problem. I install your package And when i go to php files and start writing a have problem:

'php' could not be spawned. Is it installed and on your path? If so please open an issue on the package spawning the process.

Can't you tell step by step install process. Maybe I should add or change something in files autocomplete?

@Azakur4
Copy link
Owner

Azakur4 commented May 12, 2015

Like say the readme in the package u need have php in ur environment path to run it. What OS u have?

@marek1545
Copy link
Author

Ok I understand that i must declarate path but i don't where in settings? in file autocomplet-plus but in which?. I start use atom from 24 hours. Sorry for problem.

@Azakur4
Copy link
Owner

Azakur4 commented May 13, 2015

u need to config in ur operation system the environment path if u have windows u can do this:

Editing Environmental Variables
First, we shall set the environmental variables we need to ensure the PHP can be used by Apache.

In all versions of Windows:

Right click the My Computer icon and open the Properties dialogue.

Go to "Advanced" or "Advances System Variables" and then to "Environment Variables" and in the "System variables" section select "Path" and click the Edit button.

At the end of the path statement, add the text ";C:\put-the-path-of-ur-php-folder\bin" Note the first character is a semi-colon, this is a separator, it separates different parts of the path statement, do not forget to put it in, and do not put it at the end of the line. There are no spaces in the path statement. Save the file by clicking on OK. Close and exit the My Computer Properties dialogue.

@jeroldhaas
Copy link

Since many other linters support a configuration where one may enter the full path of php.exe, it might be a good idea to have the PATH environment as an optional choice for when nothing is entered into the "path to php executable."

@ArakTaiRoth
Copy link

My development environment is on Windows and I've installed this package. As soon as I try typing anything inside a PHP file I get the titled error, more specifically, "'php' could not be spawned. Is it installed and on your path? If so please open an issue on the package spawning the process.". This is followed by an error in the console, "Uncaught Error: spawn php ENOENT".

I have verified this is the package causing the problem as the problem disappears as soon as I disable only this package. In addition I have verified that the directory for PHP is in my path, and has been loaded by Atom, by checking the process.env.PATH variable while loaded. I also have verified that it is functioning on my system with the command "php -v", which I can run from any directory.

Sorry to dredge up an old topic, but it's the exact same situation, so I felt it was appropriate here.

@Azakur4
Copy link
Owner

Azakur4 commented Jun 5, 2015

Hi Arak what version of window u are using?

@ArakTaiRoth
Copy link

Windows 8.1

@Azakur4
Copy link
Owner

Azakur4 commented Jun 5, 2015

umm that is rare, im testing in a windows 8.1 and works fine. this happen to u in every php file or maybe in one in special.

@ArakTaiRoth
Copy link

The problem appears to have gone away with the latest update (just updated 30 minutes ago). So I guess we can say this is solved.

@manan88
Copy link

manan88 commented Jul 17, 2015

Hello ArakTaiRoth

I am using Windows 8.1 and getting this error after installing automplete-php package.

'php' could not be spawned. Is it installed and on your path? If so please open an issue on the package spawning the process.

Can you please guide me how to fix that.

Thanks.

@jeroldhaas
Copy link

@manan88 php.exe has to be added to the PATH system environment variable.

Again I strongly suggest that instead of relying on PATH, a simple text box be added to configuration so the end-user can point to whichever php.exe they choose, and have this package default to PATH settings when nothing is entered in the text box.

@manan88
Copy link

manan88 commented Jul 17, 2015

@jeroldhaas Sorry but I am not technical but can you guide me step by step to resolve this error. I will thankful if you support me :)

I have installed fresh step of Atom and after that I have download package(autocomplete-php).

@jeroldhaas
Copy link

You'll need PHP installed on your machine. Find the location of the file php.exe on your computer (on my machine it's at c:\xampp\php\). This is the folder that you'll need to add to your system PATH.

To set PATH environment variable, go to Control Panel and type environ into the search at top, like this:
image

Click on "Edit the system environment variables," and then click on the "Environment Variables..." button.
image

On the lower section of the new window that opens, find Path and edit that. Each entry to this variable is separated by a ; so be sure to add that first to the end, then the path to where you have php.exe installed.

image

After you make these changes, restart Atom. You may need to log out of Windows and log back in, possibly even restart the computer, for the changes to PATH to take effect.

@manan88
Copy link

manan88 commented Jul 17, 2015

@jeroldhaas Thanks for the great support. Now I am getting php automplete :) 👍

@wasikuss
Copy link
Contributor

Maybe better will be adding option in settings to manually specify path if it is not in PATH?

Like in linter-php:
capture

I can do PR.

@jeroldhaas
Copy link

@wasikuss that would be optimal, yes, with a default to PATH if the text box is empty. 😄

@hao203
Copy link

hao203 commented Dec 9, 2015

My system is win10, I add them to the PATH system environment variable, but it still not work

@jeroldhaas
Copy link

@hao203 It's better now to configure the package by entering the path to php executable in package settings, since that option has been added.

@DAV9854
Copy link

DAV9854 commented Mar 9, 2016

Hi @Azakur4 , I too am having the same issue but I am running xubuntu 14.04 LTS. How would I configure it so this error stops occurring?

@jeroldhaas
Copy link

@DAV9854 make sure your php executable has execute bit set for the user / group trying to run it. You may have to add that user to the same group the php executable is ownership is set.

@DAV9854
Copy link

DAV9854 commented Mar 9, 2016

Thanks @jeroldhaas, I am now able to run this error free!

@muwu0505
Copy link

@jeroldhaas Thanks for the great support,it's useful!!! :)

@miyanialkesh7
Copy link

I am using XAMPP 7.0.9 with ubuntu 16.04 system. Is there any help possible to resolve the same issue?

@8Ozymandias
Copy link

@jeroldhaas I appreciate the thoroughness of your response. I have found that many answers and explanations and or READMEs are very lacking at least from the perspective of beginners or newbs. Please continue being a great help and giving clear explanations for e.g. with pictures like you did responding to @manan88

@rahuls360
Copy link

  1. Find the location of your php.exe file
  2. Search for php.exe in your main drive in the file explorer (C Drive for me)
  3. My location was C:\xampp\php\php.exe
  4. Add it as system variable (as mentioned by @jeroldhaas )
  5. Give the path as the parent folder of php.exe (C:\xampp\php)
  6. Press Ok and save changes

To test if its working

  1. Open cmd
  2. type 'php -v' from any file path other than (C:\xampp\php)
  3. If you get a version number as output, its working.
  4. Restart Atom and verify

@artembusygin
Copy link

Спасибо. Очень помогли с решением данной проблемы.

@Trevorton27
Copy link

Thank you for posting this. This was a really frustrating thing to deal with. I lost about an hour trying to figure it out on my own. :-)

Awesome solution.

@Ri-Drach
Copy link

Thank you @jeroldhaas , I followed all your steps on my pc and it is works perfectly.

@jetr6445
Copy link

jetr6445 commented Apr 10, 2020

Thanks!!! @rahuls360

@saidbakr
Copy link

@DAV9854 make sure your php executable has execute bit set for the user / group trying to run it. You may have to add that user to the same group the php executable is ownership is set.

I have the same issue on Ubuntu 18.04. However, I could not able to do what you have said about execution permissions. In other words, I don't know how to do it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests