Gentoo Archives: gentoo-user

From: Michael Sullivan <msulli1355@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] PHP won't execute
Date: Sat, 15 Jan 2011 03:05:48
Message-Id: 1295060243.32336.26.camel@camille.espersunited.com
In Reply to: Re: [gentoo-user] PHP won't execute by Mark Shields
1 On Fri, 2011-01-14 at 21:24 -0500, Mark Shields wrote:
2 > On Thu, Jan 13, 2011 at 9:01 PM, Michael Sullivan
3 > <msulli1355@×××××.com> wrote:
4 > A several years ago I ran a public network out of my
5 > apartment. I had
6 > email, www, etc. etc. It all worked fine. Then one day a
7 > couple of
8 > years ago we decided that we could not afford to pay for a
9 > public IP
10 > address anymore, so we had it turned off. I haven't touched
11 > apache
12 > since then, but we still run that box as it's faster than all
13 > the others
14 > and runs distcc well. We had a picture page that I wrote back
15 > in 2005
16 > and occassionally when we have company over we use it to show
17 > them
18 > pictures that we've taken. I went to the site in my web
19 > browser this
20 > evening, and saw only PHP code printed on the background
21 > image. I've
22 > checked the usual suspects:
23 >
24 > carter apache2 # cat /etc/conf.d/apache2
25 > # /etc/conf.d/apache2: config file for /etc/init.d/apache2
26 >
27 > # When you install a module it is easy to activate or
28 > deactivate the
29 > modules
30 > # and other features of apache using the APACHE2_OPTS line.
31 > Every module
32 > should
33 > # install a configuration in /etc/apache2/modules.d. In that
34 > file will
35 > be an
36 > # <IfDefine NNN> where NNN is the option to enable that
37 > module.
38 > # Here are the options available in the default configuration:
39 > # USERDIR Enables /~username mapping
40 > to /home/username/public_html
41 > # INFO Enables mod_info, a useful module for debugging
42 > # PROXY Enables mod_proxy
43 > # DAV Enables mod_dav
44 > # DAV_FS Enables mod_dav_fs (you should enable this when
45 > you enable
46 > DAV
47 > # unless you know what you are doing)
48 > # SSL Enables SSL
49 > # SSL_DEFAULT_VHOST Enables default vhost for SSL (you
50 > should enable
51 > this
52 > # when you enable SSL unless you know
53 > what you are
54 > doing)
55 > # LDAP Enables mod_ldap
56 > # AUTH_LDAP Enables authentication through mod_ldap
57 > # DEFAULT_VHOST Enables the default virtual host
58 > in /var/www/localhost/htdocs
59 > APACHE2_OPTS="-D DEFAULT_VHOST -D PHP5 -D MAILMAN -D USERDIR"
60 >
61 > # Extended options for advanced uses of Apache ONLY
62 > # You don't need to edit these unless you are doing crazy
63 > Apache stuff
64 > # As not having them set correctly, or feeding in an incorrect
65 > configuration
66 > # via them will result in Apache failing to start
67 > # YOU HAVE BEEN WARNED.
68 >
69 > # ServerRoot setting
70 > #SERVERROOT=/usr/lib/apache2
71 >
72 > # Configuration file location
73 > # - If this does NOT start with a '/', then it is treated
74 > relative to
75 > # $SERVERROOT by Apache
76 > #CONFIGFILE=/etc/apache2/httpd.conf
77 >
78 > # Location to log startup errors to
79 > # They are normally dumped to your terminal.
80 > #STARTUPERRORLOG="/var/log/apache2/startuperror.log"
81 >
82 > # Environment variables to keep
83 > # All environment variables are cleared from apache
84 > # Use this to preserve some of them
85 > # NOTE!!! It's very important that this contains PATH
86 > # Also, it will fail if the _value_ of any of these variables
87 > contains a
88 > space
89 > KEEPENV="PATH"
90 >
91 > carter apache2 # cat error_log
92 > [Tue Jan 11 03:15:22 2011] [notice] Apache/2.2.16 (Unix)
93 > configured --
94 > resuming normal operations
95 > [Wed Jan 12 03:00:12 2011] [notice] Graceful restart
96 > requested, doing
97 > restart
98 > [Wed Jan 12 03:00:13 2011] [notice] Apache/2.2.16 (Unix)
99 > configured --
100 > resuming normal operations
101 > [Thu Jan 13 19:24:28 2011] [error] [client 192.168.2.3] File
102 > does not
103 > exist: /home/michael/public_html/camera/$filename, referer:
104 > http://carter.espersunited.com/~michael/camera/
105 > [Thu Jan 13 19:43:23 2011] [notice] caught SIGTERM, shutting
106 > down
107 > [Thu Jan 13 19:43:26 2011] [notice] Apache/2.2.16 (Unix)
108 > configured --
109 > resuming normal operations
110 > [Thu Jan 13 19:43:44 2011] [error] [client 192.168.2.3] File
111 > does not
112 > exist: /home/michael/public_html/camera/$filename, referer:
113 > http://carter.espersunited.com/~michael/camera/
114 > [Thu Jan 13 19:48:06 2011] [error] [client 192.168.2.3] File
115 > does not
116 > exist: /home/michael/public_html/camera/$filename, referer:
117 > http://carter.espersunited.com/~michael/camera/index.php
118 > [Thu Jan 13 19:49:53 2011] [error] [client 192.168.2.3] File
119 > does not
120 > exist: /home/michael/public_html/camera/$filename, referer:
121 > http://carter.espersunited.com/~michael/camera/index.php
122 > [Thu Jan 13 19:49:56 2011] [error] [client 192.168.2.3] File
123 > does not
124 > exist: /home/michael/public_html/camera/$filename, referer:
125 > http://carter.espersunited.com/~michael/camera/index.php
126 > [Thu Jan 13 19:49:59 2011] [error] [client 192.168.2.3] File
127 > does not
128 > exist: /home/michael/public_html/camera/$filename, referer:
129 > http://carter.espersunited.com/~michael/camera/index.php
130 > [Thu Jan 13 19:50:02 2011] [error] [client 192.168.2.3] File
131 > does not
132 > exist: /home/michael/public_html/camera/$filename, referer:
133 > http://carter.espersunited.com/~michael/camera/index.php
134 >
135 > (that $filename reference would have resolved if PHP were
136 > executed AS
137 > PHP instead of plain text)
138 >
139 > carter apache2 # ls /home/michael/public_html/camera/
140 > 010105 031706 050706 070707 080905 100304 110804
141 > 121107 current
142 > thumbnail.php
143 > 010506 032008 051610 070905 081710 100507 111108 121210
144 > current.php thumbnail.php~
145 > 011305 032907 060509 071006 090205 101004 112004 121809
146 > directory.php.bak
147 > 011409 042608 061608 071405 091105 101405 112206 122404
148 > index.php
149 > 020705 042810 063005 072005 092208 102304 112504 122405
150 > oldindex.html
151 > 022807 050307 070405 080605 100206 110604 120205
152 > 123106 test.php
153 >
154 >
155 > See? There ARE files there.
156 >
157 > What am I missing here? I looked at
158 > http://www.gentoo.org/proj/en/apache/doc/troubleshooting.xml
159 >
160 > and it said that the browser cache might be full, so I closed
161 > the
162 > browser, deleted the cache directory files, and reopened the
163 > browser.
164 > No change. Please help!
165 >
166 >
167 >
168 >
169 >
170 > Sounds like your Handlers are missing. Do you have this file, with
171 > this in it?
172 >
173 >
174 > /etc/apache2/modules.d/70_mod_php5.conf
175 > <IfModule !mod_php5.c>
176 > LoadModule php5_module modules/libphp5.so
177 > AddHandler application/x-httpd-php .php .php5 .phtml
178 > AddHandler application/x-httpd-php-source .phps
179 > DirectoryIndex index.php index.phtml
180 >
181 >
182 >
183 >
184 > - Mark Shields
185
186 carter ~ # cat /etc/apache2/modules.d/70_mod_php5.conf
187 <IfDefine PHP5>
188 # Load the module first
189 <IfModule !mod_php5.c>
190 LoadModule php5_module modules/libphp5.so
191 </IfModule>
192
193 # Set it to handle the files
194 <IfModule mod_mime.c>
195 AddHandler application/x-httpd-php .php .php5 .phtml
196 AddHandler application/x-httpd-php-source .phps
197 </IfModule>
198
199 DirectoryIndex index.php index.phtml
200 </IfDefine>
201
202
203 Is there a way for me to test if the file is even being loaded?

Replies

Subject Author
Re: [gentoo-user] PHP won't execute Mark Shields <laebshade@×××××.com>