0

I have this PHP script (test.php):

<?php

    $cmd = "/usr/bin/sass --watch file1.scss";

    system($cmd);

?>

Now I call my PHP script from CLI this way:

/usr/bin/php test.php

And I get no output (it should print SASS is watching for changes).

If I call the SASS command directly from the shell, it outputs correctly.

Why?

Info: I'm using the PHP 5.3.6 version on OS X Lion

Edit: Please, note that this command watches for changes, it seems to behave differently to a regular command.

Edit2: The command works, it compiles correctly. The only thing lacking is the output (I want to debug and see errors :)

3 Answers 3

1

Some command line utilities like sass, manipulate the output pipe in some way that PHP can't use.

So, in this particular case, there is no solution.

Sign up to request clarification or add additional context in comments.

Comments

0

system() returns a string. Just echo it.

2 Comments

so, it could be a problem with your PATH. Try do use the full path of sass executable (get it with "which sass")
still not working, I'll update the question making clear that the command works, but it only lacks the output
0

According to http://se.php.net/system you need to pass in a second argument to system() and the return value of the command will be set in that variable:

<?php
system($command, $return);

echo $return;

1 Comment

this does not work either, please note that it is a command that executes itself in a loop watching for changes, so, I'm not searching for a return value, just the normal output (by the way, finalizing the command with ctrl+c outputs nothing in this case)

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.