eb110k
asked on
How do I execute PHP file from Perl?
Hello, I'm a PHP programmer and newbie to Perl and having a problem.
I'm trying to execute PHP file from Perl script as shown below.
I'm sure the path to PHP is correct.
But it doesn't work.
Please someone advise.
Thank you.
I'm trying to execute PHP file from Perl script as shown below.
I'm sure the path to PHP is correct.
But it doesn't work.
Please someone advise.
Thank you.
#!/usr/local/bin/perl
#!/usr/local/bin/php
system('/home/myweb/public_html/test.php');
print "Content-type: text/html\n\n";
print "Hello";
==================Code of PHP File======================
<?php
mail("info@myaddress.com", "Test", "This message sent by Perl");
?>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
On the other hand, I assume you have a reason that you must include some fuctionality in PHP? Is there a reason why you must call an external PHP script, rather than just doing it all in Perl (or PHP, for that matter)?
ASKER
Thank you for your advise.
Yes, I have many reasons to include PHP to Perl.
My website build with PHP and need to work with Perl for some module.
There are lot of functions to process after the Perl script executed.
I wish that I could write everything in Perl for this process, but I really don't have time to work with it since I'm still newbie to Perl.
Yes, I have many reasons to include PHP to Perl.
My website build with PHP and need to work with Perl for some module.
There are lot of functions to process after the Perl script executed.
I wish that I could write everything in Perl for this process, but I really don't have time to work with it since I'm still newbie to Perl.
ASKER
Thank you for your advise.
Try this
#!/usr/local/bin/perl
system('php -f /home/myweb/public_html/test.php');
print "Content-type: text/html\n\n";
print "Hello";