Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Apache & PHP not playing nice
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
Varminter
n00b
n00b


Joined: 31 Oct 2008
Posts: 17

PostPosted: Tue Nov 05, 2013 3:25 am    Post subject: Apache & PHP not playing nice Reply with quote

Evening gang,
I've got a problem with Apache & PHP and I'm not sure what's going on. The short of the long of it is, I've got some PHP pages that have been running for a while just fine. As of midnight last night, Apache has decided to not parse the PHP code on random pages and random sites. And it doesn't matter if the requesting browser is IE10, Chrome, or Firefox. It acts like PHP was not compiled in, nor was it included in the APACHE_OPTS in /etc/conf.d/apache2. There hasn't been an Apache or PHP update recently, so I doubt it is the version. But here's the Apache and PHP compile flags:

Code:
www-servers/apache-2.2.25:2  USE="ssl threads -debug -doc -ldap (-selinux) -static -suexec" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias -asis -auth_digest -authn_dbd -cern_meta -charset_lite -dbd -dumpio -ident -imagemap -log_forensic -proxy -proxy_ajp -proxy_balancer -proxy_connect -proxy_ftp -proxy_http -proxy_scgi -reqtimeout -substitute -version" APACHE2_MPMS="-event -itk -peruser -prefork -worker"
dev-lang/php-5.5.4:5.5  USE="apache2 bzip2 calendar cgi cli crypt ctype fileinfo filter gd gdbm hash iconv imap json mysql mysqli nls opcache pdo phar posix readline session simplexml ssl threads tokenizer unicode xml zlib -bcmath -berkdb -cdb -cjk -curl -debug -embed -enchant -exif -firebird -flatfile -fpm (-frontbase) -ftp -gmp -inifile -intl -iodbc -ipv6 -kerberos -ldap -ldap-sasl -libedit -libmysqlclient -mhash -mssql -oci8-instant-client -odbc -pcntl -postgres -qdbm -recode (-selinux) -sharedmem -snmp -soap -sockets -spell -sqlite (-sybase-ct) -sysvipc -tidy -truetype -wddx -xmlreader -xmlrpc -xmlwriter -xpm -xslt -zip"


Here's the APACHE2_OPTS from /etc/conf.d/apache2
Code:
APACHE2_OPTS="-D DEFAULT_VHOST -D INFO -D SSL -D SSL_DEFAULT_VHOST -D LANGUAGE -D PHP5"


Apache modules:
Code:
/etc/init.d/apache2 modules
apache2: Could not reliably determine the server's fully qualified domain name, using 3gun.d2i2.com for ServerName
Loaded Modules:
 core_module (static)
 mpm_worker_module (static)
 http_module (static)
 so_module (static)
 actions_module (shared)
 alias_module (shared)
 auth_basic_module (shared)
 authn_alias_module (shared)
 authn_anon_module (shared)
 authn_dbm_module (shared)
 authn_default_module (shared)
 authn_file_module (shared)
 authz_dbm_module (shared)
 authz_default_module (shared)
 authz_groupfile_module (shared)
 authz_host_module (shared)
 authz_owner_module (shared)
 authz_user_module (shared)
 autoindex_module (shared)
 cgi_module (shared)
 cgid_module (shared)
 deflate_module (shared)
 dir_module (shared)
 env_module (shared)
 expires_module (shared)
 ext_filter_module (shared)
 filter_module (shared)
 headers_module (shared)
 include_module (shared)
 info_module (shared)
 log_config_module (shared)
 logio_module (shared)
 mime_module (shared)
 mime_magic_module (shared)
 negotiation_module (shared)
 rewrite_module (shared)
 setenvif_module (shared)
 speling_module (shared)
 ssl_module (shared)
 unique_id_module (shared)
 usertrack_module (shared)
 vhost_alias_module (shared)
 php5_module (shared)
Syntax OK


And the results of the php -v:
Code:
php -v
PHP 5.5.4-pl0-gentoo (cli) (built: Nov  4 2013 19:05:35)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies
    with Zend OPcache v7.0.3-dev, Copyright (c) 1999-2013, by Zend Technologies


