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.
#!/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");
 
?>

Open in new window

eb110kAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mjcoyneCommented:
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mjcoyneCommented:
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)?
0
eb110kAuthor Commented:
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.

0
eb110kAuthor Commented:
Thank you for your advise.
0
PilgrimX182Commented:
Try this
#!/usr/local/bin/perl
 
system('php -f /home/myweb/public_html/test.php');
print "Content-type: text/html\n\n";
print "Hello";

Open in new window

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Perl

From novice to tech pro — start learning today.