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

Replies

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