Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Apache 2 and PHP httpd.conf problem dealing with php mime type

Apache 2 and PHP httpd.conf problem dealing with php mime type
Thread Tools
Fresh-Faced Recruit
Join Date: Nov 2002
Location: Sydney Australia
Status: Offline
Reply With Quote
Dec 9, 2002, 07:04 AM
 
Hi

I have just installed apache v2 and all is fine when handling .html files types.

I have also installed the latest version of PHP, and it is working fine.

The httpd.conf files is rather different in apache v2 from the previous versions. I am unsure where to tell apache how to handle .php and .php4 files types.

Currently it just downloads them, because the apache does not parse the file, and sends it straight to the browser. The browser just downloads it to my desktop.


This is what I modified in the httpd.conf file.

#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
# The index.html.var file (a type-map) is used to deliver content-
# negotiated documents. The MultiViews Option can be used for the
# same purpose, but it is much slower.
#
DirectoryIndex index.html index.html.var index.php index.php4 index.jsp


I have also added the following:


#
# AddType allows you to add to or override the MIME configuration
# file mime.types for specific file types.
#
AddType application/x-tar .tgz
AddType image/x-icon .ico
AddType application/x-httpd-php .php
AddType application/x-httpd-php .php3
AddType application/x-httpd-php .php4
AddType application/x-httpd-php-source .phps

These changes would in the past cause apache to deal the .php and .php4 files correctly.

So what am I missing?

I used the following to install apache 2

./configure --with-layout=Apache --prefix=/usr/local/apache --enable-shared=max --enable-module=all
make
make install

I used the following to install php

./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --enable-track-vars --with-zlib --with-xml --enable-wddx
make
make install

Help welcome.
     
Dedicated MacNNer
Join Date: Jan 2001
Location: Meida, PA USA
Status: Offline
Reply With Quote
Dec 10, 2002, 12:03 AM
 
i've yet to play with Apache 2 yet but don't you still need to uncomment (or add the loadModual lines?

Code:
# LoadModule php4_module libexec/httpd/libphp4.so # AddModule mod_php4.c
~ Mike
--
Personal Site: MikeZornek.com
Other Interests: WebDevWiki.com
     
mrburri  (op)
Fresh-Faced Recruit
Join Date: Nov 2002
Location: Sydney Australia
Status: Offline
Reply With Quote
Dec 10, 2002, 03:50 AM
 
That is the funny thing about the apache 2 conf file. It does not contain:

# LoadModule php4_module libexec/httpd/libphp4.so
# AddModule mod_php4.c

It does not contain any LoadModule or AddModule at all like the apache 1.x.

Any one else have any clues.
     
Forum Regular
Join Date: Mar 2001
Status: Offline
Reply With Quote
Dec 10, 2002, 02:54 PM
 
When you configure PHP, look at the configure output to see if/where it detects Apache. If you still have Apache 1.xx on your system, it may be using that.

You can try configuring using the --with-apache or --with-apxs switches to point PHP directly to the Apache directory you are using. Personally, I always use the --with-apache switch to compile PHP directly into Apache instead of using loadable modules.

You might also try just typing in the LoadModule lines into httpd.conf to see what happens. I remember that PHP has had some problems automatically modifiying this file with certain versions of Apache.
Is this rock and roll, or
a form of state control?
     
mrburri  (op)
Fresh-Faced Recruit
Join Date: Nov 2002
Location: Sydney Australia
Status: Offline
Reply With Quote
Dec 10, 2002, 05:51 PM
 
Thanks folks - but I am going back to apache 1.x - See you soon, when things easer.

If anyone have any more clues - please post.
     
mrburri  (op)
Fresh-Faced Recruit
Join Date: Nov 2002
Location: Sydney Australia
Status: Offline
Reply With Quote
Dec 10, 2002, 09:29 PM
 
I remember that PHP has had some problems automatically modifying this file with certain versions of Apache.
I have gone back to apache 1.x and still nothings after compiling all packages from scratch.

php-4.2.3
apache_1.3.27
mysql-3.23.53

It seems that php-4.2.3 cannot write into the httpd.conf file, and also is failing to cp the *.so files into the /apache/libexec dir.

So I am going to try to change the version of PHP to one I know will work. php-4.0.6.tar.gz - Old but I know it will work.

So Apache is not to blame rather it seems it is PHP.

I will get back to you - if any one else cares about what I am doing here.
     
Dedicated MacNNer
Join Date: Jan 2001
Location: Meida, PA USA
Status: Offline
Reply With Quote
Dec 11, 2002, 02:43 AM
 
Originally posted by mrburri:
I will get back to you - if any one else cares about what I am doing here.
I am. I'm actually curious why you want to go to Apache 2 anyways .. I'm still pleanty happy with the 1.Xes but am curious to hear opions on the new stuff .. why i should move, etc...

best of luck!
~ Mike
--
Personal Site: MikeZornek.com
Other Interests: WebDevWiki.com
     
Forum Regular
Join Date: Mar 2001
Status: Offline
Reply With Quote
Dec 11, 2002, 01:24 PM
 
Originally posted by mrburri:

It seems that php-4.2.3 cannot write into the httpd.conf file, and also is failing to cp the *.so files into the /apache/libexec dir.
Are you sure you are using "sudo make install" to install PHP? If the make install step is not done as root, it will not be able to complete all the installation steps (like copying the .so files).
Is this rock and roll, or
a form of state control?
     
mrburri  (op)
Fresh-Faced Recruit
Join Date: Nov 2002
Location: Sydney Australia
Status: Offline
Reply With Quote
Dec 11, 2002, 05:16 PM
 
I am using su and thus install everything as root.

I will get back to you soon - I just tried, using the php.4.0.6 with apache-2.0.43.tar.gz again the same problem with apache not hook up with php.

I am now going to try the bare basic very out of date install that worked before with all old packages and hope for the best.

This is something strange.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 01:56 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2