Environment::getBasePath() issue

Ask your questions regarding TimeTrex installation here.
Post Reply
harlan
Posts: 6
Joined: Tue Aug 20, 2019 5:15 am

Environment::getBasePath() issue

Post by harlan »

I'm trying to run timetrex in a jailed apache instance, under /www.

Apache is installed under /www along with PHP and the other needed bits.

Timetrex is installed in /www/data/ttrex0.my.domain/ .

To make administration and management easier, under /www there is a symlink from 'www' to '.'. This lets us use /www/whatever to reach things, regardless of whether or not we are in the jail.

The setup check is failing:

PHP CLI requirements failed while executing
"/www/bin/php" "/data/ttrex0.my.domain/tools/unattended_upgrade.php" --config "/data/ttrex0.my.domain/includes/../timetrex.ini.php" --requirements_only --web_installer
Likely caused by having two PHP.INI files with different settings.

and the problem is that the files are in /www/data, not /data.

If I enter the jail and manually run:

/www/bin/php /www/data/ttrex0.my.domain/tools/unattended_upgrade.php --config /data/ttrex0.my/domain/includes/../timetrex.ini.php --requirements_only

the check passes.

It looks like something that feeds Environmenet::getBasePath() sees that 'www' is a link to '.' and is deciding to strip it. But this doesn't work because the top of the jail has things like bin, etc, lib, …, and www. The 'data' subdir is only under /www/ . If the www is stripped, fully-rooted paths stop working.

I don't think I'm explaining this ideally, but I hope I'm at least explaining it well enough.

Since this box will be exposed to the internet, we really want it to be secure, and use a jailed apache instance just like all our other internet-visible apache machines.

Recommendations?

H
mikeb
Posts: 709
Joined: Thu Jul 27, 2006 11:58 am

Re: Environment::getBasePath() issue

Post by mikeb »

If I understand you correctly, I don't think this has anything to do with TimeTrex, its simply how your file system is setup. If at the console you run this:

Code: Select all

realpath /www/data/ttrex0.my.domain
It will likely show:

Code: Select all

/data/ttrex0.my.domain
Which is correct, since that is actually where the file is truly located, and where PHP is reading it from, and passing it along to TimeTrex. Symlinks are just that, symbolic, if you try a hardlink instead it may help.
TimeTrex Community Edition is developed and supported by volunteers.
Help motivate us to continue by showing your appreciation!
harlan
Posts: 6
Joined: Tue Aug 20, 2019 5:15 am

Re: Environment::getBasePath() issue

Post by harlan »

Thanks!

Unix really doesn't want folks to make hard links to directories.

Furthermore, from inside the jail:

> cd /www
> ls -l www
lrwxr-xr-x 1 root wheel 1 Aug 23 21:30 www -> .
> realpath www/data/test (Note the missing initial /)
/www/data/test
>

so something else is going on.

I'm not aware of a chroot(/www) but I'll look.

Any other ideas?
Post Reply