Installing mod_python on mac os 10.4.7

Graham Dumpleton Graham.Dumpleton at gmail.com
Sun Jul 29 06:07:51 EDT 2007


On Jul 29, 7:26 am, 7stud <bbxx789_0... at yahoo.com> wrote:
> On Jul 14, 8:34 pm, Graham Dumpleton <Graham.Dumple... at gmail.com>
> wrote:
>
>
>
> > On Jul 15, 10:06 am, Graham Dumpleton <Graham.Dumple... at gmail.com>
> > wrote:
>
> > > On Jul 15, 2:47 am, 7stud <bbxx789_0... at yahoo.com> wrote:
>
> > > > Themod_pythonmanual says this under section 2.1 Prerequisites:
>
> > > > ------
> > > > In order to compilemod_pythonyou will need to have the include files
> > > > for both Apache and Python, as well as the Python library installed on
> > > > your system. If you installed Python and Apache from source, then you
> > > > already have everything needed. However, if you are using prepackaged
> > > > software (e.g. Red Hat Linux RPM, Debian, or Solaris packages from
> > > > sunsite, etc) then chances are, you have just the binaries and not the
> > > > sources on your system. Often, the Apache and Python include files and
> > > > libraries necessary to compilemod_pythonare part of separate
> > > > ``development'' package. If you are not sure whether you have all the
> > > > necessary files, either compile and install Python and Apache from
> > > > source, or refer to the documentation for your system on how to get
> > > > the development packages.
> > > > -----
>
> > > > I installed Apache from source using these instructions:
>
> > > >http://switch.richard5.net/isp-in-a-box-v2/installing-apache-on-mac-o...
>
> > > > but I used a package to install python 2.4.  The package was from
> > > > here:
>
> > > >http://www.pythonmac.org/packages/
>
> > > > and it's a "Universal binary version of Python that runs natively on
> > > > PPC and Intel systems."
>
> > > > But my mac came with Python 2.3.5 pre-installed, so I wonder if I
> > > > already have the necessary "include files for both Apache and Python,
> > > > as well as the Python library" already installed.
>
> > > Have you actually tried to installmod_python? That would be the
> > > quickest way of finding out.
>
> > > Because you are using an alternate Apache than the OS supplied one,
> > > you will need to use the --with-apxs option to configure when building
> > > Python.
>
> > Whoops, --with-apxs option is to configure formod_python, not Python.
>
> > > Unless you really need Python 2.4, it is easier to use the OS
> > > supplied version of Python. If you must use an alternate version, use
> > > the --with-python option to configure formod_pythonto tell it which
> > > version. Depending on where that Python version is installed, you may
> > > also have to fiddle the Apache 'envvars' file as well to get it to
> > > work.
>
> > > Graham
>
> Hi,
>
> Thanks for the response.  Sorry, I didn't respond in a timely manner.
>
> I thought I would give your suggestion a shot and just try installing
> mod_python and see what happens, so I installed mod_python 3.3.1 with
> this command:
>
> $ ./configure --with-apxs=/Library/Apache2/bin/apxs
>
> Here is the output:
>
> --------
> checking for gcc... gcc
> checking for C compiler default output file name... a.out
> checking whether the C compiler works... yes
> checking whether we are cross compiling... no
> checking for suffix of executables...
> checking for suffix of object files... o
> checking whether we are using the GNU C compiler... yes
> checking whether gcc accepts -g... yes
> checking for gcc option to accept ANSI C... none needed
> checking for ar... ar
> checking for a BSD-compatible install... /usr/bin/install -c
> checking whether make sets $(MAKE)... yes
> checking for main in -lm... yes
> checking for an ANSI C-conforming const... yes
> checking your blood pressure... a bit high, but we can proceed
> configure: checking whether apxs is available...
> checking for --with-apxs... /Library/Apache2/bin/apxs executable, good
> checking Apache version... 2.2.4
> checking for Apache libexec directory... /Library/Apache2/modules
> checking for Apache include directory... -I/Library/Apache2/include
> checking for --with-python... no
> checking for python... /Library/Frameworks/Python.framework/Versions/
> Current/bin/python
> checking Python version... 2.4
> checking Python install prefix... /Library/Frameworks/Python.framework/
> Versions/2.4
> checking checking where python libraries are installed... /Library/
> Frameworks/Python.framework/Versions/2.4/lib/python2.4
> checking what libraries Python was linked with... -framework
> Python    -ldl
> checking linker flags used to link Python...
> checking where Python include files are... -I/Library/Frameworks/
> Python.framework/Versions/2.4/include/python2.4
> checking for --with-python-src... no
> checking for --with-mutex-dir... no
> Using MUTEX_DIR /tmp
> checking for --with-max-locks... no
> Using 8 MAX_LOCKS.
> checking for --with-flex... no
> checking for flex... /usr/bin/flex
> found /usr/bin/flex, we'll use this. Use --with-flex to specify
> another.
> checking flex version... configure: WARNING: Flex version 2.5.4 found.
>     Version 2.5.31 or greater is required.  You can generally ignore
> this
>     warning unless you need to regenerate psp_parser.c from
> psp_parse.l.
>     If you do need regenerate psp_parser.c, use --with-flex to specify
> the
>     location of the correct flex version. See the README for more
> information.
> configure: creating ./config.status
> config.status: creating Makefile
> config.status: creating src/Makefile
> config.status: creating Doc/Makefile
> config.status: creating src/include/mod_python.h
> config.status: creating test/Makefile
> config.status: creating test/testconf.py
> config.status: creating dist/setup.py
> config.status: creating dist/Makefile
> -----
>
> So it looks like it installed fine--although I notice it picked up
> python 2.4 and you said it was easier to install mod_python using the
> pre-installed python 2.3.3.
>
> Then I tried to test the installation following the test in the
> mod_python manual, which says to add the following to Apache's
> http.conf file:
>
> <Directory /some/directory/htdocs/test>
>     AddHandler mod_python .py
>     PythonHandler mptest
>     PythonDebug On
> </Directory>
>
> I did that, but when I started Apache, I got this error:
>
> ---
> Syntax error on line 474 of /Library/Apache2/conf/httpd.conf:
> Invalid command 'PythonHandler', perhaps misspelled or defined by a
> module not included in the server configuration
> ---
>
> Any ideas what went wrong?

Have you got an appropriate LoadModule directive in Apache
configuration to load the mod_python module? That you get this error
is indicative of mod_python module not being loaded. You can check the
Apache error logs to see if mod_python got loaded.

See:

  http://www.dscpl.com.au/wiki/ModPython/Articles/GettingModPythonWorking

for more help on debugging.

Graham






More information about the Python-list mailing list