views:

170

answers:

2

I tried googling for this issue and found many people with the same problem but no solution.

    $result = exec("C:\\Ruby191\\bin\\lessc.bat less\\$file", $output);

Here result is an empty string and output an empty array. Same thing with:

    $result = exec("cmd /c C:\\Ruby191\\bin\\lessc.bat less\\$file", $output);

I am sure the path is correct; I am sure exec() is enabled.

I tried exec, shell_exec, system and none work.

lessc is less CSS.


EDIT

The apache error log says:

'"ruby.exe"' is not recognized as an internal or external command, operable program or batch file.

A: 

First chdir("C:\Ruby191\bin\"), then run lessc.bat.

Sjoerd
I don't want to; I want to stay in my directory.
Andreas Bonini
A: 

I found out the problem; I installed ruby just for this and added it to my PATH environment variable, and it started working immediately for command prompts.

However it didn't work for PHP, so I decided to restart my computer. After that it worked.

Andreas Bonini
That's a bit extreme. Environment variables are set for an application when it starts, and any changes you make later via the system properties won't automatically propagate to already-running apps). All you'd have had to do was restart the web server process.
Marc B