Page 1 of 1

Running eval without Web.config modification

PostPosted: October 12th, 2012, 8:56 pm
by Piedone
Hi,

I'd like to run script through Eval() without having to touch the Web.config (I can't because of other reasons). Is it possible to load in basic PHP libraries still? I've read the following resources: http://www.php-compiler.net/blog/2011/php-code-c-sharp, http://www.php-compiler.net/blog/2011/i ... langer-web, viewtopic.php?f=3&t=495, viewtopic.php?f=3&t=725
I've tried to load php4ts, php5ts, PhpNetClassLibrary with Assembly.Load(), they're apparently loaded, but e.g. the code echo str_replace("i", "k", "iiiiii"); still gives the "Call to undefined function: 'str_replace'" error.

Could you please help me?

Thank you in advance!

Re: Running eval without Web.config modification

PostPosted: October 13th, 2012, 9:43 am
by Jakub Misek
Eval runs ok, you just need to add class library with basic PHP functions into the context. Normally you would add PhpNetClassLibrary dll into <classLibrary> configuration section.

Programically without modifying .config file, you can use following:
Code: Select all
ApplicationContext.Default.AssemblyLoader.Load(.., null, null)

Re: Running eval without Web.config modification

PostPosted: October 13th, 2012, 2:18 pm
by Piedone
Thank you very much! It works flawlessly. BTW this project is freaking awesome!