Any thoughts on this? Thanks in advance.

Rich
Back to top
View user's profile Send private message
666threesixes666
Veteran
Veteran


Joined: 31 May 2011
Posts: 1248
Location: 42.68n 85.41w

PostPosted: Tue Nov 05, 2013 3:39 am    Post subject: Reply with quote

what does
Code:
eselect php list apache2
say?
Back to top
View user's profile Send private message
Varminter
n00b
n00b


Joined: 31 Oct 2008
Posts: 17

PostPosted: Tue Nov 05, 2013 3:42 am    Post subject: Reply with quote

Code:
eselect php list apache2
  [1]   php5.5 *
Back to top
View user's profile Send private message
Varminter
n00b
n00b


Joined: 31 Oct 2008
Posts: 17

PostPosted: Mon Nov 18, 2013 8:15 pm    Post subject: Reply with quote

Any other ideas guys? I did
Code:
emerge -1av dev-lang/php www/servers/apache; /etc/init.d/apache2 restart


And it worked for a week, now the problem is back and doing the above again didn't do anything.

On further research this problem ONLY appears to computers on my LAN, not to anything served to the outside world. I kinda doubt it's the hardware, but ...

AMD 3.5GHz 8-core, 16 GB RAM (PC3-12800, iirc), Single 1Gb LAN with 2 IPs, Samsung SSD as system drive and a 7200RPM 1TB drive for data (web-pages, mysql, home directories, /var/log, etc.)

The old system that had gotten fried by a thunderstorm was
AMD 3.5GHz 2-core, 8GB RAM (PC3-10600), Dual 1Gb LAN with seperate IPs, 7200RPM drives for system and data.

--
Rich
Back to top
View user's profile Send private message
miket
Guru
Guru


Joined: 28 Apr 2007
Posts: 488
Location: Gainesville, FL, USA

PostPosted: Tue Nov 19, 2013 1:20 am    Post subject: Reply with quote

When you say that your web server is not parsing PHP, what do you mean? Do you get PHP source code in your browser or do you get a blank page or some kind of error message? If you see PHP code in the browser, is it all jumbled into one line or does it appear as lines of PHP text?

I would not expect mod_php to quit working all of a sudden. (I would have tried a lot of other things before trying to rebuild packages.) When you talk about being able to access the server from outside your LAN but not have it work inside of it makes me think you have some kind of routing or firewall issue. Is Apache or any of your test hosts running in a VM (as in KVM, Xen, Virtualbox, etc)?

Here's another kind of test: how does Apache handle straight .html pages?

If nothing else, post what you get when you enter this command on any machine on your LAN:
Code:
curl -v http://nnnnnn/
(fill in the nnnnnn part with the IP address of your web server).
Back to top
View user's profile Send private message
Varminter
n00b
n00b


Joined: 31 Oct 2008
Posts: 17

PostPosted: Tue Nov 19, 2013 1:58 am    Post subject: Reply with quote

By not parsing, it is showing up as plain text in the browser window, similar to opening up the .php file in Notepad or the like. As for .html, it does fine. What's baffling me is that this problem only appears on the LAN at random times with multiple PCs. But people coming in on my WAN don't have the issue. I've got a person who has a VPN tunnel out to a client site, then he can get back in to the pages fine. But if he looks at them with IE9/10, Chrome, or Firefox, a lot of the .php scripts that generate the pages show the .php file. I'll see if I can't get a screen snippet up on the server in a bit.

Case in point, I got the Good_Capture.jpeg from Chrome on my PC, yet about 2 hours go I would have gotten the Bad_Capture.jpeg image. I actually had to go try another person's PC to get the Bad_Capture.jpeg.
An example of what I'm seeing:
http://www.d2i2.com/Bad_Capture.jpeg
And what that same page should look like:
http://www.d2i2.com/Good_Capture.jpeg

