Solved

httpd and php3

Posted on 2000-03-19
17
581 Views
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-3.0.1.12-6 (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
[FAILED]

Any help?
0
Comment
Question by:matt51
17 Comments
 
LVL 40

Expert Comment

by:jlevie
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.

Interested?
0
 

Expert Comment

by:brad_fuller
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

0
 

Author Comment

by:matt51
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.
0
 

Author Comment

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

Accepted Solution

by:
jlevie earned 200 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
   --and/or--
  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
0
 
LVL 1

Expert Comment

by:Sokka
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
6.make
7. make install
8.change the option as directed by readme file
9. restrat the daemon
10 check the application
0
 

Author Comment

by:matt51
ID: 2651069
Sokka,

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

Author Comment

by:matt51
ID: 2651075
Adjusted points from 50 to 100
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 

Author Comment

by:matt51
ID: 2651076
jlevie,

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?
0
 
LVL 40

Expert Comment

by:jlevie
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?
0
 

Author Comment

by:matt51
ID: 2665751
Adjusted points from 100 to 150
0
 

Author Comment

by:matt51
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]
0
 

Author Comment

by:matt51
ID: 2665831
The HD crashed.
0
 

Author Comment

by:matt51
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:

#!/bin/sh
##
##  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
e/conf
#
# Compiler output produced by configure, useful for debugging
# configure, is in ./config.log if it exists.

0
 
LVL 40

Expert Comment

by:jlevie
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.
0
 

Author Comment

by:matt51
ID: 2675117
Adjusted points from 150 to 200
0
 

Author Comment

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

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

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…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

762 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now