Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to execute a CGI/Perl script inside a php script

Status
Not open for further replies.

kfickert

Programmer
Jan 10, 2000
12
0
0
US
Visit site
Here is my problem: I have a PERL news script I've been using and I want to place it on one of the new start pages which is written in PHP.&nbsp;&nbsp;There are other items on the page that are in and require PHP to run.&nbsp;&nbsp;I attempted to use require and include, and all that did was display the coding of the script.<br><br>Is their anyway to run SSI with in a page ending with .PHP or is their some function I havn't learned yet that will execute PERL script?
 
To run a PERL script use <FONT FACE=monospace><b>system( 'script.cgi')</b></font>. It runs the the executable specified in the parameter and shows (sends back to the browser) its output.<br>You can use <FONT FACE=monospace><b>exec</b></font> (no output) and <FONT FACE=monospace><b>passthru</b></font> (raw output) commands too. See the documentation for details!<br><br>bandi.
 
I just stumbled onto this while searching for something completely different.. but the virtual() function is ideal for including other scripts in a php script... -gerrygerry

Standard response to one of my posts:
&quot;No where in your entire rantings did you come anywhere close to what can be considered a rational answer. We are all now dumber from having heard that. I award you no points and may God have mercy on your soul.&quot;
 
How exactly does one use virtual() to execute a perl script? I've been trying to get virtual() and/or exec() to run a perl script, that simply creates a .csv file, and have had no luck. The script runs when I call it from the shell. I'm using linux/apache.
 
The php page has a button, and when the button is pressed the perl script is supposed to execute & produce this text file.

When I try
virtual(&quot;my_script.pl&quot;)

clicking the button causes the text of the script to appear in the browser.
When I try
exec(&quot;my_script.pl&quot;), exec(&quot;perl my_script.pl&quot;)
nothing appears to happen.

The script is in the same directory as the .php page. They are both in the
 
Yup.

Does this script have to be *owned* by the apache user as well (not just in the group)?
 
OK, it was a permissions problem with creating the document. I had to change the group of the directory to www, and it worked right away! Thanks for talking me off the ledge, sleipnir.

-emily
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top