The curl -v run of the above came out fine:
Code:
curl -v http://house.bearelec.com
* About to connect() to house.bearelec.com port 80 (#0)
*   Trying 10.0.0.6...
* Adding handle: conn: 0x7f505927c7d0
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x7f505927c7d0) send_pipe: 1, recv_pipe: 0
* Connected to house.bearelec.com (10.0.0.6) port 80 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.31.0
> Host: house.bearelec.com
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Tue, 19 Nov 2013 01:43:25 GMT
* Server Apache is not blacklisted
< Server: Apache
< X-Powered-By: PHP/5.5.4-pl0-gentoo
< Set-Cookie: PHPSESSID=tvq54f19v0m9k0hmci3mehpot2; path=/
< Expires: Thu, 19 Nov 1981 08:52:00 GMT
< Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
< Pragma: no-cache
< Content-Length: 5404
< Content-Type: text/html
<
<!DOCTYPE html>
<html>
   <head>
      <meta name="author" content="d2i2">
      <meta name="generator" content="PhpED 6.0">
      <meta name="description" content="">
      <meta name="keywords" content="">

      <title>Bear Electric</title>

      <link rel="stylesheet" type="text/css" href="css/bearBasic.css">
      <link rel="stylesheet" type="text/css" href="jquery-ui-1.10.3.custom/css/cupertino/jquery-ui-1.10.3.custom.css" />


      <script src="js/jquery.js"></script>
      <script src="jquery-ui-1.10.3.custom/js/jquery-ui-1.10.3.custom.js"></script>

      <script>
         $(document).ready(function() {
            // routine to fix footer button position
            $("#pageFooter button").each(function(index){
               switch (index) {
                  case 0:
                     var loc = "180px";
                     break;
                  case 1:
                     var loc = "300px";
                     break;
                  case 2:
                     var loc = "420px";
                     break;
                  case 3:
                     var loc = "540px";
                     break;
                  case 4:
                     var loc = "660px";
                     break;
                  case 5:
                     var loc = "780px";
                     break;
               }
               $(this).css("position", "absolute");
               $(this).css("left", loc);
            });
            // now disable the ones you don't want
            $("#pageFooter button").each(function(index){
               switch (index) {
                  case 0:
                     var disable = true;
                     break;
                  case 1:
                     var disable = false;
                     break;
                  case 2:
                     var disable = true;
                     break;
                  case 3:
                     var disable = false;
                     break;
                  case 4:
                     var disable = false;
                     break;
                  case 5:
                     var disable = false;
                     break;
               }
               if (disable) {
                  $(this).css("display", "none");
               }
            });
            $("#employeeID").focus();
         // compute the window size
            var windowSize = $(window).height();
            var headerAndCrumb = $("#pageHeader").outerHeight(true) + $("#breadcrumbArea").outerHeight(true);
            var footerAndButtons = $("#pageFooter").outerHeight(true) + $("#buttonNext").outerHeight(true) + 4; // add some space at bottom
            var pageContentHeight = windowSize - headerAndCrumb - footerAndButtons - 12;
            var footerTop = headerAndCrumb + pageContentHeight + 12;
            $("#contentLeftHTML").css("height", pageContentHeight);
            $("#contentRightHTML").css("height", pageContentHeight);
            $("#pageFooter").css("top", footerTop);
         });
         function buttonClicked(thisAction) {
            $("#action").val(thisAction);
            $("#loginForm").submit();
         }
      </script>

      <style>
         #loginForm {
            width: 50%;
            margin-left: 25%;
            margin-right: 25%;
         }
         #loginError {
            text-align: center;
            color: red;
         }
      </style>

   </head>
   <body>
      <div id="pageLeftSide">
         <img id="bearLogo" src="images/bearLogo.gif" alt="Bear Electric Logo">
         <div id="leftSideHTML">
                     </div>
      </div>
      <div id="pageHeader">
         <div id="headerHTML">
            <h2>Log In Required</h2>
         </div>
      </div>
      <div id="pageContent">
         <br>
         <p id="loginError">&nbsp;</p>
         <br>
         <form id="loginForm" action="" method="POST">
            <input type="hidden" id="src" name="src" value="loginForm">
            <input type="hidden" id="action" name="action" value="">
            <table>
               <tr>
                  <td>
                     Employee ID:
                  </td>
                  <td>
                     <input type="text" id="employeeID" name="employeeID" value="" size="60">
                  </td>
               </tr>
               <tr>
                  <td colspan="2">
                     &nbsp;
                  </td>
               </tr>
               <tr>
                  <td>
                     Password:
                  </td>
                  <td>
                     <input type="password" id="password" name="password" value="" size="60">
                  </td>
               </tr>
            </table>
         </form>
      </div>
      <div id="pageFooter">
         <button id="buttonBack" onclick="buttonClicked('back')">&lt;&lt; Back</button>
         <button id="buttonNext" onclick="buttonClicked('next')">Next &gt;&gt;</button>
         <button id="buttonSave" onclick="buttonClicked('save')">Save</button>
         <button id="buttonCancel" onclick="buttonClicked('cancel')">Cancel</button>
      </div>
   </body>
