Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 104411 - apache2 and php5 refuse to open .php files, insists they are .phtml and wants to download them.
Summary: apache2 and php5 refuse to open .php files, insists they are .phtml and wants...
Status: RESOLVED NEEDINFO
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Server (show other bugs)
Hardware: AMD64 Linux
: High normal (vote)
Assignee: PHP Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-31 11:55 UTC by Sam
Modified: 2005-09-06 01:12 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sam 2005-08-31 11:55:16 UTC
where do i begin... with each restart of apache i get different results,, this
is what's most confusing, but Stuart recommended me to post this bug.

I installed apache2 2.0.54-r13 and mod_php 5.0.4 (amd64) and whenever i go to
any folder with php in it, i get this weird dl window popping up
http://xushi.co.uk/xushi/sv/pics/phtml.jpg
http://xushi.co.uk/xushi/sv/pics/phtml2.jpg
where it asks to download asdfasdf.phtml where asdfasdf is random each time i
refresh or try again.,

if i link manually to /path/to/file.php sometimes it works (After restarting
apache several times... but only sometimes) but linking indirectly, /path/to/
displays that dl thingy.

I have -D PHP5 in conf.d/apache, and index.php in DirectoryIndex (which i
excluded when i found out its in mod_php5.conf .. i also commented the whole
directoryindex line from mod_php5.conf... same thing.. i stuck what was in that
line into httpd.conf... same thing)

