?
Solved

How do I execute PHP file from Perl?

Posted on 2008-02-10
5
Medium Priority
?
2,080 Views
Last Modified: 2010-04-21
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

0
Comment
Question by:eb110k
  • 2
  • 2
5 Comments
 
LVL 17

Accepted Solution

by:
mjcoyne earned 2000 total points
ID: 20862692
0
 
LVL 17

Expert Comment

by:mjcoyne
ID: 20862716
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
 

Author Comment

by:eb110k
ID: 20862810
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
 

Author Closing Comment

by:eb110k
ID: 31429674
Thank you for your advise.
0
 
LVL 1

Expert Comment

by:PilgrimX182
ID: 22894953
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

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to create an extensible mechanism for linked drop downs.
Article by: Tammy
MySQLTuner is a script written in Perl that allows you to review a MySQL installation quickly and make adjustments to increase performance and stability. The current configuration variables and status data is retrieved and presented in a brief forma…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

594 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question