Page 1 of 1

Problem with Safe Mode

Posted: 14 Jul 2011, 13:24
by bowlby
Hi,
Is it possible this plugin doesn't work with safe mode? I'm getting:

Code: Select all

SYSTEM WARNING: realpath() [function.realpath]: SAFE MODE Restriction in effect. The script whose uid is 87442 is not allowed to access /nfs/phpcache/tmp owned by uid 0
when i activate the plugin.


kind regards!

Re: Problem with Safe Mode

Posted: 15 Jul 2011, 15:03
by SL-Gundam
its possible. I've never really tested the plugin in a safemode environment.

But it seems it fails on the realpath function during installation / activation of the plugin. The good news is, that part has been removed in 0.9.0 (which is still under development). So maybe that version will work better when it is finally released

One thing i know for sure, the following from the readme is very important for safemode setups

Code: Select all

For correct operation of the scheduled job its advised that the job and
the webserver are operating under the same OS user account. If this is not
possible, you should either not use the DISK storage method
(file_upload_method) for MantisBT or you should adjust the global variable
attachments_file_permissions with the proper rights. In general its possible
to specify within the scheduled/cron job line which user should run the job.

Re: Problem with Safe Mode

Posted: 18 Jul 2011, 14:53
by bowlby
Hi,
thanks for your reply. I've tried the dev-version but it gives me the same error message.

As for your second remark. As i understand this only comes into place when I want to use cron?

Re: Problem with Safe Mode

Posted: 18 Jul 2011, 20:54
by SL-Gundam
Alright, we need a more specific error

Could you do the following
1. turn ON the following setting: $g_show_detailed_errors (found in the config files of MantisBT)
2. try to get the error again and tell me the line where the error occurs

The second remark applies to all types of scheduled jobs. Especially cron jobs on linux / unix. You are required to schedule a periodic job for bug_report_mail.php

Re: Problem with Safe Mode

Posted: 19 Jul 2011, 09:00
by bowlby
I've put

Code: Select all

$g_show_detailed_errors = ON;
in config_inc.php but that doesn't give me more info, I still get the same message:

Code: Select all

SYSTEM WARNING: realpath() [function.realpath]: SAFE MODE Restriction in effect. The script whose uid is 87442 is not allowed to access /nfs/phpcache/tmp owned by uid 0
I'm running the latest MantisBT (1.2.5) and 0.9-dev version (checked out this morning).

Re: Problem with Safe Mode

Posted: 19 Jul 2011, 14:53
by bowlby
Ok, here's some debug info:

Code: Select all

Full path: /nfs/vsp/example.com/b/user/public_html/mantisbt-1.2.5/plugins/EmailReporting/EmailReporting.php
Line: 33
Variable	Value	Type
Filename	Line			Function	Args
/nfs/vsp/example.com/b/user/public_html/mantisbt-1.2.5/plugins/EmailReporting/EmailReporting.php	33	-	-	realpath	( <string>'/nfs/phpcache/tmp' )
/nfs/vsp/example.com/b/user/public_html/mantisbt-1.2.5/core/classes/MantisPlugin.class.php	138	EmailReportingPlugin	->	config	-
/nfs/vsp/example.com/b/user/public_html/mantisbt-1.2.5/core/plugin_api.php	873	MantisPlugin	->	__init	-
/nfs/vsp/example.com/b/user/public_html/mantisbt-1.2.5/core/plugin_api.php	807	-	-	plugin_init	( <string>'EmailReporting' )
/nfs/vsp/example.com/b/user/public_html/mantisbt-1.2.5/core.php	194	-	-	plugin_init_installed	-
/nfs/vsp/example.com/b/user/public_html/mantisbt-1.2.5/my_view_page.php	26	-	-	require_once	( <string>'/nfs/vsp/example.com/b/user/public_html/mantisbt-1.2.5/core.php' )

Re: Problem with Safe Mode

Posted: 19 Jul 2011, 18:51
by bowlby
I replaced the variable in line 33 with a hardcoded path and that fixed the error.

But running plugin.php?page=EmailReporting/bug_report_mail gives me another safe_mode error:

Code: Select all

Mailbox: INITIALIZATION PHASE Message: Debug output memory usage Location: Mail API - Finished __construct Current memory usage: 9.29 MiB / 64M Peak memory usage: 9.3 MiB / 64M Current real memory usage: 9.5 MiB / 64M Peak real memory usage: 9.5 MiB / 64M

SYSTEM WARNING: set_time_limit() [function.set-time-limit]: Cannot set time limit in safe mode
When I enable detailed logging it doesn't give me much more to work with, only line 36 set_time_limit

Re: Problem with Safe Mode

Posted: 19 Jul 2011, 19:43
by SL-Gundam
That piece of code you were running into has been removed on the 15th of this month. After that the error should have been gone for that line. Here is the commit in question https://github.com/mantisbt-plugins/Ema ... 9dd6ac32e6

maybe that change had not been committed yet into the repository when you checked it out.

As for set_time_limit, i've committed another change a couple minutes ago which should fix that error in safemode: https://github.com/mantisbt-plugins/Ema ... 68abaffc9b

Please see whether it will work now

Re: Problem with Safe Mode

Posted: 19 Jul 2011, 19:54
by bowlby
it works in safe_mode now! Thanks for your help!

Re: Problem with Safe Mode

Posted: 19 Jul 2011, 20:13
by SL-Gundam
Good to hear. I must warn you though, the EmailReporting plugin has never been tested in a safemode environment (at least not by me) as specified earlier. Also the realpath function is also used when you change any directory variables through the EmailReporting interface. Currently thats only for the debug directory setting so i don't think it will be much of an issue, but you never know.

Anyways let us know if you run into other safemode related (and unrelated) problems