Azakur4 / autocomplete-php

Autocomplete provider for PHP - Atom
MIT License
22 stars 13 forks source link

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

Closed marek1545 closed 8 years ago

marek1545 commented 9 years ago

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 commented 9 years ago

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

marek1545 commented 9 years ago

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 commented 9 years ago

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 commented 9 years ago

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 commented 9 years ago

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 commented 9 years ago

Hi Arak what version of window u are using?

ArakTaiRoth commented 9 years ago

Windows 8.1

Azakur4 commented 9 years ago

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 commented 9 years ago

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 commented 9 years ago

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 commented 9 years ago

@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 commented 9 years ago

@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 commented 9 years ago

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 commented 9 years ago

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

wasikuss commented 9 years ago

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 commented 9 years ago

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

hao203 commented 8 years ago

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

jeroldhaas commented 8 years ago

@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 commented 8 years ago

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 commented 8 years ago

@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 commented 8 years ago

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

muwu0505 commented 8 years ago

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

miyanialkesh7 commented 7 years ago

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

8Ozymandias commented 6 years ago

@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 commented 6 years ago

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 commented 6 years ago

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

Trevorton27 commented 6 years ago

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 commented 5 years ago

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

jetr6445 commented 4 years ago

Thanks!!! @rahuls360

saidbakr commented 4 years ago

@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?