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 to 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/local/bin/python. And the user has compiled mod_python against Python 2.5 and not the operating system version 2.4. Under normal circumstances Apache is only going to look in /usr/bin when started from an init.d script and not in /usr/local/bin. The result of this is that Python when 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 really needs to be able to find is /usr/local/lib/python2.5. The final outcome will 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 scripts for Apache to look in /usr/local/bin before /usr/bin. Alternatively, on some UNIX platforms (but not necessarily all) it is possible to set the environment variable PYTHONEXECUTABLE to be the exact location of the python executable specified when configuring mod_python. Finally, on UNIX platforms one can also set PYTHONHOME to be the exact location of either a shared platform independent/dependent Python library directory, or where separate directories a colon separated list of the two directories. In the latter 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 necessary to modify init.d startup scripts to make it work. What should really be done is that mod_python should provide for UNIX platforms the directives PythonExecutable and PythonHome as equivalents to using the PYTHONEXECUTABLE and PYTHONHOME environment variables. These values if defined can be used in calls to Py_SetProgramName() and Py_SetPythonHome() appropriately. 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 the standard locations are being used. Note that these directives shouldn't be required on the Windows platform as it uses the Windows registry to find where the Python library files are located. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.