* Connection #0 to host house.bearelec.com left intact


I'm not running in a VM, just standard Gentoo:
Code:
uname -a
Linux 3gun.d2i2.com 3.10.7-gentoo-r1 #1 SMP Sun Oct 6 08:24:31 PDT 2013 x86_64 AMD FX(tm)-8320 Eight-Core Processor AuthenticAMD GNU/Linux

with Apache running as apache:apache:
Code:
ps -ef | grep -v grep | grep apache
root     31031     1  0 12:35 ?        00:00:00 /usr/sbin/apache2 -D DEFAULT_VHOST -D INFO -D SSL -D SSL_DEFAULT_VHOST -D LANGUAGE -D PHP5 -d /usr/lib64/apache2 -f /etc/apache2/httpd.conf -k start
apache   31033 31031  0 12:35 ?        00:00:00 /usr/sbin/apache2 -D DEFAULT_VHOST -D INFO -D SSL -D SSL_DEFAULT_VHOST -D LANGUAGE -D PHP5 -d /usr/lib64/apache2 -f /etc/apache2/httpd.conf -k start
apache   31034 31031  0 12:35 ?        00:00:03 /usr/sbin/apache2 -D DEFAULT_VHOST -D INFO -D SSL -D SSL_DEFAULT_VHOST -D LANGUAGE -D PHP5 -d /usr/lib64/apache2 -f /etc/apache2/httpd.conf -k start
apache   31037 31031  0 12:35 ?        00:00:03 /usr/sbin/apache2 -D DEFAULT_VHOST -D INFO -D SSL -D SSL_DEFAULT_VHOST -D LANGUAGE -D PHP5 -d /usr/lib64/apache2 -f /etc/apache2/httpd.conf -k start


This site is just a simple .html file:
http://www.d2i2.com/index.html
And this one is .html with frames:
http://www.varmintercustom.com

And here's a site that's mixed PHP and HTML and we're having the same issues with using the PHP. The top bar and left menu bar are .php driven:
https://www.canbyrodandgun.org

All of these sites were fine on my old box, and it has only been since the old one got fried (literally) that we moved to a fresh built Gentoo and started getting these errors about 2 weeks after build.

--
Rich
Back to top
View user's profile Send private message
miket
Guru
Guru


Joined: 28 Apr 2007
Posts: 488
Location: Gainesville, FL, USA

PostPosted: Tue Nov 19, 2013 7:39 am    Post subject: Reply with quote

I started on a reply a few hours ago, but got stuck. My intuition is that problem comes from some interaction between DNS, the Apache VirtualHost configuration, and the headers that desktop browsers are setting. Your examples show that you used a fully qualified domain name (house.bearelec.com). When you tried reaching the web host from graphical browsers on the LAN, did you enter a FQDN or just "house"? DNS would resolve a name like that (assuming that you have domain bearelec.com in your /etc/resolv.conf) to the correct IP, but Apache would need an explicit ServerName or ServerAlias directive for house.

This theory falls apart in the face of the fact that the URL field of the browser shows the FQDN. Clearly cURL is doing the correct thing: it sends the Host: house.bearelec.com header, after all. From what I can gather, the graphical browsers are sending that same header.

The trouble is that I can't think of any real scenarios to get you in the trouble you've got. How about posting the VirtualHost section from your /etc/apache/vhosts.d/00_default_vhost.conf to see if there's something funky about it. The section ought to begin with something like
Code:
<VirtualHost *:80>
        ServerName house.bearelec.com
