httpd and php3

Posted on 2000-03-19
Medium Priority
Last Modified: 2010-03-18
I am running Redhat 6.1.  I am trying to install IMP (imap webmail).  In order to do that I need PHP working.  I have installed php3- (an RPM). I then uncommented LoadModule php3_module  libexec/libphp3.so and AddModule mod_php3.c from the httpd.conf.  I also uncommented    AddType application/x-httpd-php3 .php3 AddType application/x-httpd-php3-source .phps from srm.conf.  

I went to restart httpd and I received this error: tarting httpd: Syntax error on line 171 of /etc/httpd/conf/httpd.conf:
Invalid command 'LoadModule', perhaps mis-spelled or defined by a module not included in the server configuration

Any help?
Question by:matt51
LVL 40

Expert Comment

ID: 2634497
Somebody else might have had better luck, but I was never able to get IMP to work properly with the binary distributions of Apache, php, etc. I do have it working quite well using a setup built from sources, even doing IMP over an SSL encrypted connection.

If you want to try to go that route I've got a "recipe" of sorts that works on Solaris and Linux. Full up, you get an SSL Apache with Php supporting LDAP, IMAP, and the database of your choice.


Expert Comment

ID: 2634763
Assuming you have a working EXE for php in you cgi-bin, try adding this to your httpd.conf (or srm.conf) instead of the module verison.

AddType application/x-httpd-php3 .php3 .phtml

Action php3-script /cgi-bin/php3.cgi

AddHandler php3-script .php3


Author Comment

ID: 2642760
jlevie, I would be interested.  With everything I've read, using the rpm's doesn't work well.  I had planned on intsalling the latest version of apache along with php from source.  Any help you could give would be wonderful.
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.


Author Comment

ID: 2642762
I don't have a working exe
LVL 40

Accepted Solution

jlevie earned 800 total points
ID: 2642896
Okay, Like I said this can build anything from a simple Apache +PhP through a full SSL equipped Apache with LDAP, IMAP, & database. You'll note that I'm a firm believer in building everything from source. As a precaution against confusion, make sure that you remove (rpm -e package-name) any instances of apache, php, etc. from the system before using the following guide.
Also, please let me know if you find an mistakes or omissions so that I can correct them.

Standard server is built with SSL & Php/database/ldap/imap support.
Everything is built with gcc-2.95.2, earlier versions are suspect on
Solaris 7/8. The following describes the packages & dependencies
as of 8 Mar 00:

Apache 1.3.12             - http://www.apache.org/dist/
Mod SSL 2.6.2-1.3.12      - http://www.modssl.org/
  OpenSSL 0.9.5           - http://www.openssl.org/source/
  Mm 1.0.12               - http://www.engelschall.com/sw/mm/
Php 3.0.15                - http://www.php.net/
  Openldap-1.2.9          - http://www.openldap.org/
    db-2.7.7 (BerkeleyDB) - http://www.sleepycat.com/
  Imap (c-client)         - http://www.washington.edu/imap/
  Postgres 6.5.3          - http://www.postgresql.org
  MySQL-3.22.32           - http://www.mysql.org

1. Configure, build & install openssl

   > cd openssl-0.9.5
   > ./Configure solaris-sparcv[8|9]-gcc \   # Solaris Sparc/Ultra
   > ./Configure linux-elf \                 # Linux i386
   > ./Configure linux-sparcv[8|9] \         # Linux Sparc/Ultra
   > --prefix=/opt/Openssl -DSSL_FORBID_ENUL
   > make
   > make test
   > make install

2. Configure & build Mm

   > cd mm-1.0.12
   > ./configure --disable-shared
   > make

4. Configure mod-ssl

   > cd ../mod_ssl-2.6.2-1.3.12/
   > ./configure --with-apache=../apache_1.3.12

5. Now configure, build, and install Apache

   > cd apache_1.3.12
   > SSL_BASE=../openssl-0.9.5 EAPI_MM=../mm-1.0.12 \
   > ./configure --prefix=/opt/Apache \
   > --enable-module=most --enable-shared=max \
   > --enable-module=ssl --enable-shared=ssl --enable-rule=SSL_SDBM
   > make
   > make install
