I've encountered same problem, and has identified the cause. We're using CentOS and user "apache" didn't have the permission to create directories in it's home, which is /var/www. Erros I got when running commands as apache were:
$ /usr/bin/latex --interaction=nonstopmode --output=ps /var/www/data/merlin/temp/latex/db2c39f297252dc0db1fb26bf1cb69f9.tex
/usr/bin/latex: option `--output=ps' is ambiguous
This is pdfeTeX, Version 3.141592-1.21a-2.2 (Web2C 7.5.4)
entering extended mode
! I can't write on file `db2c39f297252dc0db1fb26bf1cb69f9.log'.
Please type another transcript file name
! Emergency stop
No pages of output.
So, I did the following as root:
# mkdir /var/www/.texmf-var
# chown apache:apache /var/www/.texmf-var
and that solved all my issues. It seems that TeX/LaTeX is working now like a charm!