lanmonkey Posted December 22, 2008 Share Posted December 22, 2008 I didn't know where to post this so I hope its OK in this forum. Is it possible to include a PHP file in a pearl script? Obviously there will be no interaction between the php and perl scripts but I want a php file to run at a certain point in a perl script. Possible? Quote Link to comment https://forums.phpfreaks.com/topic/138060-include-php-file-into-a-perl-script/ Share on other sites More sharing options...
flyhoney Posted December 22, 2008 Share Posted December 22, 2008 my $command = 'php path/to/script.php'; exec ($command) or print STDERR "couldn't exec $command: $!"; Quote Link to comment https://forums.phpfreaks.com/topic/138060-include-php-file-into-a-perl-script/#findComment-721626 Share on other sites More sharing options...
lanmonkey Posted December 22, 2008 Author Share Posted December 22, 2008 Thanks flyhoney, but I dont want to take the contents of the php file and execute it as perl code, I simply want to execute a php file, as PHP, at a certain point within a perl script. Quote Link to comment https://forums.phpfreaks.com/topic/138060-include-php-file-into-a-perl-script/#findComment-721631 Share on other sites More sharing options...
flyhoney Posted December 22, 2008 Share Posted December 22, 2008 Yeah, and that's what the below does. It executes the php file. Its just like running the following on the command line: php path/to/script.php If you need a return code from the php script, use system() (http://perldoc.perl.org/functions/system.html) Quote Link to comment https://forums.phpfreaks.com/topic/138060-include-php-file-into-a-perl-script/#findComment-721633 Share on other sites More sharing options...
lanmonkey Posted December 22, 2008 Author Share Posted December 22, 2008 hey it worked! Nice one! Quote Link to comment https://forums.phpfreaks.com/topic/138060-include-php-file-into-a-perl-script/#findComment-721640 Share on other sites More sharing options...
lanmonkey Posted December 22, 2008 Author Share Posted December 22, 2008 PHP session arnt working. a new PHP session is created every time the perl script is run. Any way around this? Quote Link to comment https://forums.phpfreaks.com/topic/138060-include-php-file-into-a-perl-script/#findComment-721649 Share on other sites More sharing options...
trq Posted December 22, 2008 Share Posted December 22, 2008 Of course sessions aren't working, your calling the php script via the command line. You'll want to look at ways perl can make http requests if you would like to execute your script via a server. Quote Link to comment https://forums.phpfreaks.com/topic/138060-include-php-file-into-a-perl-script/#findComment-721653 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.