6. (optional) Configure and Build c-client IMAP libs

   > cd imap-4.7b
   > make gso       # Gcc Solaris - see Makefile
   > make lnp       # Linux w/PAM - see Makefile
   > cd c-client
   > mkdir include
   > cp *.h include
   > mkdir lib
   > cd lib
   > ln -s ../c-client.a libc-client.a

7. (optional) And the LDAP libs (we get everything, but only use the libs)
   and I assume that BerkeleyDB is installed.

   > cd openldap-1.2.9
   > CPPFLAGS=-I/usr/local/BerkeleyDB/include \ # Solaris
   > LDFLAGS=-L/usr/local/BerkeleyDB/lib \      # Solaris
   > LIBS="-lpthread -lposix4" \                # Solaris
   > ./configure --prefix=/opt/Ldap
   > make depend
   > make
   > make install

8. Now we can build Php. The assumption is that the database is already built
   and installed. I put 'em in /opt.

   > cd php-3.0.15
   > ./configure --with-apxs=/opt/Apache/bin/apxs --without-gd \
   > --with-mysql=/opt/Mysql \           # Optional MySQL
   > --with-pgsql=/opt/Postgres \        # Optional Postrgres
   > --with-ldap=/opt/Ldap \             # Optional LDAP
   > --with-imap=../imap-4.7b/c-client \ # Optional IMAP
   > --with-config-file-path=/opt/Apache/conf
   > make
   > make install
   > cp php3.ini-dist /opt/Apache/conf/php3.ini

   On Solaris watch out for the LDAP library search path (-L/opt/Ldap/lib)
   getting placed after the libraries (-lldap -llber), configure can
   botch it. Fix by re-arrainging in the top-level Makefile.

9. Check where the php modules are in the Apache conf file. They will wind
   up in an SSL conditional and should be at the global level.

10.Create a certificate. I use a temp dir in the Apache conf dir.
   After I create the certificate I move it to the ssl.* dirs
   using the real or virtual server name, e.g., chaos.domain.com=>chaos.*

   > cd /opt/Apache/conf
   > mkdir ssl.tmp
   > cd ssl.tmp
   > /opt/Openssl/bin/openssl req -new >host.csr
   > /opt/Openssl/bin/openssl rsa -in privkey.pem -out host.key
   > /opt/Openssl/bin/openssl x509 -in host.csr -out host.cert -req \
   > -signkey host.key -days 365
   > mv host.cert ../ssl.crt/chaos.crt
   > mv host.csr ../ssl.csr/chaos.csr
   > mv host.key ../ssl.key/chaos.key

Expert Comment

ID: 2646180
1. U can download TAR.gz from URL pointed by php.net
2.untar it
3.go to that dirctory
4. ./configure with options path
5.if there is any errors surely it must be due to path problem
7. make install
8.change the option as directed by readme file
9. restrat the daemon
10 check the application

Author Comment

ID: 2651069

That is what I did in the first place.  And my question is why I was getting the error above after doing all that.

Author Comment

ID: 2651075
Adjusted points from 50 to 100

Author Comment

ID: 2651076

I removed all rpms and followed all your instructions to the letter.  However, apache isn't using php.  When I went and added the LoadModule and Addmodule to httpd.conf like the php readme said.  I still get that same error.  It's like it is looking for the libphp.so file and cant find it.  (there is no modules directory in apache for modules).  Is that something I have to install separately?
LVL 40

Expert Comment

ID: 2651857
Did you build it as the SSL enabled server and see the note about where the modules are? The PHP build process does add the modules to the httpd.conf file, but on an SSL server they wind up inside the SSL conditional. If the lines:

LoadModule php3_module        libexec/libphp3.so
AddModule mod_php3.c

weren't in your httpd.conf file once you built and installed php, then the configure build & install of php didn't work (and neither will php). Also if you manually added the lines then they are in the conf file twice, and I don't know what Apache would have to say about that.

