Running eval without Web.config modification

Discussion about the open-source Phalanger [?] project.

Running eval without Web.config modification

Postby Piedone » October 12th, 2012, 8:56 pm

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!
Piedone
 
Posts: 11
Joined: October 12th, 2012, 7:30 pm

Re: Running eval without Web.config modification

Postby Jakub Misek » October 13th, 2012, 9:43 am

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)
Jakub Misek │ DEVSENSE s.r.o. | @misekjakubjakub@devsense.com
User avatar
Jakub Misek
 
Posts: 2092
Joined: January 4th, 2012, 2:42 pm
Location: Prague

Re: Running eval without Web.config modification

Postby Piedone » October 13th, 2012, 2:18 pm

Thank you very much! It works flawlessly. BTW this project is freaking awesome!
Piedone
 
Posts: 11
Joined: October 12th, 2012, 7:30 pm


Return to Phalanger project

Who is online

Users browsing this forum: No registered users and 14 guests

cron

User Control Panel

Login

Who is online

In total there are 14 users online :: 0 registered, 0 hidden and 14 guests (based on users active over the past 5 minutes)
Most users ever online was 256 on March 28th, 2024, 9:42 am

Users browsing this forum: No registered users and 14 guests