Anastasia Sitnina Anastasia Sitnina - 7 months ago 56
Sass (Sass) Question

PHP shell_exec() SASS --update

I am trying to execute

sass --update
via PHP
function and get an error:

H:\SERVER\htdocs\path\to\project>sass --style compressed --update sass\:deployment\css\ 'sass' is not recognized as an internal or external command, operable program or batch file.

If I run the same command from the cmd manually - it works fine. The current folder is correct - checked with the


When you run the command sass in a shell, your computer has to find the executable program called sass somewhere on your computer. To do this, it looks through a series of folders called your PATH. Your PHP server is most likely running with a different PATH than your command prompt, and as such, is not able to find the executable.

To fix this: From your command prompt, where sass DOES work, run this command: which sass

That will tell you the exact location of sass (for example, it might be /usr/bin/sass or something like that). Once you have that value, replace "sass" in your PHP code with that entire location.