Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0001283 [SysCP] Configfiles crash always 2009-12-28 20:32 2009-12-28 20:38
Reporter TehDooMCat View Status public  
Assigned To
Priority normal Resolution open  
Status new   Product Version 1.4.2.1
Summary 0001283: SysCP creating broken lighttpd config files
Description SysCP seems to be creating lighttpd config files (the ones like /etc/lighttpd/conf-enabled/10_syscp_ipandport_*.conf) with syntax errors, which prevents lighttpd from reloading the config. When you restart lighty manually (with /etc/init.d/lighttpd force-reload) it refuses to load, reporting errors such as the following:

2009-12-28 19:55:02: (configfile.c.864) source: /etc/lighttpd/conf-enabled/10_syscp_ipandport_69.73.143.171.80.conf line: 199 pos: 1 parser failed somehow near here: (EOL)
2009-12-28 19:55:02: (configfile.c.864) source: /usr/share/lighttpd/include-conf-enabled.pl line: 4 pos: 8 parser failed somehow near here: (EOL)
2009-12-28 19:55:02: (configfile.c.864) source: /etc/lighttpd/lighttpd.conf line: 68 pos: 14 parser failed somehow near here: (EOL)

What's breaking the configs for me is when I define different 404 pages for my directories. They appear in the configfile like this:

$HTTP["url"] =~ "^/gtaber($|/)" {
        dir-listing.activate = "enable"
}
  server.error-handler-404 = "/index.php"
$HTTP["url"] =~ "^/slashingedge($|/)" {
        dir-listing.activate = "enable"
}
  server.error-handler-404 = "/index.php"
[etc]

And it should look like this:

$HTTP["url"] =~ "^/slashingedge($|/)" {
        dir-listing.activate = "enable"
        server.error-handler-404 = "/index.php"
}

When I change that part of the config file manually lighttpd boots fine and all my sites are configured correctly. However, whenever a change is made in SysCP that file's rewritten so I have to change it every time.
Additional Information Problem arises from function create_pathOptions() in syscp/scripts/cron_tasks.inc.http.20.lighttpd.php, starting on line 285 (for me).
Tags No tags attached.
Attached Files

- Relationships

-  Notes
(0000456)
TehDooMCat (reporter)
2009-12-28 20:38

Problem can be fixed by replacing the 'create_pathOptions' function in syscp/scripts/cron_tasks.inc.http.20.lighttpd.php with the following code:

        protected function create_pathOptions($domain)
        {
                $query = "SELECT * FROM " . TABLE_PANEL_HTACCESS . " WHERE `path` LIKE '" . $domain['documentroot'] . "%'";
                $result = $this->db->query($query);

                while($row = $this->db->fetch_array($result))
                {
                        if(!empty($row['error404path']))
                        {
                                $error_handlerTmp= "\t".'server.error-handler-404 = "' . makeCorrectFile($row['documentroot'] . '/' . $row['error404path']) $
                        }

                        if($row['options_indexes'] != '0' or $error_handlerTmp !='')
                        {
                                $path = makeCorrectDir(substr($row['path'], strlen($domain['documentroot']) - 1));

                                // We need to remove the last slash, otherwise the regex wouldn't work

                                $path = substr($path, 0, -1);
                                $error_string.= '$HTTP["url"] =~ "^' . $path . '($|/)" {' . "\n";
                                if($row['options_indexes'] != '0') {
                                        $error_string.= "\t" . 'dir-listing.activate = "enable"' . "\n";
                                }
                                if(isset($error_handlerTmp)) {
                                        $error_string.= $error_handlerTmp;
                                }
                                $error_string.= '}' . "\n";
                        }
                }

                return $error_string;
        }

No SVN - commits yet

- Issue History
Date Modified Username Field Change
2009-12-28 20:32 TehDooMCat New Issue
2009-12-28 20:38 TehDooMCat Note Added: 0000456
Footer