Gentoo Archives: gentoo-user

From: Mark Shields <laebshade@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] PHP won't execute
Date: Sat, 15 Jan 2011 03:39:42
Message-Id: AANLkTik8TjoBabNqJfM-j-DWwR8UaxGZEDhWoAc=MFiy@mail.gmail.com
In Reply to: Re: [gentoo-user] PHP won't execute by Michael Sullivan
1 On Fri, Jan 14, 2011 at 10:29 PM, Michael Sullivan <msulli1355@×××××.com>wrote:
2
3 > On Fri, 2011-01-14 at 22:10 -0500, Mark Shields wrote:
4 > > On Fri, Jan 14, 2011 at 9:57 PM, Michael Sullivan
5 > > <msulli1355@×××××.com> wrote:
6 > >
7 > > On Fri, 2011-01-14 at 21:24 -0500, Mark Shields wrote:
8 > > > On Thu, Jan 13, 2011 at 9:01 PM, Michael Sullivan
9 > > > <msulli1355@×××××.com> wrote:
10 > > > A several years ago I ran a public network out of my
11 > > > apartment. I had
12 > > > email, www, etc. etc. It all worked fine. Then one
13 > > day a
14 > > > couple of
15 > > > years ago we decided that we could not afford to pay
16 > > for a
17 > > > public IP
18 > > > address anymore, so we had it turned off. I haven't
19 > > touched
20 > > > apache
21 > > > since then, but we still run that box as it's faster
22 > > than all
23 > > > the others
24 > > > and runs distcc well. We had a picture page that I
25 > > wrote back
26 > > > in 2005
27 > > > and occassionally when we have company over we use
28 > > it to show
29 > > > them
30 > > > pictures that we've taken. I went to the site in my
31 > > web
32 > > > browser this
33 > > > evening, and saw only PHP code printed on the
34 > > background
35 > > > image. I've
36 > > > checked the usual suspects:
37 > > >
38 > > > carter apache2 # cat /etc/conf.d/apache2
39 > > > # /etc/conf.d/apache2: config file
40 > > for /etc/init.d/apache2
41 > > >
42 > > > # When you install a module it is easy to activate
43 > > or
44 > > > deactivate the
45 > > > modules
46 > > > # and other features of apache using the
47 > > APACHE2_OPTS line.
48 > > > Every module
49 > > > should
50 > > > # install a configuration in /etc/apache2/modules.d.
51 > > In that
52 > > > file will
53 > > > be an
54 > > > # <IfDefine NNN> where NNN is the option to enable
55 > > that
56 > > > module.
57 > > > # Here are the options available in the default
58 > > configuration:
59 > > > # USERDIR Enables /~username mapping
60 > > > to /home/username/public_html
61 > > > # INFO Enables mod_info, a useful module for
62 > > debugging
63 > > > # PROXY Enables mod_proxy
64 > > > # DAV Enables mod_dav
65 > > > # DAV_FS Enables mod_dav_fs (you should enable
66 > > this when
67 > > > you enable
68 > > > DAV
69 > > > # unless you know what you are doing)
70 > > > # SSL Enables SSL
71 > > > # SSL_DEFAULT_VHOST Enables default vhost for SSL
72 > > (you
73 > > > should enable
74 > > > this
75 > > > # when you enable SSL unless
76 > > you know
77 > > > what you are
78 > > > doing)
79 > > > # LDAP Enables mod_ldap
80 > > > # AUTH_LDAP Enables authentication through
81 > > mod_ldap
82 > > > # DEFAULT_VHOST Enables the default virtual host
83 > > > in /var/www/localhost/htdocs
84 > > > APACHE2_OPTS="-D DEFAULT_VHOST -D PHP5 -D MAILMAN -D
85 > > USERDIR"
86 > > >
87 > > > # Extended options for advanced uses of Apache ONLY
88 > > > # You don't need to edit these unless you are doing
89 > > crazy
90 > > > Apache stuff
91 > > > # As not having them set correctly, or feeding in an
92 > > incorrect
93 > > > configuration
94 > > > # via them will result in Apache failing to start
95 > > > # YOU HAVE BEEN WARNED.
96 > > >
97 > > > # ServerRoot setting
98 > > > #SERVERROOT=/usr/lib/apache2
99 > > >
100 > > > # Configuration file location
101 > > > # - If this does NOT start with a '/', then it is
102 > > treated
103 > > > relative to
104 > > > # $SERVERROOT by Apache
105 > > > #CONFIGFILE=/etc/apache2/httpd.conf
106 > > >
107 > > > # Location to log startup errors to
108 > > > # They are normally dumped to your terminal.
109 > > > #STARTUPERRORLOG="/var/log/apache2/startuperror.log"
110 > > >
111 > > > # Environment variables to keep
112 > > > # All environment variables are cleared from apache
113 > > > # Use this to preserve some of them
114 > > > # NOTE!!! It's very important that this contains
115 > > PATH
116 > > > # Also, it will fail if the _value_ of any of these
117 > > variables
118 > > > contains a
119 > > > space
120 > > > KEEPENV="PATH"
121 > > >
122 > > > carter apache2 # cat error_log
123 > > > [Tue Jan 11 03:15:22 2011] [notice] Apache/2.2.16
124 > > (Unix)
125 > > > configured --
126 > > > resuming normal operations
127 > > > [Wed Jan 12 03:00:12 2011] [notice] Graceful restart
128 > > > requested, doing
129 > > > restart
130 > > > [Wed Jan 12 03:00:13 2011] [notice] Apache/2.2.16
131 > > (Unix)
132 > > > configured --
133 > > > resuming normal operations
134 > > > [Thu Jan 13 19:24:28 2011] [error] [client
135 > > 192.168.2.3] File
136 > > > does not
137 > > > exist: /home/michael/public_html/camera/$filename,
138 > > referer:
139 > > > http://carter.espersunited.com/~michael/camera/
140 > > > [Thu Jan 13 19:43:23 2011] [notice] caught SIGTERM,
141 > > shutting
142 > > > down
143 > > > [Thu Jan 13 19:43:26 2011] [notice] Apache/2.2.16
144 > > (Unix)
145 > > > configured --
146 > > > resuming normal operations
147 > > > [Thu Jan 13 19:43:44 2011] [error] [client
148 > > 192.168.2.3] File
149 > > > does not
150 > > > exist: /home/michael/public_html/camera/$filename,
151 > > referer:
152 > > > http://carter.espersunited.com/~michael/camera/
153 > > > [Thu Jan 13 19:48:06 2011] [error] [client
154 > > 192.168.2.3] File
155 > > > does not
156 > > > exist: /home/michael/public_html/camera/$filename,
157 > > referer:
158 > > >
159 > > http://carter.espersunited.com/~michael/camera/index.php
160 > > > [Thu Jan 13 19:49:53 2011] [error] [client
161 > > 192.168.2.3] File
162 > > > does not
163 > > > exist: /home/michael/public_html/camera/$filename,
164 > > referer:
165 > > >
166 > > http://carter.espersunited.com/~michael/camera/index.php
167 > > > [Thu Jan 13 19:49:56 2011] [error] [client
168 > > 192.168.2.3] File
169 > > > does not
170 > > > exist: /home/michael/public_html/camera/$filename,
171 > > referer:
172 > > >
173 > > http://carter.espersunited.com/~michael/camera/index.php
174 > > > [Thu Jan 13 19:49:59 2011] [error] [client
175 > > 192.168.2.3] File
176 > > > does not
177 > > > exist: /home/michael/public_html/camera/$filename,
178 > > referer:
179 > > >
180 > > http://carter.espersunited.com/~michael/camera/index.php
181 > > > [Thu Jan 13 19:50:02 2011] [error] [client
182 > > 192.168.2.3] File
183 > > > does not
184 > > > exist: /home/michael/public_html/camera/$filename,
185 > > referer:
186 > > >
187 > > http://carter.espersunited.com/~michael/camera/index.php
188 > > >
189 > > > (that $filename reference would have resolved if PHP
190 > > were
191 > > > executed AS
192 > > > PHP instead of plain text)
193 > > >
194 > > > carter apache2 #
195 > > ls /home/michael/public_html/camera/
196 > > > 010105 031706 050706 070707 080905 100304
197 > > 110804
198 > > > 121107 current
199 > > > thumbnail.php
200 > > > 010506 032008 051610 070905 081710 100507
201 > > 111108 121210
202 > > > current.php thumbnail.php~
203 > > > 011305 032907 060509 071006 090205 101004
204 > > 112004 121809
205 > > > directory.php.bak
206 > > > 011409 042608 061608 071405 091105 101405
207 > > 112206 122404
208 > > > index.php
209 > > > 020705 042810 063005 072005 092208 102304
210 > > 112504 122405
211 > > > oldindex.html
212 > > > 022807 050307 070405 080605 100206 110604
213 > > 120205
214 > > > 123106 test.php
215 > > >
216 > > >
217 > > > See? There ARE files there.
218 > > >
219 > > > What am I missing here? I looked at
220 > > >
221 > > http://www.gentoo.org/proj/en/apache/doc/troubleshooting.xml
222 > > >
223 > > > and it said that the browser cache might be full, so
224 > > I closed
225 > > > the
226 > > > browser, deleted the cache directory files, and
227 > > reopened the
228 > > > browser.
229 > > > No change. Please help!
230 > > >
231 > > >
232 > > >
233 > > >
234 > > >
235 > > > Sounds like your Handlers are missing. Do you have this
236 > > file, with
237 > > > this in it?
238 > > >
239 > > >
240 > > > /etc/apache2/modules.d/70_mod_php5.conf
241 > > > <IfModule !mod_php5.c>
242 > > > LoadModule php5_module modules/libphp5.so
243 > > > AddHandler application/x-httpd-php .php .php5 .phtml
244 > > > AddHandler application/x-httpd-php-source .phps
245 > > > DirectoryIndex index.php index.phtml
246 > > >
247 > > >
248 > > >
249 > > >
250 > > > - Mark Shields
251 > >
252 > >
253 > > carter ~ # cat /etc/apache2/modules.d/70_mod_php5.conf
254 > > <IfDefine PHP5>
255 > > # Load the module first
256 > > <IfModule !mod_php5.c>
257 > > LoadModule php5_module modules/libphp5.so
258 > >
259 > > </IfModule>
260 > >
261 > > # Set it to handle the files
262 > > <IfModule mod_mime.c>
263 > > AddHandler
264 > > application/x-httpd-php .php .php5 .phtml
265 > > AddHandler application/x-httpd-php-source .phps
266 > >
267 > > </IfModule>
268 > >
269 > > DirectoryIndex index.php index.phtml
270 > >
271 > > </IfDefine>
272 > >
273 > >
274 > > Is there a way for me to test if the file is even being
275 > > loaded?
276 > >
277 > >
278 > >
279 > > I'm not sure. Maybe you can find out more info by turning up the
280 > > level of logging on Apache:
281 > >
282 > >
283 > > # sed -i 's/LogLevel warn/LogLevel
284 > > info/g' /etc/apache2/modules.d/00_default_settings.conf
285 > > # /etc/init.d/apache2 restart
286 > >
287 > >
288 > > then:
289 > >
290 > >
291 > > # tail -f /var/log/apache2/error_log
292 > >
293 > >
294 > > And try a php page
295 > >
296 > >
297 > > OR
298 > >
299 > >
300 > > try a php page then
301 > >
302 > >
303 > > # grep -i php /var/log/apache2/error_log
304 >
305 > I deleted my error_log (after executing the above sed line), restarted
306 > apache, and tried to load my php page, first by IP address, then by
307 > hostname:
308 >
309 > carter apache2 # cat error_log
310 > [Fri Jan 14 21:23:54 2011] [info] mod_unique_id: using ip addr
311 > 192.168.2.2
312 > [Fri Jan 14 21:23:55 2011] [info] mod_unique_id: using ip addr
313 > 192.168.2.2
314 > [Fri Jan 14 21:23:56 2011] [notice] Apache/2.2.16 (Unix) configured --
315 > resuming normal operations
316 > [Fri Jan 14 21:23:56 2011] [info] Server built: Jan 13 2011 19:42:02
317 > [Fri Jan 14 21:24:41 2011] [error] [client 192.168.2.3] File does not
318 > exist: /home/michael/public_html/camera/$filename, referer:
319 > http://192.168.2.2/~michael/camera/index.php
320 > [Fri Jan 14 21:27:34 2011] [error] [client 192.168.2.3] File does not
321 > exist: /home/michael/public_html/camera/$filename, referer:
322 > http://carter.espersunited.com/~michael/camera/index.php
323 >
324 >
325 > And I apologize if I'm sending multiple copies of the same reply;
326 > evolution is being stupid, and since I don't get my own posts back, when
327 > evolution offers me a chance to restore a message that I thought I had
328 > sent earlier, I assume it didn't actually send it, and I send it
329 > again...
330 >
331 >
332 >
333 >
334 >
335 It's no problem. Gmail realized you had already sent the same message and
336 collapsed the whole reply as "quoted text" :)
337
338 Try running this:
339
340 # echo "phpinfo();" | xargs php -r
341
342 What does it output? anything?

Replies

Subject Author
Re: [gentoo-user] PHP won't execute Michael Sullivan <msulli1355@×××××.com>