Also, if you're using .htaccess files, they could be causing mischief.

I'm assuming you have pretty much a baseline /etc/apache/modules.d/70_mod_php5.conf file. The default installation of it is pretty much what it should be:
Code:
<IfDefine PHP5>
        # Load the module first
        <IfModule !mod_php5.c>
                LoadModule php5_module    modules/libphp5.so
        </IfModule>

        # Set it to handle the files
        <IfModule mod_mime.c>
                AddHandler application/x-httpd-php .php .php5 .phtml
                AddHandler application/x-httpd-php-source .phps
        </IfModule>

        DirectoryIndex index.php index.phtml
</IfDefine>
The exact symtoms you've got come about when that AddHandler application/x-httpd-php .php doesn't get executed. I'm almost completely certain that you've got your problem because that rule isn't being taken when you use graphical browsers on your LAN. The big problem is figuring out why that section is getting ignored.

Actually, there's one more thing that might be causing trouble. Can your Apache instance resolve hostnames as your other LAN hosts do? Are you depending on an /etc/hosts file on all of your LAN hosts, or do you have a name server set up? If you're using /etc/hosts, is it the same on your web host as it is on the others? I use a DNS server on my LAN (bind), and I couldn't reproduce the bad things you're seeing.
Back to top
View user's profile Send private message
Varminter
n00b
n00b


Joined: 31 Oct 2008
Posts: 17

PostPosted: Tue Nov 19, 2013 11:24 pm    Post subject: Reply with quote

I just changed the /etc/hosts file on the server this morning after looking at your post. It now has entries (FDQN and short name) for all the web-sites on the server, one FDQN & associated short names per line. I know I don't need to do it that way, just makes it easier to read and maintain.
Code:
# LAN Linux boxes
10.0.0.3         fasttoy fasttoy.d2i2.com
10.0.0.4         sass sass.d2i2.com   #sass enp5s0
10.0.0.5         idpa idpa.d2i2.com   # sass enp5s0:1
10.0.0.6         3gun 3gun.d2i2.com loghost  # 3gun enp5s0
10.0.0.7         ipsc ipsc.d2i2.com   # 3gun enp5s0:1

# HTTP sites
10.0.0.6         www.d2i2.com
10.0.0.6         house.bearelec.com
10.0.0.7         www.canbyrodandgun.org


But, to fully answer the DNS question: Yes, I was / am using net-dns/bind-9.9.3_p2 for all DNS on my LAN. And the DNS server is the same as my web-server, 10.0.0.6.

As for my /etc/apache2/vhosts.d/00_default_vhosts.conf file, I've got a specific IP that the server is listening on, here's a couple of snippets:
Code:
<VirtualHost 10.0.0.6:80>
        ServerName house.bearelec.com
        DocumentRoot /pistol/apache2/house.bearelec.com/htdocs
        DirectoryIndex index.php
        CustomLog /var/log/apache2/house.bearelec.com-access combined

And ones that I actually own the domain on:
Code:
<VirtualHost 10.0.0.6:80>
        ServerName d2i2.com
        Serveralias www.d2i2.com
        DocumentRoot /pistol/apache2/d2i2.com/htdocs
        DirectoryIndex index.html

I use 10.0.0.7 for the HTTPS, kind of as a carry over from when you had to have seperate IPs for each HTTPS site you were hosting.

Here's the /etc/apache2/http.conf file, I added this line in to see if it would fix the problem (and of course did /etc/init.d/apache2 restart after changing):
Code:
LoadModule php5_module modules/libphp5.so


Here's the /etc/apache2/modules.d/70_mod_php5.conf:
Code:
<IfDefine PHP5>
        # Load the module first
        <IfModule !mod_php5.c>
                LoadModule php5_module    modules/libphp5.so
        </IfModule>

        # Set it to handle the files
        <IfModule mod_mime.c>
                AddHandler application/x-httpd-php .php .php5 .phtml
                AddHandler application/x-httpd-php-source .phps
        </IfModule>

        DirectoryIndex index.php index.phtml
