Click to See Complete Forum and Search --> : PHP4 + Apache problem


Anon
08-03-2000, 05:07 PM
It seems that whenever I try to access a php page via apache it tries to download the page rather than interpret it! It's driving me insane ...

This is a new install, anyone have any ideas what I should do?

Anon
08-03-2000, 05:48 PM
disable php3 in your httpd.conf

Anon
08-03-2000, 05:52 PM
Actually, the problem is pretty easy. It is an apache config problem, not a PHP problem. Go into your httpd.conf file and add the following lines:

AddType application/x-httpd-php .php

for php 4.0 and up, then any file with a .php extension will be run through the php processor.

if it is php 3, then it is:

AddType application/x-httpd-php3 .php3

Its all in the docs on www.php.net.

Anon
08-04-2000, 02:24 PM
Thank you, your information helped but the problem ended up being a version thing.

As for the info on AddType, I think you meant srm.conf.

Thanks again!

Anon
08-07-2000, 12:46 AM
I had the httpd.conf set up correctly
for PHP4 as follow:
AddType application/s-httpd.php .php
AddType application/x-httpd-phpsource .phps

But got the same problem of downloading
the file instead of interpreting it.

What could be other proble.

How could I tell that PHP is up?

Thanks.

Anon
08-07-2000, 01:56 AM
There are problems that can occur if you have both installed and you are trying to load both into apache. Make sure that you aren't loading both php3 and php4 into your system.

Anon
08-07-2000, 03:11 AM
Thanks David for your prompt respond.

I have a Dell Server that pre-loaded
with RedHat 6.2 and Apache. I am not
very sure that if PHP3 is preloaded
but I can see module like "mod_php.so"
in the system.

What I have ensured is that inside
httpd.conf, I have commented the statement
on the following:
#AddType application/s-httpd.php3 .php3
#AddType application/x-httpd-php3-source .phps

I followed the article:
"The Soothingly Seamless Setup of Apache, SSl, MySQL, and PHP" and comipled all
files without problems.

I have created symbolic link to make
sure that the system using the
httpd.conf I have created instead of
the pre-loaded file.

My questions are as follow:
1. How do I make sure that PHP3 is not
running?
2. How do I check that PHP4 is up?
Can I use ps -ef to check?

Thanks a lot.

Anon
08-07-2000, 12:48 PM
ok, a standard install of RH6.2 includes apache with mod perl and mod php3, I don't know if Dell changes that or not, I can't imagine why they would. Check your httpd.conf, which is the only place where any apache config directives should be these days. I have:

LoadModule php4_module /usr/lib/apache/libphp4.so

and I have commented out:
#LoadModule php_module modules/mod_php.so
#LoadModule php3_module modules/libphp3.so

Later, in the addmodule sections I have:

AddModule mod_php4.c
# AddModule mod_php.c
# AddModule mod_php3.c

the standard RH6.2 httpd.conf has the php3 'AddType' set up in a IfModule directive, so it doesn't load unless you are loading the module.

Then, finally, I have:
AddType application/x-httpd-php .php

The other possibility is that you didn't configure it as a module... my configure directive was:
./configure --with-mysql --with-apxs
the "--with-apxs" is what compiles it as a module.

Hope this helps.

D

Anon
08-07-2000, 01:36 PM
I am having a similar issue. I installed apache 1.3.12 and php4...
The installation instrauctions show that you should look for mod_so.c which I have. Then, everything else looks great...I compiled the PHP the way the INSTALL files says too, and I uncommented the AddType lines in the httpd.conf then restarted apache. Now I get the thing where it wants to download the test.php I created instead of view it. I checked to see if the module was being loaded by doing a httpd -l and it doesnt show any php module. What do I do now?

Anon
08-07-2000, 01:43 PM
Did you make sure the addmodule and loadmodule directives are there for php4?
go to the apache conf file directory and do:
cat * | grep php

make sure that you are doing the loadmodule first, addmodule second, and then the addtype, and that you are only doing it for php4.

