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

Can't get PHPCBF to work #1768

Closed
jordan-webdev opened this issue Jul 16, 2017 · 6 comments
Closed

Can't get PHPCBF to work #1768

jordan-webdev opened this issue Jul 16, 2017 · 6 comments
Assignees

Comments

@jordan-webdev
Copy link

Description

I've been having trouble getting PHP-CS-Fixer to work, so now I am trying PHPCBF, but that won't even find the executable. I followed the steps on https://github.com/Glavin001/atom-beautify#beautifiers and https://github.com/squizlabs/PHP_CodeSniffer#installation. I tried the CURL and git clone methods, however, if I run "where.exe phpcbf" in my CMD prompt, I get no result, even though I actually see the file on my computer.

path
abspath-min

Debug

Here is a link to the debug.md Gist: https://gist.github.com/jordan-webdev/a3c24b4ff895f4b77037e4194bb10f83

@Glavin001
Copy link
Owner

however, if I run "where.exe phpcbf" in my CMD prompt, I get no result, even though I actually see the file on my computer.

This indicates they are not properly installed. It should at least work in your CMD prompt before Atom-Beautify is able to pick it up.

I see in your logs you have the following Path environment variable:

Path=C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\AMD APP\bin\x86_64;C:\Program Files (x86)\AMD APP\bin\x86;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Users\Jordan.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm;C:\Program Files\Microsoft SQL Server\120\Tools\Binn;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files\Process Lasso;C:\ProgramData\chocolatey\bin;C:\HashiCorp\Vagrant\bin;C:\Users\Jordan\vagrant-local\vv;C:\Program Files\Git\cmd;C:\Program Files\nodejs;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\Program Files\TortoiseSVN\bin;C:\Ruby22\bin;C:\PROGRA~2\Oracle\VirtualBox;C:\Users\Jordan\AppData\Roaming\npm;C:\Users\Jordan\AppData\Local\Microsoft\WindowsApps;C:\Users\Jordan\AppData\Local\atom\bin

Your PHPCBF executable is installed at C:\Users\Jordan\PHP_CodeSniffer\bin\phpcbf which I do not see is in your Path environment variable.

So first things first, you should fix your Path environment variable to include the directory where your executables are installed, in this case C:\Users\Jordan\PHP_CodeSniffer\bin.
You may find https://superuser.com/questions/284342/what-are-path-and-other-environment-variables-and-how-can-i-set-or-use-them and/or https://www.java.com/en/download/help/path.xml helpful.

@Glavin001 Glavin001 self-assigned this Jul 16, 2017
@jordan-webdev
Copy link
Author

Okay, I have installed it to both my system and user PATH variable. The user one seems to be the right one, because after I did that and executed 'where.exe phpcbf', it gave me the path c:\Users\Jordan\PHP_CodeSniffer\bin\phpcbf and c:\Users\Jordan\PHP_CodeSniffer\bin\phpcbf.bat. So I think it's installed correctly, however it still does not work in Atom. Please see gist https://gist.github.com/jordan-webdev/8d8132d395203c00d26ef63dcdebcfd0

@Glavin001
Copy link
Owner

Your Path looks good now:

Path=C:\Program Files (x86)\iis express\PHP\v7.1;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\AMD APP\bin\x86_64;C:\Program Files (x86)\AMD APP\bin\x86;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Users\Jordan.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm;C:\Program Files\Microsoft SQL Server\120\Tools\Binn;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files\Process Lasso;C:\ProgramData\chocolatey\bin;C:\HashiCorp\Vagrant\bin;C:\Users\Jordan\vagrant-local\vv;C:\Program Files\Git\cmd;C:\Program Files\nodejs;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\Program Files\TortoiseSVN\bin;C:\Ruby22\bin;C:\PROGRA2\Oracle\VirtualBox;C:\Users\Jordan\AppData\Roaming\npm;C:\Users\Jordan\AppData\Local\Microsoft\WindowsApps;C:\Users\Jordan;C:\Users\Jordan\PHP_CodeSniffer\bin\phpcbf;C:\Users\Jordan\PHP_CodeSniffer\bin;C:\Ruby22\bin;C:\PROGRA2\Oracle\VirtualBox;C:\Users\Jordan\AppData\Roaming\npm;C:\Users\Jordan\AppData\Local\Microsoft\WindowsApps;C:\Users\Jordan\AppData\Local\atom\bin;C:\Users\Jordan\PHP_CodeSniffer\bin\phpcbf;C:\Users\Jordan\PHP_CodeSniffer\bin;

Did you restart Atom after changing?

I see in your logs the following error:

2017-07-16T19:10:04.699Z - debug: [] spawn C:\Users\Jordan\PHP_CodeSniffer\bin\phpcbf 0=--version
2017-07-16T19:10:04.702Z - debug: [] error Error: spawn C:\Users\Jordan\PHP_CodeSniffer\bin\phpcbf ENOENT

Could you try running the following in your CMD Prompt?

C:\Users\Jordan\PHP_CodeSniffer\bin\phpcbf --version

What is the result?

I think you should configure Atom-Beautify's path to be C:\Users\Jordan\PHP_CodeSniffer\bin\phpcbf.bat instead, since that is the Windows executable. The file at C:\Users\Jordan\PHP_CodeSniffer\bin\phpcbf is actually a PHP file (correct me if I am wrong) and does not have the .php extension which Atom-Beautify uses to detect if it is PHP or Windows executable file.

@jordan-webdev
Copy link
Author

Yes, I restarted.

Result = """@php_bin@" is not recognized as an internal or external command, operable program or batch file.

@Glavin001
Copy link
Owner

Result = """@php_bin@" is not recognized as an internal or external command, operable program or batch file.

After running C:\Users\Jordan\PHP_CodeSniffer\bin\phpcbf --version I assume. I suspected this would be the result.

Did you try the following? I expect this one to work.

C:\Users\Jordan\PHP_CodeSniffer\bin\phpcbf.bat --version

And did you read and try my next recommendation?

I think you should configure Atom-Beautify's path to be C:\Users\Jordan\PHP_CodeSniffer\bin\phpcbf.bat instead, since that is the Windows executable. The file at C:\Users\Jordan\PHP_CodeSniffer\bin\phpcbf is actually a PHP file (correct me if I am wrong) and does not have the .php extension which Atom-Beautify uses to detect if it is PHP or Windows executable file.

@stale
Copy link

stale bot commented Nov 4, 2017

This issue has been automatically marked as stale because it has not had recent activity. If this is still an issue, please add a comment. It will be closed if no further activity occurs. Thank you for your contributions.

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

No branches or pull requests

2 participants