CG_dude Posted August 1, 2009 Share Posted August 1, 2009 Thanks for your consideration on this topic. I'm running PHP 4.2.3, I'm planning to upgrade, but not there yet. I'm running on a unix server. I'm trying to execute a perl script from my php page that is on the same server as my php and have it write the output to a txt file. I can see that hit hits the text file, but it seems that it's not executing the perl file since nothing is being written to the text file. I can execute the perl script from the command line and it works. Here is my code. I will be here most of the night and early morning trying to solve this. Thanks for any help. <?php $myfile = "/users/apache/hpws/apache/htdocs/prod_report/myresults.txt"; ?> </html> <html> <body> <!-- This table has all the job info --> <table border=1 cellspacing=2 bordercolor="#303065" align=justify WIDTH=89% bgcolor="white"> <tr bgcolor="#6699FF"><th>Line#</th> <th>Key Milestones</th> <th>End Time in PST</th> </tr> <td>18</td> <td>Transaction Handoff </td> <td> <?php $fh = fopen($myfile, 'w+'); $stringdata = shell_exec("/users/apache/hpws/apache/cgi-bin/perl_script.pl"); fwrite($fh, $stringdata); fclose($fh) ?> </td> </tr> </table> </body> </html> Quote Link to comment Share on other sites More sharing options...
CG_dude Posted August 1, 2009 Author Share Posted August 1, 2009 I did notice when I run require instead of shell_exec that it actually read everything in the perl script so I know it's seeing it, but I just can't figure out how to execute it. Any ideas ? Quote Link to comment Share on other sites More sharing options...
trq Posted August 1, 2009 Share Posted August 1, 2009 Try explicitly telling the shell what interpretor to use to parse the script. eg; $stringdata = shell_exec("/usr/bin/perl /users/apache/hpws/apache/cgi-bin/perl_script.pl"); Quote Link to comment Share on other sites More sharing options...
CG_dude Posted August 1, 2009 Author Share Posted August 1, 2009 Thanks, I actually tried that, and it's not working. I'm curious if it's a limitation with the version of PHP I am running or PHP in general. Strange, I would think I could execute the script, but not having any luck Quote Link to comment Share on other sites More sharing options...
trq Posted August 1, 2009 Share Posted August 1, 2009 Its likely then that your server user doesn't have permissions to execute the script. What permissions are on it exactly? Quote Link to comment 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.