0

I am trying to write a c program that executes a PHP script. I tried using php_execute_script function that I came across in my google search. However, it seems I have to call TSRMLS_FETCH() which throws an exception. Does anyone have an idea why? or how should I do this in the proper way?

Thanks.

1
  • Can you post a bit more context? Commented Oct 23, 2012 at 9:12

2 Answers 2

4

you can use exec function:

exec ("php myscript.php");

or you can use popen:

FILE *p;
p = popen("php myscript.php","r");
pclose(p);
Sign up to request clarification or add additional context in comments.

2 Comments

I want a solution that does not open another process. Does any one know how to use php_execute_script correctly ?
could you provide link to php_execute_script that you use
0

What you want is embedding the PHP interpreter. You may try PHPEmbed from the facebook github

3 Comments

I tried using it, but I get an access violation when I call the php_* functions. Any ideas?
Could you post your code (or at least the part that's causing the acces violation)?
And btw are you using a php built with --enable-embed passed to the configure script?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.