PHP/Apache problem

PHP/Apache problem

Post by Carl Greenhalg » Mon, 11 Feb 2002 21:08:59



I'm having problems getting PHP working on my fbsd box (4.5-R). I have
configured and installed both Apache (1.3.23) and PHP (4.1.1). Apache is
working fine with html files, but my browser (IE5.5) prompts me with "You
have chosen to download a program from this location" when I browse to a php
file (.php). If I then try to open it I get the php source code listing.

Apache was compiled
with: --prefix=/usr/local/apache --enable-module=rewrite --enable-shared=rew
rite

PHP was compiled with: --with-apache=../apache_1.3.23 (where my apache
config is)

/usr/local/apache/bin/httpd -l shows both http_core.so and mod_so.c

I have the mime type "AppType application/x-httpd-php .php" in my httpd.conf
file

Any help appreciated.

 
 
 

PHP/Apache problem

Post by Jason Bourn » Mon, 11 Feb 2002 21:37:54



> I'm having problems getting PHP working on my fbsd box (4.5-R). I have
> configured and installed both Apache (1.3.23) and PHP (4.1.1). Apache is
> working fine with html files, but my browser (IE5.5) prompts me with
> "You have chosen to download a program from this location" when I browse
> to a php file (.php). If I then try to open it I get the php source code
> listing.
[snip]
> I have the mime type "AppType application/x-httpd-php .php" in my
> httpd.conf file

> Any help appreciated.

Greetings:

        After the build did you copy the php.ini to Apache dir? Also below is
snippet from my httpd.conf. Notice Addtype vs AppType. I also have php3
uncommented so I can use both.

------------------------------------------------------    
    # AddType allows you to tweak mime.types without actually editing it,
or to
    # make certain files to be certain types.
    #
    # For example, the PHP 3.x module (not part of the Apache
distribution - see
    # http://www.php.net) will typically use:
    #
    AddType application/x-httpd-php3 .php3
    #AddType application/x-httpd-php3-source .phps
    #
    # And for PHP 4.x, use:
    #
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php-source .phps
-------------------------------------------------------

Also, once you get php working you can make a file xxwhateverxx.php with
this:

<?php
phpinfo();
?>

and it will display every parameter.

 
 
 

PHP/Apache problem

Post by Carl Greenhalg » Mon, 11 Feb 2002 23:42:48



...

Quote:>         After the build did you copy the php.ini to Apache dir? Also below
is
> snippet from my httpd.conf. Notice Addtype vs AppType. I also have php3
> uncommented so I can use both.
...
>     AddType application/x-httpd-php .php
>     AddType application/x-httpd-php-source .phps

...

Hi Jason,

I copied the php.ini-dist to /usr/local/lib/php.ini and I have both of those
as "AddType" lines in my httpd.conf

I built by...

cd apache_1.3.23/
./configure --prefix=/usr/local/apache --enable-module=rewrite --enable-shar
ed=rewrite
make
make install
cd ../php-4.1.1/
./configure --with-apache=../apache_1.3.23
make
make install
cp php.ini-dist /usr/local/lib/php.ini

...and then added the mime types in httpd.conf, started Apache with
/usr/local/apache/bin/apachectl start

I have a test.php file with...

<?
phpinfo();
?>

..but my browser wants to download it. Nuts.

 
 
 

PHP/Apache problem

Post by Jason Bourn » Tue, 12 Feb 2002 00:11:49


[snip]

Quote:> I built by...

> cd apache_1.3.23/
> ./configure --prefix=/usr/local/apache --enable-module=rewrite
> --enable-shar ed=rewrite

It is two steps to the configure process. I don't think I can explain it
right. You ./configure apache but don't make or make install yet. You
then configure php, build + install. Then you go back to the apache and
configure a second time to include the php module. Then make + make
install, then the copy php.ini and edit the httpd.conf stuff. This two
step build is what gets apache to build with the php module. The very
next two lines below are out of sequence:

        > make
        > make install

