Page 1 of 1

Running Phalanger in a restricted AppDomain

PostPosted: July 1st, 2007, 6:16 pm
by schizoidboy@codeplex
Hi, is it possible to run Phalanger in a restricted AppDomain? It appears to require a lot of permissions, for example, just ScriptContext.RunApplication requires:

new SecurityPermission(SecurityPermissionFlag.ControlThread)
new ConfigurationPermission(PermissionState.Unrestricted)
new EnvironmentPermission(PermissionState.Unrestricted)

As I get deeper into giving it permissions, I'm opening up huge holes. The latest one needed is:

The demand was for:
<IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Flags="UnmanagedCode"/>

Once I give my restricted AppDomain this permission, the user can start running arbitrary PInvoke calls from their PHP.NET code.

Has this been part of the design of Phalanger? Is there another way to do this? I am writing a host that hosts .NET plugins, such as PHP.NET.

Thanks,

RE: Running Phalanger in a restricted AppDomain

PostPosted: July 1st, 2007, 11:04 pm
by bseddon@codeplex
One of the features Phalanger supports is the ability to use exising extension (c) dlls. This requires that Phalanger to P/Invoke. The ability to use arbitrary extensions is a benefit to users of existing PHP scripts because these are likely to use extensions. So I think it is by design.

RE: Running Phalanger in a restricted AppDomain

PostPosted: July 4th, 2007, 10:17 pm
by schizoidboy@codeplex

bseddon wrote:
One of the features Phalanger supports is the ability to use exising extension (c) dlls. This requires that Phalanger to P/Invoke. The ability to use arbitrary extensions is a benefit to users of existing PHP scripts because these are likely to use extensions. So I think it is by design.


Is there any way to turn off extension dlls? What do extension dlls entail? Is MySQL an extension dll?

Thanks,

RE: Running Phalanger in a restricted AppDomain

PostPosted: July 12th, 2007, 11:20 am
by bseddon@codeplex

Is there any way to turn off extension dlls? What do extension dlls entail? Is MySQL an extension dll?

No, there's no way to turn extensions off. Extensions are fundamental to PHP and, yes, the MySQL support in PHP is provided by an extension.

It sounds like what you are really wanting to do is use the PHP syntax in .NET. If so there are other tools you could use. As mentioned in the original reply, Phalanger seems to be trying to replicate the whole of the PHP experience and this includes extensions. If extensions are not supported then existing PHP apps such as Mambo, Joomla and MediaWiki could not be ported to work in a .NET AppDomain instance.

Bill