Anon
08-07-2000, 02:10 PM
ok for cat * | grep php I got this
# http://www.php.net) will typically use:
#AddType application/x-httpd-php3 .php3
#AddType application/x-httpd-php3-source .phps
#AddType application/x-httpd-php .php
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
# http://www.php.net) will typically use:
#AddType application/x-httpd-php3 .php3
#AddType application/x-httpd-php3-source .phps
#AddType application/x-httpd-php .php
#AddType application/x-httpd-php-source .phps


I take it then that I am missing A few statements...what should they look like..(addmodule??? etc)

Thanks...
DJ

Anon
08-07-2000, 02:49 PM
I have the following two directives. I imagine that you just need to make sure libphp4.so is in the right path. They probably need to go in this order as well. There is a whole section of the conf files with the LoadModule directives, put the php4 one at the end of that, and there is a section with the addmidule directives, put the php4 one at the end of that one, then anywhere after that, put the addtype directive.

LoadModule php4_module /usr/lib/apache/libphp4.so
AddModule mod_php4.c
AddType application/x-httpd-php .php

tell me if this works for you.

Anon
08-07-2000, 02:55 PM
Ok....I think I found my problem...I have no libphp4.so ...is this a compilation problem?

DJ

Anon
08-07-2000, 02:59 PM
If you compiled it, it is somewhere, check the php docs on installation and you may need to use a configure directive to tell where apache is.

Anon
08-07-2000, 03:29 PM
I followed the instructions in the faq for fixing my apsx script and now I get this when I do make


make[1]: Entering directory `/storage/php-4.0.1pl2'
/bin/sh /storage/php-4.0.1pl2/libtool --silent --mode=link gcc -g -O2 -o libph
p4.la -rpath /storage/php-4.0.1pl2/libs -avoid-version -L/usr/local/lib -R /usr
/local/lib stub.lo Zend/libZend.la sapi/apache/libsapi.la main/libmain.la regex/
libregex.la ext/db/libdb.la ext/gd/libgd.la ext/mysql/libmysql.la ext/pcre/libpc
re.la ext/posix/libposix.la ext/session/libsession.la ext/standard/libstandard.l
a ext/xml/libxml.la -lgdbm -lpam -ldl -lttf -lgd -lresolv -lm -ldl -lcrypt -lns
l -lresolv
stub.lo: file not recognized: File truncated
collect2: ld returned 1 exit status
make[1]: *** [libphp4.la] Error 1
make[1]: Leaving directory `/storage/php-4.0.1pl2'
make: *** [all-recursive] Error 1

Anon
08-07-2000, 03:33 PM
You got me on that one, I would just try a
./configure --with-mysql --with-apxs

just like it has in the INSTALL file, and see if that works. You could dump the mysql, but I would just try to get something working.

Anon
08-07-2000, 03:35 PM
OK...I just decided to give up and load it as a static module...No problem. Thanks for the help. I will try it Dynamic again later when I have the time.

Anon
08-09-2000, 12:19 AM
I am also facing similar problem.

I did everythig explained in INSTALL. When I compile the PHP4 as a dynamic module. httpd gives core dump ad don't start.

Anon
08-17-2000, 10:44 PM
i have been having the same problem all afternoon.

i was testing with files with a .php3 extension.. no luck

changed it .php.. no luck

changed httpd.conf from
AddType ... php4 .php

to

AddType ... php .php

made a file with only one thing in it..
<?php
phpinfo();
?>

WORKED !!

the file that used to work with php3 doesn't seem to want to load. i will deal with that later. time to go see my kids..

Anon
10-26-2000, 11:20 AM
Dear all,
I just joined this forum/topic. Sorry for this 'belated'.
I am new in Linux and PHP.
I selected Apache-1.3.12-2 and PHP3 while I was installing RedHat 6.2.
Now I want to upgrade the PHP3 to PHP4.
I did these several steps :
1) Uncompressed the php4 file (my version is php-4.0.3pl1.tar.gz)
2) From the directory of php4 : ./configure --with-mysql --with-apxs.
It didn't work. Like David said, the "--apxs" is what compiles it as a module, but I even didn't find apxs file in my computer.
Please help me. Any help will be very much appreciated.

Thank's in advance,
Kiky

