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?
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?
disable php3 in your httpd.conf
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.
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!
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.
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.
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.
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
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
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?
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.
ok for cat * | grep php I got this
#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
#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
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.
Ok....I think I found my problem...I have no libphp4.so ...is this a compilation problem?
DJ
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.
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'
/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
make: *** [all-recursive] Error 1
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.
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.
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.
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..
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