</IfDefine>


And the libphp5.so has permissions:
Code:
ls -l /usr/lib64/apache2/modules/libphp5.so
lrwxrwxrwx 1 root root 31 Oct  7 09:08 /usr/lib64/apache2/modules/libphp5.so -> ../../php5.5/apache2/libphp5.so

ls -l /usr/lib64/php5.5/apache2/libphp5.so
-rwxr-xr-x 1 root root 10703048 Nov 18 10:21 /usr/lib64/php5.5/apache2/libphp5.so


Heh, what fun. I've been stumped on this for a while. I agree that it is probably a disconnect someplace between Apache and PHP, but I'll be dipped if I can figure out why it is only effecting the only LAN activities and not including the WAN in it as well.
Unless there is a DNS/Apache/PHP disconnect going on. I think I was running DNS and /etc/hosts on the old server. If the transactions are coming in from the WAN, they are getting IP mapped from the static public IP to the static LAN IP. Where as on the LAN, all the PCs are using the LAN DNS, and not the internal .../system32/drivers/etc/hosts file. Same with the new servers, they are all (except 3gun after this morning) using DNS for name/IP resolution and not /etc/hosts then DNS. That could explain the LAN only disconnect, but why would it be random and carry on for a while?

--
Rich
Back to top
View user's profile Send private message
666threesixes666
Veteran
Veteran


Joined: 31 May 2011
Posts: 1248
Location: 42.68n 85.41w

PostPosted: Wed Nov 20, 2013 2:29 am    Post subject: Reply with quote

on a fresh rebuild/install of php i had a missing /etc/apache2/modules.d/70_mod_php5.conf

That's after purging apache & php. it would show text instead of run the php, and it was missing that file and that sorted everything out for me.
Back to top
View user's profile Send private message
miket
Guru
Guru


Joined: 28 Apr 2007
Posts: 488
Location: Gainesville, FL, USA

PostPosted: Wed Nov 20, 2013 8:45 am    Post subject: Reply with quote

Not having /etc/apache2/modules.d/70_mod_php5.conf or a missing -D PHP5 on the Apache command would surely be a showstopper, as you say. The difficulty is that Varminter's PHP does work some of the time.

There's one particular trick I'm trying to understand. If this web server is visible both on the network and from outside, that outside access has to be the result of tunnelling or maybe some awful trick with DMZ at the router. I say this because these are definitely local setups going on. The address of 10.0.0.6 is a private-use address; you can't route to that on the global internet.

Let me be sure of something. The hosts www.d2i2.com and varmintercustom.com both resolve to 65.182.241.92. To make this work, you'd have a vhosts configuration something like this:
Code:
<VirtualHost *:80>
   ServerName localhost
   # The catch-all default for unmatched virtual host names or HTTP/1.0 requests
   DocumentRoot /var/www/cascade_arabian_sport_horse_club
</VirtualHost>

<VirtualHost *:80>
   ServerName www.d2i2.com
   DocumentRoot /var/www/www.d2i2.com/htdocs
</VirtualHost>

<VirtualHost *:80>
   ServerName varmintercustom.com
   DocumentRoot /var/www/varmintercustom.com/htdocs
</VirtualHost>


I can tell you've got a section set up like that for house.bearelec.com also, even though there is no whois record for bearelec.com (that's a tricky thing: using a domain name that is not registered). I could pull up that same HTML you posted a few messages up by forging an HTTP request. That's not hard to do, and it shows one of the perils of running a public webserver out of your house. (I won't do that for anything.)

I'd assume that to get to your Bear Electric site with in a graphical browser from the outside you set a line in that machine's /etc/hosts like this:
Code:
65.182.241.92   house.bearelec.com



In any event, is there any AddHandler directive anywhere in your vhosts files (including default_vhost.include) or in an .htaccess file?
Back to top
View user's profile Send private message
666threesixes666
Veteran
Veteran


Joined: 31 May 2011
Posts: 1248
Location: 42.68n 85.41w

PostPosted: Wed Nov 20, 2013 3:14 pm    Post subject: Reply with quote

