40 users online (0 members and 40 guests)  


  Results 1 to 2 of 2

Related

  1. Replies: 0
  2. Executing the PERL CGI Script    Forum: CGI Perl Forum
    Replies: 1
  3. Javascript executing perl?    Forum: Javascript Forum
    Replies: 4
  4. Executing A CGI Script?    Forum: CGI Perl Forum
    Replies: 2
  1. #1
    ebohatch's Avatar
    New User

    Status
    Offline
    Join Date
    Jun 2010
    Posts
    1

    perl not executing from PHP

    I have a php module with the following:
    <?php
    echo "
    <HTML>
    <HEAD>
    <TITLE>web Gallery</TITLE>
    </HEAD>
    <BODY>
    <P>
    web gallery
    ";
    exec("perl simple.pl");
    echo "
    </p>
    </BODY>
    </HTML>
    ";
    ?>

    It never executes the perl program simple.pl


    If I run CMD it runs the program just fine??


    I have a Win 7 system running following:
    Apache/2.2.14 (Win32)
    DAV/2 mod_ssl/2.2.14
    OpenSSL/0.9.8l mod_autoindex_color
    PHP/5.3.1 mod_apreq2-20090110/2.7.1
    mod_perl/2.0.4
    Perl/v5.10.1

    To the begining of the PATH variable I haave added
    C:\xampp\perl\bin;C:\Program Files\ImageMagick-6.6.2-Q16;

    These were installed with Xampp.

    Any help will be appreciated, I have some older php and perl modules that used to work (2006) with older Apache/PHP/Perl versions. but I am just getting back to them now.

  2. #2
    xmassey's Avatar
    Senior Member

    Status
    Offline
    Join Date
    Apr 2007
    Posts
    100

    Re: perl not executing from PHP

    Hey,

    Try adding the perl shebang to the beginning of the string.

    E.g.
    Code:
    <?php
    exec("/usr/bin/perl; perl simple.pl", $output); 
    echo implode($output);
    ?>
    If you just want to "print" the output of the perl script I find the easiest way is to use the include function (note that you must provide a "full" URL).

    E.g.
    Code:
    <?php
    $include_url = 'http://www.domain.com/simple.pl';
    include($include_url);
    ?>
    Chris