# Using Sage in a Python CGI script

I am writing cgi scripts in python that use sage. I have been researching for weeks and even the python and sage websites say use: "from sage.all import *" in your python script, and have "#!/usr/bin/env sage -python" as the first line of the script.

Here is the exact quote from sagemath faq on what to do: " The following standalone Sage script factors integers, polynomials, etc:

```
#!/usr/bin/env sage -python
import sys
from sage.all import *
if len(sys.argv) != 2:
print "Usage: %s <n>"%sys.argv[0]
print "Outputs the prime factorization of n."
sys.exit(1)
print factor(sage_eval(sys.argv[1]))
```

In order to use this script, your SAGE_ROOT must be in your PATH."

I made the cgi file exactly as is, and put onto my web server (Apache running CentOS), with sage and python installed. When I try to run this file (named factor.cgi) through the bash terminal I do:

```
$ ./factor.cgi 2006
/usr/bin/env: sage -python: No such file or directory
```

Any help on what I should do to make this script work would be appreciated.