06-29-07 06:13 AM
[ https://issues.apache.org/jira/brow...action_12509002 ]
Graham Dumpleton commented on MODPYTHON-225:
--------------------------------------------
When doing this, changes should be made to testhandler to display the variou
s settings, eg sys.executable, in some way.
> Allow Python executable location and Python home to be specified.
> -----------------------------------------------------------------
>
> Key: MODPYTHON-225
> URL: https://issues.apache.org/jira/browse/MODPYTHON-225
> Project: mod_python
> Issue Type: New Feature
> Components: core
> Affects Versions: 3.3.1
> Reporter: Graham Dumpleton
>
> Where a user has multiple versions of Python installed getting mod_python
to work can be problematic.
> The main issue is where a version of Python is installed in a location different t
o where the standard operating system version is installed. For example, if /usr/bin
/python is Python version 2.4 and a user has installed Python version 2.5 as /usr/lo
cal
/bin/python. And the user has compiled mod_python against Python 2.5 and not the operating s
ystem version 2.4.
> Under normal circumstances Apache is only going to look in /usr/bin when started f
rom an init.d script and not in /usr/local/bin. The result of this is that Python wh
en initialised will find /usr/bin/python and assume that that is the base it should
use
to start with to find where the Python library files are installed. In doing
this though it will not be able to find /usr/lib/python2.5 as what it reall
y needs to be able to find is /usr/local/lib/python2.5. The final outcome wi
ll be that mod_python will
not be able to find the Python code files for itself when starting up.
> The only way around this is to set the PATH environment variable in the startup sc
ripts for Apache to look in /usr/local/bin before /usr/bin. Alternatively, on some U
NIX platforms (but not necessarily all) it is possible to set the environment variab
le
PYTHONEXECUTABLE to be the exact location of the Python executable specified
when configuring mod_python. Finally, on UNIX platforms one can also set PY
THONHOME to be the exact location of either a shared platform independent/de
pendent Python library dire
ctory, or where separate directories a colon separated list of the two directories. In the l
atter Python will skip the whole search process and simply use the two values.
> Having to use environment variables to do this can be a pain as it may be necessar
y to modify init.d startup scripts to make it work. What should really be done is th
at mod_python should provide for UNIX platforms the directives PythonExecutable and
Pyt
honHome as equivalents to using the PYTHONEXECUTABLE and PYTHONHOME environment variables. T
hese values if defined can be used in calls to Py_SetProgramName() and Py_SetPythonHome() ap
propriately.
> This will allow the Apache configuration file itself to be used to qualify
which version of Python should be used when non standard versions not in th
e standard locations are being used.
> Note that these directives shouldn't be required on the Windows platform as it use
s the Windows registry to find where the Python library files are located.
[ Post a follow-up to this message ]
|