what do you get if you do just:
exec("convert c.jpg -fuzz 15% -fill black -opaque 'rgb(255,230,165)' -fuzz 40% -fill white +opaque black c2.jpg");
from the original c.jpg without the -quality step and without the other post processing? Note you don't need all the -quality 100 steps except at the end, and only if you want something other than the default of 85. And I am not sure why you need to negate in order to shave. I don't think that is necessary unless you want the invert the resulting black and white?
If you get the above working then we can streamline your other steps into one command.
The -fuzz 15% -fill black -opaque 'rgb...' step changes the text color (and others within the fuzz factor) to black. The -fuzz 40% -fill white +opaque black changes all non-black colors within the fuzz factor to white.
What version of IM are you using? Perhaps your version is too old and/or has a bug. I am using the current version 6.5.2-8 Q16 on Mac OSX Tiger.
<?php
system("convert -version");
?>
or
<?php
$IM_version=shell_exec("convert -version");
echo $IM_version
?>
I presume that your system is setup to know where IM is located as you have not provided the full path to IM, such as /usr/local/bin/convert or whatever it is on your presumably Windows system?
If you are on Windows, see
http://www.imagemagick.org/Usage/windows/
I am not a Windows user, and don't know if in PHP on Windows if you need to escape (double) the % as in %%
Also for PHP scripting see
http://www.imagemagick.org/Usage/api/#php
For IM newbies, good reading at
http://www.imagemagick.org/Usage/