Re: [Postfixadmin-devel] Blank domain.tld/setup.php page nothing in logs
Brought to you by:
christian_boltz,
gingerdog
|
From: Danny H. <dho...@gm...> - 2019-03-11 23:24:05
|
Hello again
On Mon, 2019-03-11 at 23:10 +0100, Christian Boltz wrote:
>
> > <li><b>Error: Depends on: presence config.inc.php - NOT FOUND
>
> That's... interesting[tm].
>
> It's especially interesting because setup.php starts with
> require_once(dirname(__FILE__).'/common.php');
> which has
> require_once(dirname(__FILE__) . '/../common.php');
> and that one has
> $incpath = dirname(__FILE__);
> if (!is_file("$incpath/config.inc.php")) {
> die("config.inc.php is missing!");
> }
> require_once("$incpath/config.inc.php");
>
> so setup.php should fail _before_ printing the header, and before
> printing the failure about finding config.inc.php.
>
> This indicates that require_once() can read config.inc.php.
>
> To confirm that, please introduce a syntax error in config.inc.php,
> and
> then run setup.php on the commandline again. You should see a
> message
> about that syntax error.
I added some gibberish to the config.inc.php file and i indeed get a
Syntax errors :)
[houtworm@server ~]$ sudo -u http php
/usr/share/webapps/postfixAdmin/public/setup.php
PHP Parse error: syntax error, unexpected 'ik' (T_STRING) in
/usr/share/webapps/postfixAdmin/config.inc.php on line 17
[houtworm@server ~]$
> > The location in setup.php is set to /../config.local.php also the
> > inc
> > one
> > The files are there 100% they are owned by http:http and the
> > permissions are 644
> >
> > [houtworm@server ~]$ cd /usr/share/webapps/postfixAdmin/
> > [houtworm@server postfixAdmin]$ ls
> > common.php config.local.php languages public template
> > s_c
> > composer.json configs lib README.md
> > composer.lock functions.inc.php model scripts
> > config.inc.php index.php phpunit.xml templates
> > [houtworm@server postfixAdmin]$
>
> Looks good.
Great :)
>
> One idea I have is the way how setup.php checks for config.local.php:
>
> $file_config = file_exists(realpath("./../config.inc.php"));
>
> $file_local_config =
> file_exists(realpath("./../config.local.php"));
>
> Note the realpath() call, which means resolving all symlinks.
> Does the path /usr/share/webapps/postfixAdmin/public/ include any
> symlinked part?
In /postfixAdmin only .htaccess is symlinked
in /public only password-change.php and password-recover.php are
symlinked
The config files where both symlinked because i copied local from inc,
i removed both and made new files for them to ensure they are not
symlinked. I did this before but it did not help, Maybe the inc file
needs to be symlinked?
> If in doubt, add
> echo "\n\n file_config: $file_config local $file_local_config
> \n\n"
> to setup.php (directly under the lines quoted above) and check the
> result.
I edited it like this /usr/share/webapps/postfixAdmin/public/setup.php
56 $file_config = file_exists(realpath("./../config.inc.php"));
57 $file_local_config = file_exists(realpath("./../config.local.php"));
58 echo "\n\n file_config: $file_config local $file_local_config
59 > \n\n";
60 $error = 0;
terminal output
[houtworm@server ~]$ sudo -u http php
/usr/share/webapps/postfixAdmin/public/setup.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="css/default.css" />
<title>Postfix Admin - PHP Notice: Undefined index: HTTP_HOST in
/usr/share/webapps/postfixAdmin/templates/header.php on line 22
</title>
</head>
<body>
<div id="login_header">
<img id="login_header_logo" src="images/logo-default.png" />
</div>
<div class='setup'>
<h2>Postfix Admin Setup Checker</h2>
<p>Running software:
<ul>
file_config: local
>
<li>PHP version 7.3.3</li>
</ul><p>Checking for dependencies:
<ul>
<li>Magic Quotes: Disabled - OK</li>
<li><b>Error: Depends on: presence config.inc.php - NOT FOUND</b><br
/></li>
Create the file, and edit as appropriate (e.g. select database type
etc)<br />For example:<br />
<code><pre>cp config.inc.php.sample config.inc.php</pre></code>
<li><b>Warning: config.local.php - NOT FOUND</b><br /></li>
It's Recommended to store your own settings in config.local.php instead
of editing config.inc.php<br />Create the file, and edit as appropriate
(e.g. select database type etc)<br /><li>Depends on: MySQL 4.1 - OK
<br>(change the database_type to 'mysqli' in config.local.php if you
want to use MySQL)
</li><li>Depends on: PostgreSQL - OK
<br>(change the database_type to 'pgsql' in config.local.php if you
want to use PostgreSQL)
</li><li>Depends on: session - OK</li>
<li>Depends on: pcre - OK</li>
<li>Depends on: multibyte string - OK</li>
<li>Depends on: IMAP functions - OK</li>
</ul><p><b>Please fix the errors listed above.</b></p></div>
</body>
</html>
[houtworm@server ~]$
> Also note that there's a fallback check for config.local.php:
>
> // Fall back to looking in /etc/postfixadmin for
> config.local.php
> // (Debian etc)
> if (!$file_local_config && is_dir('/etc/postfixadmin')) {
> $file_local_config = file_exists(
> '/etc/postfixadmin/config.local.php');
> }
>
> which can mean
> a) try to create a /etc/postfixadmin/config.local.php and check if
> setup.php finds it
> b) make sure your PHP open_basedir allows access to
> /etc/postfixadmin/
I made the /etc/postfixadmin/ directory and copied config.local.php
into it but the output is still the same
[houtworm@server ~]$ sudo -u http php
/usr/share/webapps/postfixAdmin/public/setup.php
[sudo] password for houtworm:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="css/default.css" />
<title>Postfix Admin - PHP Notice: Undefined index: HTTP_HOST in
/usr/share/webapps/postfixAdmin/templates/header.php on line 22
</title>
</head>
<body>
<div id="login_header">
<img id="login_header_logo" src="images/logo-default.png" />
</div>
<div class='setup'>
<h2>Postfix Admin Setup Checker</h2>
<p>Running software:
<ul>
file_config: local
>
<li>PHP version 7.3.3</li>
</ul><p>Checking for dependencies:
<ul>
<li>Magic Quotes: Disabled - OK</li>
<li><b>Error: Depends on: presence config.inc.php - NOT FOUND</b><br
/></li>
Create the file, and edit as appropriate (e.g. select database type
etc)<br />For example:<br />
<code><pre>cp config.inc.php.sample config.inc.php</pre></code>
<li><b>Warning: config.local.php - NOT FOUND</b><br /></li>
It's Recommended to store your own settings in config.local.php instead
of editing config.inc.php<br />Create the file, and edit as appropriate
(e.g. select database type etc)<br /><li>Depends on: MySQL 4.1 - OK
<br>(change the database_type to 'mysqli' in config.local.php if you
want to use MySQL)
</li><li>Depends on: PostgreSQL - OK
<br>(change the database_type to 'pgsql' in config.local.php if you
want to use PostgreSQL)
</li><li>Depends on: session - OK</li>
<li>Depends on: pcre - OK</li>
<li>Depends on: multibyte string - OK</li>
<li>Depends on: IMAP functions - OK</li>
</ul><p><b>Please fix the errors listed above.</b></p></div>
</body>
</html>
[houtworm@server ~]$
> > My Database is
> ... irrelevant, at least until the problems with config.inc.php and
> config.local.php are solved ;-)
Good to know, i won't look into that untill this is fixed :)
> > Nginx Setup: https://paste.ee/p/IE2na
> > Local and Inc config: https://paste.ee/p/VcMUQ
> >
> > I hope there is an obvious mistake here somewhere
>
> I checked them, and didn't see an obvious error.
> That's not surprising because the syntax check already confirmed
> that
> your config.*.php is ok, at least the first half of setup.php
> worked,
> and the nginx config is irrelevant when running php on the command
> line.
Then finding that file is the only thing that matters, Very strange it
does not see it.
If i can provide any more information please let me know,
Thanks,
Danny
> Regards,
>
> Christian Boltz
|