Anon
10-26-2000, 11:38 AM
No problem, I have run into that one before. What you are missing is the apache-devel libraries. Just install the appropriate apache-devel RPM for your apache, and APXS will be there.

Good luck!

Anon
11-17-2000, 05:31 PM
Installing PHP4 module :
When I run ./configure --with-mysql --with-apx under the directory of the PHP4 untar package, a certain number of things goes well apparently but it also says that it can't find ./configure (the one from Apache ?). What's the pb ? I also can only find the httpd.cong, no other .conf and no configuration.tmpl...??
Thanks

Anon
02-06-2001, 02:08 PM
An issue that I'm having is that in Netscape 6, when I try to run a page on the apache server that calls a .php3 file, apache doesn't recognize the file to process and so netscape thinks that it's some mime media type and asks for an application to use to run it. I have the lines in my httpd.conf:

LoadModule php4_module modules/libphp4.so
AddModule mod_php4.c
AddType application/x-httpd-php3 .php3


any ideas? thanks - JOhn

trippyd
02-06-2001, 03:37 PM
Looking at this:

LoadModule php4_module modules/libphp4.so
AddModule mod_php4.c
AddType application/x-httpd-php3 .php3

I would say it is the addtype command. According to the PHP4 INSTALL file (in the directory of the source code), the addtype command should look like:

AddType application/x-httpd-php .php

That is all...

D

Anon
06-05-2001, 03:01 AM
Exact same problem here:

stub.lo: file not recognized: File truncated

I may have to just go with the static module as well. *sigh*

Someone please help. Thanks.

Mike

Anon
07-17-2001, 07:29 AM
I went through the thread and still have the problem. It looks like people are having better luck statically compiling the module into the Apache daemon. Now my PHP is statically compiled into the httpd daemon:

% ./bin/httpd -l
Compiled-in modules:
http_core.c
mod_env.c
mod_log_config.c
mod_mime.c
mod_negotiation.c
mod_status.c
mod_include.c
mod_autoindex.c
mod_dir.c
mod_cgi.c
mod_asis.c
mod_imap.c
mod_actions.c
mod_userdir.c
mod_alias.c
mod_access.c
mod_auth.c
mod_proxy.c
mod_so.c
mod_setenvif.c
mod_perl.c
mod_php4.c

% ../bin/httpd -v
Server version: Apache/1.3.19 (Unix)
Server built: Jul 16 2001 14:23:06


Here is the php AddType line in the httpd.conf:

% grep php ./conf/httpd.conf
#AddType application/x-httpd-php .php
AddType application/x-httpd-php .php .phtml
#AddType application/x-httpd-php-source .phps


The php.ini file is
It still wants to download the *.php file.

Any ideas?

Thanks,

Tim
--
kunau002@email.umn.edu

Anon
07-20-2001, 04:31 AM
just remove stub.c configure and make...

I don't know why this happens but this is how you get to fix it.

Anon
01-02-2002, 05:13 PM
I was cruising through the various threads trying to find info about something different from this, but I had similar problems a few months ago and finally was able to solve it. Very common problem apparently, the PHP developers should provide better installation instructions.

The symptom shows up in two ways. One is that you invoke "apachectl start" and get the httpd going, it doesn't complain, but it won't use PHP to process your .php files because it couldn't load the module. The other is that you invoke "apachectl configtest" and it claims it can't load libphp4.so no matter where you put it, specify the pathname, whatever.

The problem has something to do with the coupling between Apache and its shared modules. This is effected by the apxs utility, a Perl script which writes a bunch of code on the fly when you attempt to build PHP. The apxs utility is part of Apache, and apparently the version of apxs you use to build PHP has to match the version of Apache you want to couple up with on your server. The pathname of this special apxs should be given explicitly when you do the PHP build similar to this;
--with-apxs=/usr/local/apache/bin/apxs

In my case I had to obtain the source for Apache and build it on my machine in order to have the correct matching apxs.

Anon
07-29-2002, 09:09 AM
Hi,

I have the same problem. Was a solution found?

Thanks,

David

Anon
07-31-2002, 10:07 AM
Hi,
I have the same problem.
Can you tell me how did u do to resolve it?

Thanks for your answer.