Problem with Safe Mode

This plugin allows you to report an issue in MantisBT by sending an email to a particular mail account

Moderators: Contributor, Developer

Post Reply
bowlby
Posts: 6
Joined: Jul 14, 2011 8:22 am

Problem with Safe Mode

Post by bowlby » Jul 14, 2011 8:24 am

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!

SL-Gundam
Posts: 501
Joined: Jul 06, 2011 9:17 am

Re: Problem with Safe Mode

Post by SL-Gundam » Jul 15, 2011 10:03 am

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.

bowlby
Posts: 6
Joined: Jul 14, 2011 8:22 am

Re: Problem with Safe Mode

Post by bowlby » Jul 18, 2011 9:53 am

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?

SL-Gundam
Posts: 501
Joined: Jul 06, 2011 9:17 am

Re: Problem with Safe Mode

Post by SL-Gundam » Jul 18, 2011 3:54 pm

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

bowlby
Posts: 6
Joined: Jul 14, 2011 8:22 am

Re: Problem with Safe Mode

Post by bowlby » Jul 19, 2011 4:00 am

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).

bowlby
Posts: 6
Joined: Jul 14, 2011 8:22 am

Re: Problem with Safe Mode

Post by bowlby » Jul 19, 2011 9:53 am

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' )

bowlby
Posts: 6
Joined: Jul 14, 2011 8:22 am

Re: Problem with Safe Mode

Post by bowlby » Jul 19, 2011 1:51 pm

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

SL-Gundam
Posts: 501
Joined: Jul 06, 2011 9:17 am

Re: Problem with Safe Mode

Post by SL-Gundam » Jul 19, 2011 2:43 pm

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

bowlby
Posts: 6
Joined: Jul 14, 2011 8:22 am

Re: Problem with Safe Mode

Post by bowlby » Jul 19, 2011 2:54 pm

it works in safe_mode now! Thanks for your help!

SL-Gundam
Posts: 501
Joined: Jul 06, 2011 9:17 am

Re: Problem with Safe Mode

Post by SL-Gundam » Jul 19, 2011 3:13 pm

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

Post Reply