Most likely your web server is providing a different environment to the scripts it runs. If you check the web server's configuration, you may be able to find its settings on that environment, including PATH. However, it's usually best to use absolute pathnames, as already mentioned by hippo.

my $output = qx "php -l -d log_errors=0 $pName";

What is $pName? If it's anything derived from user input, then this is a massive security hole, see my post about this here. Even if it's not user input, it should be escaped properly to avoid potential issues with shell metacharacters. Since you say this is Windows, I would at the very least use Win32::ShellQuote to quote that command! For example:

use Win32::ShellQuote qw/quote_system_string/; my $output = readpipe(quote_system_string("php","-l","-d","log_errors= +0",$pName));

In reply to Re: Execute command by haukex
in thread Execute command by rpike

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.