Running eval without Web.config modification
3 posts
• Page 1 of 1
Running eval without Web.config modification
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!
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
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:
Programically without modifying .config file, you can use following:
- Code: Select all
ApplicationContext.Default.AssemblyLoader.Load(.., null, null)
Jakub Misek │ DEVSENSE s.r.o. | @misekjakub │ jakub@devsense.com │
-
Jakub Misek - Posts: 2092
- Joined: January 4th, 2012, 2:42 pm
- Location: Prague
Re: Running eval without Web.config modification
Thank you very much! It works flawlessly. BTW this project is freaking awesome!
- Piedone
- Posts: 11
- Joined: October 12th, 2012, 7:30 pm
3 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 14 guests