Quote:> cd ../php-4.1.1/
> ./configure --with-apache=../apache_1.3.23
> make
> make install
> cp php.ini-dist /usr/local/lib/php.ini

> ...and then added the mime types in httpd.conf, started Apache with
> /usr/local/apache/bin/apachectl start

[snip]

Here is a URL with the instructions I used to do mine. It is a Linux
procedure, but all you have to do adjust the paths to be correct and it
works. You may not need the --with-mysql if you're not going to do
database access. If you are, install + setup Mysql first.

        http://www.linux-mag.com/online/php_03.html

I think they explain it better. It worked flawlessly for me.

 
 
 

PHP/Apache problem

Post by Paul Southwor » Tue, 12 Feb 2002 01:15:43




>I'm having problems getting PHP working on my fbsd box (4.5-R). I have
>configured and installed both Apache (1.3.23) and PHP (4.1.1). Apache is
>working fine with html files, but my browser (IE5.5) prompts me with "You
>have chosen to download a program from this location" when I browse to a php
>file (.php). If I then try to open it I get the php source code listing.

I'm wondering if the PHP module is loaded at all.  Do you have
a LoadModule and an AddModule line in httpd.conf for the PHP module?

Have you considered installing this kind of software via the ports system?
That's what it's for.

--Paul

 
 
 

PHP/Apache problem

Post by Carl Greenhalg » Tue, 12 Feb 2002 04:51:55


A-ha, problem solved:-

cd apache_1.3.23/
./configure --prefix=/usr/local/apache --enable-module=rewrite --enable-shar
ed=rewrite
make
make install
cd ../php-4.1.1/
./configure --with-apache=../apache_1.3.23/ --with-apxs=/usr/local/apache/bi
n/apxs
make install (note: no make)
cp php.ini-dist /usr/local/lib/php.ini
...add the mime types to http.conf

If I'd read the docs properly in the first place and not assumed what to do
next, I'd have this sorted earlier.

Thanks for the help and input,

--= Carl

 
 
 

1. Apache w/ PHP and SSL: w/ PHP OK - w/out PHP NOK

Hi,

        I've been assigned the task of building an Apache server with
support for Sybase, PHP4, OpenSSL 0.9.6/mod_ssl ?, and apache 1.3.14.

I followed Israel Denis Jr/Eugene Otto's "The Soothingly Seamless
Setup of Apache, SSL, MySQL, and PHP" at DevShed, but compilation of
apache fails if I add PHP.  The same procedure w/out PHP works OK
(either port 80 or port 443.) As a non-developper, I'm totally in the
dark.

[/home/samba/temp/Apache/apache_1.3.14]# SSL_BASE=../openssl-0.9.6
/configure --enable-module=ssl
--activate-module=src/modules/php4/libphp4.a --enable-module=php4
--prefix=/usr/local/apache

Configuring for Apache, Version 1.3.14
(snip)
-L/home/samba/temp/Apache/openssl-0.9.6  -o helpers/dummy
helpers/dummy.c   -rdynamic -Lmodules/php4 -L../modules/php4
-L../../modules/php4 -lmodphp4  -lpam  -ldl -lresolv -lm -ldl -lcrypt
-lnsl  -lresolv   -lm -lcrypt  -lssl -lcrypto
/usr/bin/ld: cannot find -lmodphp4
collect2: ld returned 1 exit status
make: *** [dummy] Error 1

Any idea?

Thx
FF.

2. IBM to BUY MICROSOFT!!!!

3. Solaris - PHP- Apache- Oracle : Problem getting PHP installed

4. linux ppp HOWTOs and Docs, et. al.

5. Apache Rewrite domain.com->index.php domain.org->index2.php

6. 3COM Impact IQ 230k ISDN Modme

7. php problem or apache problem?

8. wu-ftpd 2.4 guest-feature?

9. Apache+PHP+mod_perl configures ok, but Apache won't build

10. Problems compiling Perl & PHP into Apache

11. Conceptual Problem (apache/php/etc.)

12. apache+PHP problem

13. Problem with second included PHP file using Apache