Problem starting base - phtml issue

  • leethatcher

    leethatcher - 2007-08-10

    i am just setting up Base (latest build) on a debian etch box.  following the install i get to the part where i have to browse to https://ipaddress/base and my browser (iceweasel) tries to download a phtml file instead of opening a config page.  i can find no mention of this in any guides or documentation. 

    Does anyone have any ideas?



    • Chris Happel

      Chris Happel - 2007-10-22

      I've got the exact same issue.  I'm installing on Ubuntu Server (Feisty - 7.04) with apache2 / apache-ssl 1.3, php5 and base 1.3.8 (and snort 2.7), and mysql.  I've been following Andy Firman's installation guide from 6/23/06 deb-snort-howto.pdf "11 step guide to build a Debian based Intrusion Detection Sensor..." from the documentation page.

      I don't know much about apache or php, but it appears to be an issue getting apache to recognize the .php files as executables.  I've added the following to my /etc/apache-ssl/httpd.conf file:

         AddType application/x-httpd-php .php .phtml
         AddType application/x-httpd-php-source .phps
         AddHandler application/x-httpd-php .php .phtml
         AddHandler x-httpd-php .php .phtml

      and restarted apache-ssl (several times), refreshed / restarted my browser (firefox) without any success. 
      I've also set the *.php filse in /var/www/base to 755 and even 777 without any luck.

      I'm guessing maybe some subtle config change due to newer versions of one of the pieces of software. 

      Thanks for any tips.


      • Juergen Leising

        Juergen Leising - 2007-10-22


        some issues I had to tackle, when I
        installed BASE-1.2.7 and -1.3.5 on edgy:

        1. have you checked the owner of the *.php files?

            chown -R www-data.www-data /var/www

        2. are you sure, that cookies are enabled?

        3. If you get the following message:

        PHP ERROR: PHP build incomplete:  the prerequisite GD support required to g
        enerate graphs was not built into PHP. Please recompile PHP with the necess
        ary library (--with-gd)

        then install the following packages:


        and restart apache2.

        4. If you still get the following on
        trying to install Image_Color:

        pear/Image_Color requires PHP extension "gd"

        then you have to enable gd manually:

        vim /etc/php5/cli/php.ini

        and remove the comments in these lines:


        5. If you get

        Error loading the Graphing library:
        Check your Pear::Image_Graph installation!

        then install the following packages:


        6. and make sure you do not start snort with "-A fast".
        ps -ef | grep -i snort

        7. Have you added the BASE directory to apache2.conf (or any file in conf.d)?

        That's all, that I had to solve.

        Have a look into /var/log/apache2/error.log

        What exactly is apache2 complaining about?

        Bye, bye,


        • Chris Happel

          Chris Happel - 2007-10-22

          I think I made some progress.  For starters I figured out that just hitting 'refresh' on firefox isn't enough - I had to blow away all my local settings.  With the following in my httpd.conf -

          # And for PHP 4.x, use:
          #AddType application/x-httpd-php .php
          #AddType application/x-httpd-php-source .phps .php .phtml
          #AddHandler application/x-httpd-php .html .htm
                  #AddHandler x-httpd-php .php
                  #AddHandler server-parsed .php
                  AddHandler php5-script php
                  AddType text/html php
              AddType application/x-tar .tgz
              AddType image/bmp .bmp

              # hdml
              AddType text/x-hdml .hdml

          when browsing to https://myserver/base I get:

          ** Built upon work by Roman Danyliw , ** ** Purpose: Determines if a login is needed. If not, will redirect you ** to base_main.php ******************************************************************************** ** Authors: ******************************************************************************** ** Kevin Johnson < 10) base_header( 'Location: setup/index.php' ); require("base_conf.php"); include("$BASE_path/includes/"); include_once("$BASE_path/base_db_common.php"); $errorMsg = ""; $displayError = 0; $noDisplayMenu = 1; // Redirect to base_main.php if auth system is off if ( $Use_Auth_System == 0 ) { base_header("Location: base_main.php"); } if (isset($_POST['submit'])) { $debug_mode = 0; // wont login with debug_mode $BASEUSER = new BaseUser(); $user = filterSql($_POST['login']); $pwd = filterSql($_POST['password']); if (($BASEUSER->Authenticate($user, $pwd)) == 0) { base_header("Location: base_main.php"); } } else { $displayError = 1; $errorMsg = _LOGINERROR; } ?>

          $errorMsg"; } ?>

          and a login window, which gives an error.  It looks like apache is now recognizing the php script as something (html?), just not running it.  I'll keep playing monkeys at typewriters and see where it gets me.

          I did change the owner of the base php files as you suggested; it appears apache can find and access them, it just isn't treating them correctly.



          • Chris Happel

            Chris Happel - 2007-10-23

            It appears that apache-ssl isn't correctly loading php - I added:

            LoadModule php5_module  /usr/lib/apache2/modules/

            to the end of my /etc/apache-ssl/modules.conf file, and now I get:

            root@newids01:/etc/apache-ssl# /etc/init.d/apache-ssl restart
            * Configuration syntax error detected, not starting/reloading...                                                                                 
            Syntax error on line 24 of /etc/apache-ssl/modules.conf:
            Cannot load /usr/lib/apache2/modules/ into server: /usr/lib/apache2/modules/ undefined symbol: apr_pool_cleanup_null

            or is the php module handled in apache2?  it seems to be properly include there - I don't really understand the relation between apache2 and apache-ssl.  I don't seem to be getting anywhere - isn't LAMP the linux 'killer app'?

            http://myserver/phpinfo.php DOES work - but http://myserver/base gives:

            Fatal error: Call to undefined function base_header() in /var/www/base/index.php on line 27

            and https://.../phpinfo.php and https://.../base both just download the file.


            • Juergen Leising

              Juergen Leising - 2007-10-23

              > Fatal error: Call to undefined
              > function base_header() in
              > /var/www/base/index.php on line 27

              Ok, this is a known bug of BASE. You can fix this for now by editing index.php:
              Change line 27 from

              base_header( 'Location: setup/index.php' );


              header( 'Location: setup/index.php' );

              And after that go through the setup cycle WITHOUT SSL. That is

              Try and complete all 5 steps, because the last step is the one that adds some new tables to the database BASE relies on. You can always start from the beginning by simply deleting base_conf.php. This will force you to go through the setup again. By doing this a new base_conf.php will be derived from base_conf.php.dist.

              Now, it seems, feisty has two
              different configuration directories
              for apache, as opposed to edgy. And the one that is intended for SSL, is, err, buggy, presumably. That undefined 
              symbol message seems to require an update. has to be loaded by apache in any case, regardless of with or without SSL.

              I do not have any /etc/apache-ssl/modules.conf, either.

              On edgy I had only a php5.conf file, where I didn't have to change anything:

              <IfModule mod_php5.c>
                AddType application/x-httpd-php .php .phtml .php3
                AddType application/x-httpd-php-source .phps

              Your AddType settings, do not seem to be correct. The dots must not be left out. And the AddHandler settings shouldn't be necessary at all.

              In order to add SSL support, however, I had to add port 443 to /etc/apache2/ports.conf:

              Listen 80
              <IfModule mod_ssl.c>
              Listen 443

              and in /etc/apache/apache2.conf there
              was more to change to add SSL:

              <Directory "/var/www/base">
                AllowOverride   FileInfo Limit
                Options         SymLinksIfOwnerMatch

                SSLOptions +FakeBasicAuth +StrictRequire

                SSLVerifyClient optional

                SSLVerifyDepth  1

                SSLRequire %{SSL_CIPHER_USEKEYSIZE} >= 128

              ####### Force clients from the Internet to use HTTPS ######

              RewriteEngine   on
              RewriteCond     %{SERVER_PORT}     !^443$
              RewriteRule     (.*) https://%\{HTTP_HOST}%{REQUEST_URI}


              and I did the same for
              <Directory "var/www/adodb_4.52">

              But I didn't have to add any php related stuff. The defaults were all ok. As I said: edgy, not feisty.

              (maybe I did it wrong in terms of
              what ubuntu people expect with regard to SSL; as long as it works, I don't mind).

              Bye, bye,


              • Chris Happel

                Chris Happel - 2007-10-23

                Sweet!  I made the 'base_header' to 'header' change in the index.php, and once more in the setup/setup2.php file, and it works (at least without ssl - I'll look at adding that next).  I was able to run through the setup, and I'm running reports and seeing my alert info. 

                As I mentioned in one of my other posts, somewhere in the setup directions I had I ended up installing apache_ssl in addition to apache2, and was mixing my php configs between them.  I'll probably still end up re-installing to clean things up, but at least now I know what it's supposed to look like.

                Thanks for your assistance.


        • Chris Happel

          Chris Happel - 2007-10-22

          I noticed that in my httpd.conf commenting out:

          AddType text/html php

          gets me back to where the browser wants to download the file, so I guess that defines it as html, but

          AddType application/x-httpd-php php

          doesn't appear to define it as a script, or php just isn't working with apache.  I am pleased that I've managed to confirm that I'm actually editing the conf file that apache is running.

          Note that I can run a 'phpinfo.php' script -

          print_r (phpinfo());

          from an interactive command-line php, (sudo -u www-data php -f /var/www/phpinfo.php) but it won't run from a browser window (https://myserver/phpinfo.php) - I just get a blank page.  The only thing in the apache error.log are all my restarts and a mysql error, which I assume is because I haven't gotten far enough to define a database - although if the script isn't even running I'm not sure where that would come from, and the apache-ssl error.log has some jibberish that appears to be the result of trying to run the php script as html.

          Let me know if there is anything useful in the output from the command line phpinfo.php; I won't waste space on the forum posting the entire thing unless it will help.



Log in to post a comment.