Ask Your Question

$HOME is not set when calling through sage -python and PHP

asked 2014-01-26 18:33:36 -0500

kasuals gravatar image

I am making a PHP exec() call to a python script that imports sage. sage -python executes it, but thinks that $HOME is not set. The user for Apache is www-data, and /var/www is set in the passwd file for it's home path.

Here is the error from sage in my Apache error.log:

Error: environment variable $HOME is not set. Error setting environment variables by sourcing '/usr/lib/sagemath/spkg/bin/sage-env'; possibly contact sage-devel

HOME is set for the user executing the script (www-data) and is set to /var/www, so when www-data executes it, $HOME should be set yes? Is this a setting I'm missing in my sage-env?

Thank you in advance!

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2014-01-29 12:24:54 -0500

p3d40 gravatar image

I had the same problem and what I did was to set the HOME variable in the apache configuration file.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2014-01-26 18:33:36 -0500

Seen: 640 times

Last updated: Jan 29 '14