I have Alias /xushi "/home/xushi/public_html" and Indexes, MultiViews in
<Directory /home/*/public_html> and i get permission denied when accessing
http://localhost/xushi/
Only when i add -D USERDIR does it let me browse the contents if no index found.

I've tried reinstalling countless times but no use. It was all working before my
reinstallation of gentoo...

I also want to add that everytime i access any .php file, and it asks that its a
.phtml and wants to be opened from /tmp, i actuall go to /tmp, and i see two
.php files in there, one which is the same name as what i'm opening (eg,
index.php), and one with random letters (eg. 6jka76ax-2.php). The contents of
both are the exact same as the .php i'm trying to open.


For a more thorough look, i'll paste the chat i had with Stuart, it shows you
the options i did


==============================================
Stuart -r13 is good enough
xushi the reason for those revisions is i needed the new file heirarchy which
wasn't included in r9
xushi ah, good 
Stuart have you managed to get a basic phpinfo() page working?
xushi yes, but only if i link directly to it
xushi localhost/index.php (set it there for now)
xushi but if i'm just http://localhost/ it gives me that dl window
* Herbs (n=Herbs@gentoo/developer/herbs) has joined #gentoo-apache
xushi asking to download foo1234.phtml
Stuart ??
xushi same goes with any other php file in any other folder.. if i link to it
directly, it works. if i link to the directory itself, it doesnt
Stuart foo1234.phtml?
xushi where foo1234 is random characters
Stuart is that exactly what it asks you to download?
Stuart that's an odd one
xushi like s7k45la-p.phtml
xushi yep.. its driving me mad.. heh
Stuart I bet
xushi i can take another snapshot
Stuart do you have any virtual hosts setup at all?
xushi no
Stuart what changes have you made to httpd.conf after installing apache?
xushi its just the default httpd.conf with Alias added and index.php set to
directory index
xushi Alias /xushi "/home/xushi/public_html"
xushi those 2 lines only.
xushi on, and ServerName localhost
Stuart nothing contraversial there
xushi http://xushi.co.uk/xushi/sv/pics/phtml2.jpg
Stuart looking now
Stuart what CFLAGS do you use? and what gcc version?
xushi gcc version 3.4.4 (Gentoo 3.4.4-r1, ssp-3.4.4-1.0, pie-8.7.8)
xushi CFLAGS="-O2 -march=k8 -pipe -fomit-frame-pointer -funroll-loops"
Stuart is that the "stable" gcc version for amd64?
xushi it should be, yes
* Stuart confesses that his amd64 still runs x86
xushi hehe, just checke,d its the stable one
Stuart ok
xushi its the same one i used before.. but i reinstalled 2 days ago, and now the
apache problems
Stuart if you disable PHP, do the apache directory indexes work as expected?
xushi its confusing to why it wants to open that phtml file from /tmp
Stuart very confusing
xushi as in remove -D PHP5 from conf.d ?
Stuart yes please
xushi yes
xushi hmm, 
xushi localhost works, which has index.html and index.php. localhost/xushi/test
gives the phtml problem
xushi where /xushi/test has .php files only
xushi and if i link to any .php file directly, i get the phtml dl thing again
xushi i also tried unmerging, delete /etc/apache2, and emerge again.. which
didnt work.. (it did on my old install)
xushi in conf.d/apache, my options are as follows
xushi APACHE2_OPTS="-D DEFAULT_VHOST -D PHP5 -D USERDIR -D INFO"
Stuart sorry - having network problems
Stuart let's recap a moment
Stuart your php files work fine in localhost?
xushi only if i link directly to them, and provided i have -D PHP5 , yes
Stuart can you take index.php out of your DirectoryIndex?
Stuart it's added automatically by /etc/apache2/modules.d/70_mod_php5.conf
Stuart just take it out of DirectoryIndex in httpd.conf
Stuart don't change the mod_php5.conf file at all please
xushi taken out and restarted apache, and i'm too scared to touch mod_php.conf
anyway :)
xushi now its asking me to download index.php when i link to it directly, or
indirectly
Stuart ok, that's something at least
xushi 1 sec
Stuart now, edit mod_php5.conf, and comment out AddDirectoryIndex line plz
xushi directly only. indirectly still asks for .phtml
xushi k, 
Stuart then add index.php to DirectoryIndex in httpd.conf
Stuart I wonder if the AddDirectoryIndex patch we wrote is the cause of your
problems
xushi might i add, looking at mod_php5.conf, the directoryindex doesn't only
have index.php
Stuart comment out that entire line
Stuart make sure that AddDirectoryIndex never gets triggered
xushi yep working on it
Stuart :)
Stuart I have to go in a minute
xushi still same problem
xushi and now i cant open index.php
xushi sure, take your time
Stuart you now have index.php in DirectoryIndex in httpd.conf?
xushi i do
Stuart can you open other php files?
xushi hmm.. the one in /test, yes, the one in localhost, no
Stuart very odd
Stuart it looks like something is seriously b0rked on amd64 then
xushi hmm, but it was working well on amd64 before i reinstalled
Stuart can you file a bug on bugs.gentoo.org?
Stuart mention that you're on amd64
xushi i wouldn't know where to bein in writing the details ... i'm absolutely
confused
Stuart just describe it like you did to me
xushi shall i keep the current configs, or revert back to mod_php
xushi 's directory index
Stuart neither work, so I don't know
xushi while trying to open index.php, it apparently is copying it to /tmp, along
with a random foo1234.php file too
xushi which contains the same info
Stuart there's an actual file in /tmp?
xushi yes
xushi two
Stuart and there's no way your php script could be creating this file?
xushi <?php echo phpinfo(); ?>
xushi that's my phgp script
Stuart really odd
Stuart can you install php4, and see if that works?
Stuart I have to go now
xushi is it a simple unmerge mod-php then re emerge ?
xushi thanks for your help btw
* Stuart nods
Stuart sorry I couldn't solve your problem
* Stuart waves
xushi no worries
xushi ciao

=========================================================


Reproducible: Always
Steps to Reproduce:
1. emerge -avt apache mod_php
2. nano /etc/apache2/httpd.conf (add alias line)
3. /etc/init.d/apache start 

simple as that.. which is confusing.

Actual Results:  
apache starts, and the problems start... Somestimes i get index.php with
phpinfo() to run, sometimes even that refuses to open.

Expected Results:  
err... open up and display the .php files on firefox instead of insist that
they're .phtml files that need to be opened form /tmp with an unknown program.

Hope this helps. good luck,



I was told to mention that i'm on amd64,

Good luck and keep up the good work.
Comment 1 Sam 2005-08-31 13:27:16 UTC
Apparently everything works well if i use http://127.0.0.1/...... insetead of
localhost. But i'm still not sure why localhost wont work.

my /etc/hosts has 
127.0.0.1 localhost

and a copy of the httpd.conf is here incase its of any use
http://xushi.co.uk/xushi/sv/httpd.conf

my mod_php5.conf
http://pastebin.com/351273

my sanity, lost.. :)
Comment 2 Jakub Moc (RETIRED) gentoo-dev 2005-09-06 01:12:45 UTC
(In reply to comment #1)
> and a copy of the httpd.conf is here incase its of any use
> http://xushi.co.uk/xushi/sv/httpd.conf
> 
> my mod_php5.conf
> http://pastebin.com/351273

Don't link external sources, attach the files here. E.g., the pastebin.com link
is empty now.