1

I have setup the bash feature on my Windows 10, it works well but I can't figure how to use it with PHP, despite a lot of research. I would like to use a popen like this :

$fp = popen("tail ".$file, "r");

But the error.log says that tail is not recognized as an internal or external command. PHP don't recognize any bash commands but they are working in a shell. I have try to edit the environnment variables, the PATH but nothing...

I would really appreciate some help, thanks !

5
  • tail is not a bash command, it is a separate program. It should be located at either /bin/tail or /usr/bin/tail. Commented Nov 21, 2016 at 18:04
  • Are you running the script inside of windows or bash? Commented Nov 21, 2016 at 18:40
  • Well there is no script, I just want to use this command with my php line popen, it works in a shell. But it seems like none of the bash commands are working, even if I have setup bash on Windows. And I know this line is working on a Linux install so ... It's boring. Thanks for your reply. Commented Nov 21, 2016 at 19:25
  • No I meant where are you running the php script. Are you running it from inside windows or from inside the Linux bash? Commented Nov 21, 2016 at 19:27
  • Oh sorry, I run it on my Windows, with EasyPHP. Commented Nov 21, 2016 at 19:36

1 Answer 1

1

You are running PHP from windows. Just because you have Linux Bash installed doesn't mean all the applications that are installed in it are available inside of windows. They are two completely different entities.

If you install php inside of Linux Bash and run the script from Linux it should work.

Another alternative is to install Git for Windows or Cmder or something else like this. They have a windows version of tail, you will just need to make sure it is added to your PATH in windows.

For normal Git for Windows installation you will find it at:

C:\Program Files\Git\usr\bin\tail.exe
Sign up to request clarification or add additional context in comments.

2 Comments

And it's not possible to add the bash of Windows in the PATH to use it like this ? I have try but maybe with the wrong way. Thanks. Edit : And with Git or Cmder I'll be able to use the tail command with PHP ?
If you added bash to the path of windows all that would do is access the executable that runs the VM, not the applications inside the vm. Yes if you use Git for Windows/Cmder they have windows versions of the tail application.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.