Minor intermission while Jim experiments... Okay I've just finished building a server according to what's in my recipe. I had the recipe in one window and literally cut & pasted the appropriate lines from the recipe into another teminal window. Other than the fact that I've left out the instructions to uncomment the "AddType" lines for php, everything else worked as expected and the server I built does do php. I know this recipe has been used by a number of other folks to build a php enabled server, so I'm at a bit of a loss as to what's happened.

Can I see the contents of config.status in your apache source dir and the configure line near the top of the config.status file in the php source dir?

Author Comment

ID: 2665751
Adjusted points from 100 to 150

Author Comment

ID: 2665752
Sorry for the delay.  The HD in my machine and I had to reinstall Linux.  I get to the point where I'm configuring Apache and I get this:
Configuring for Apache, Version 1.3.12
 + using installation path layout: Apache (config.layout)
Creating Makefile
Creating Configuration.apaci in src
 + enabling mod_so for DSO support
Error: Cannot find SSL binaries in /bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/usr/bin/X11:/usr/X11R6/bin:/root/bin
Creating Makefile in src
 + configured for Linux platform
 + setting C compiler to gcc
 + setting C pre-processor to gcc -E
 + checking for system header files
 + adding selected modules
    o rewrite_module uses ConfigStart/End
 + using -lndbm for DBM support
      enabling DBM support for mod_rewrite
    o dbm_auth_module uses ConfigStart/End
    o ssl_module uses ConfigStart/End
      + SSL interface: mod_ssl/2.6.2
      + SSL interface build type: DSO
      + SSL interface compatibility: enabled
      + SSL interface experimental code: disabled
      + SSL interface conservative code: disabled
      + SSL interface vendor extensions: disabled
      + SSL interface plugin: Built-in SDBM
      + SSL library path: [SYSTEM]

Author Comment

ID: 2665831
The HD crashed.

Author Comment

ID: 2674064
Ok, ignore my last post.  I tried it one more time and everything worked OK.  I moved the LoadModules and AddModules out of the ssl conditional.  Started up the server and no luck, then I went back and uncommented the addtype.  Then I get this error when restarting the server:

Syntax error on line 774 of /opt/Apache/conf/httpd.conf:
Unrecognized LogFormat directive %x

Here is apache's config.status:

##  config.status -- APACI auto-generated configuration restore script
##  Use this shell script to re-run the APACI configure script for
##  restoring your configuration. Additional parameters can be supplied.

EAPI_MM="../mm-1.0.12" \
SSL_BASE="../openssl-0.9.5" \
../configure \
"--with-layout=Apache" \
"--prefix=/opt/Apache" \
"--enable-module=most" \
"--enable-shared=max" \
"--enable-module=ssl" \
"--enable-shared=ssl" \
"--enable-rule=SSL_SDBM" \

Here is the top of PHP's config.status:

#! /bin/sh
# Generated automatically by configure.
# Run this file to recreate the current configuration.
# This directory was configured as follows,
# on host ns1:
# ./configure  --with-apxs=/opt/Apache/bin/apxs --without-gd --with-config-file-path=/opt/Apach
# Compiler output produced by configure, useful for debugging
# configure, is in ./config.log if it exists.

LVL 40

Expert Comment

ID: 2674092
I won't be able to look closely at the last one I built on RedHat until this evening, but in the meantime... Are you starting Apache via "/opt/Apache/bin/apachectl start" from a shell or by invoking the RedHat init script? Also, if you want to you can email /opt/Apache/conf/http.conf to jlevie@bellsouth.net and I'll look it over.

Oh yeah, the configure lines all look to be correct, so the server should be good.

Author Comment

ID: 2675117
Adjusted points from 150 to 200

Author Comment

ID: 2676041
Thank you very much for your help.  It finally works.

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

I have seen several blogs and forum entries elsewhere state that because NTFS volumes do not support linux ownership or permissions, they cannot be used for anonymous ftp upload through the vsftpd program.   IT can be done and here's how to get i…
Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
In the video, one can understand the process of resizing images in single or bulk. Kernel Bulk Image Resizer is an easy to use tool for resizing large number of images. One can add and resize multiple images with this tool in single go. The video sh…

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question