that kinda confused me... i had -D PHP5, but not 70_... and some php would load fine, and phpinfo() flat out refused to load. once that loads then you're pretty much set.
Back to top
View user's profile Send private message
Varminter
n00b
n00b


Joined: 31 Oct 2008
Posts: 17

PostPosted: Thu Nov 21, 2013 3:35 am    Post subject: Reply with quote

miket - Yes, the house.bearelec.com domain name isn't registered on the net, but it really doesn't need to be with an internal DNS, especially since we're using that name for a client development project. You don't even need a DNS if you put that name into the hosts file on both the Linux and Windows boxes on a LAN or even a WAN, they'll treat that pseudo-domain name as a valid name. Since the first place 99% of the computers go hit their internal hosts file for name resolution before trying a DNS. Great for doing development, so long as the name you're using doesn't conflict with a real-world site you need to talk to at some point.

As for the AddHandler directive, the only ones that are active are in /etc/apache2/modules.d/*. I did a grep through the /etc/apache2/* tree. And I'm not using htaccess, I've had too many issues in the past getting that set-up. I should probably go out and revisit the documentation on that, since it has been a few years since I last looked at htaccess.
Back to top
View user's profile Send private message
miket
Guru
Guru


Joined: 28 Apr 2007
Posts: 488
Location: Gainesville, FL, USA

PostPosted: Thu Nov 21, 2013 2:54 pm    Post subject: Reply with quote

Varminter wrote:
miket - Yes, the house.bearelec.com domain name isn't registered on the net, but it really doesn't need to be with an internal DNS, especially since we're using that name for a client development project. You don't even need a DNS if you put that name into the hosts file on both the Linux and Windows boxes on a LAN or even a WAN, they'll treat that pseudo-domain name as a valid name. Since the first place 99% of the computers go hit their internal hosts file for name resolution before trying a DNS. Great for doing development, so long as the name you're using doesn't conflict with a real-world site you need to talk to at some point.
I'm well aware that is possible to do. There's pretty much no connection between the presence or absence of a name of a virtual host in DNS and the ability to select a virtual host in Apache. The reaction I had when seeing that setup had only to do with doubting the wisdom of relying that no cybersquatter would swoop up the domain name--especially one in the .com TLD.

I tried a few more tests from here. The situation is really tricky: all accesses to house.bearelec.com would appear to come from the LAN: either from normal hosts on the LAN or from the gateway doing network address translation (from what I can tell, even machines placed in a networking DMZ would still be subject to NAT).

There are two more ways I can think of for testing. First (and this is something of a shot in the dark), what is Apache's setting of UseCanonicalName? Typically this setting is in /etc/apache/modules.d/00_default_settings.conf.

Now, the bigger thing. Try putting up a REALLY simple PHP page that would doubtlessly show it is a dynamically generated page yet eliminate any effects that your normal codebase of PHP might be introducing. Put up a really simple page like this somewhere in the document tree for the house.bearelec.com virtual host and trying access to it in various ways.
Code:
<?php
//This is PHP code.  You should not be seeing this!
?><html>
  <head>
     <title>Really simple PHP page</title>
  </head>
  <body>
     <h1>This is a PHP page.</h1>
     <div>Your IP address is <?php echo $_SERVER['REMOTE_ADDR']; ?></div>
     <div>The time now is <?php echo date('Y-m-d H:i:s'); ?></div>
  </body>
</html>


Try this out and see what happens. Now one thing struck me very strongly when I tried this myself and I saw this in the output
Code:
Your IP address is ::1
Recognize that? That's the IPv6 localhost. This might very well be a good demonstration of how to explain the diverging results for accessing this page from inside and outside the network. If you've got IPv6 router advertisements happening on your LAN, your LAN hosts are probably going to be speaking IPv6 to each other. Remember your VirtualHosts directives and how you've got IPv4 addresses in them? That could be your problem.

Edit: let me temper my enthusiasm for the "it's IPv6" solution: if might show up only if you have an AAAA record for home.bearelec.com in Bind or if you are reaching the web server via localhost. Even if IPv6 is available, if the only name resolution is for an IPv4 address, that's how you'll talk.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum