Jump to content


Photo

Embedding PHP


  • Please log in to reply
2 replies to this topic

#1 steffc

steffc
  • New Members
  • Pip
  • Newbie
  • 1 posts
  • LocationBoston, MA

Posted 12 November 2003 - 03:43 PM

Has anyone managed to successfully embed php into a program? I\'ve been trying to but it keeps crashing. I do exactly as provided in phpembed.c but it just won\'t work. Have you guys had any luck with it?

#2 daeken

daeken
  • Members
  • PipPip
  • Member
  • 22 posts
  • LocationChambersburg, PA

Posted 12 November 2003 - 05:02 PM

I\'ve played with it a bit and haven\'t had any issues (except with thread safety). If you post your code here, i may be able to help you find the problem :)
Black and white are all I see in my infancy.

#3 touqen

touqen
  • New Members
  • Pip
  • Newbie
  • 1 posts
  • LocationBoston, MA

Posted 12 November 2003 - 11:17 PM

int main(int argc, char** argv){

zend_executor_globals executor_globals;

PHP_EMBED_START_BLOCK(argc, argv);
//php_embed_init(argc, argv);

char *php_code = \"return \"This is a test\";\";
zval retval;

zend_eval_string(php_code, &retval, \"Embedded Code\" TSRMLS_CC);

PHP_EMBED_END_BLOCK();
//php_embed_shutdown();
return 0;
}
This is the code that I was using just to see if it would do anything but it would crash on the PHP_EMBED_START_BLOCK macro. I think it was the php_embed_init function that phpembed.c creates.

This is steffc!!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users