Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #7261

Re: How to run a batch file using PHP?

From bill <william@TechServSys.com>
Newsgroups comp.lang.php
Subject Re: How to run a batch file using PHP?
Date 2012-10-05 07:35 -0400
Organization Aioe.org NNTP Server
Message-ID <k4mgmf$vdu$1@speranza.aioe.org> (permalink)
References <6a8001c9-b576-4b49-bbef-cef6de443c0f@googlegroups.com> <k4jf2b$57o$1@dont-email.me> <764ff07b-1bf1-45a6-9479-85e163b5712f@googlegroups.com> <timstreater-66EBE3.08561105102012@news.individual.net> <f8e25ffc-9e5e-4e8a-a8eb-74bab60f3554@googlegroups.com>

Show all headers | View raw


On 10/5/2012 4:00 AM, Fastian wrote:
> On Friday, October 5, 2012 12:56:13 PM UTC+5, Tim Streater wrote:
>> In article <764ff07b-1bf1-45a6-9479-85e163b5712f@googlegroups.com>,
>>
>>   Fastian <abdulbasit.fast@gmail.com> wrote:
>>
>>
>>
>>> To be precise, my batch file named show-preview.bat consist of only two
>>
>>> commands:
>>
>>> latex first-program.tex
>>
>>> dvipng first-program.dvi
>>
>>>
>>
>>> When I run show-preview.bat from cmd then they run successfully and I obtain
>>
>>> the desired result.
>>
>>> But when I use exec('show-preview.bat'); I am finding the following error in
>>
>>> apache_error_log:
>>
>>> 'latex' is not recognized as an internal or external command, operable
>>
>>> program or batch file.
>>
>>> 'dvipng' is not recognized as an internal or external command, operable
>>
>>> program or batch file.
>>
>>>
>>
>>> Whereas both of these commands are working fine from the command
>>
>>> prompt........ what you say?
>>
>>>
>>
>>> I also tried to pass the absolute path of the bat file within exec() but it
>>
>>> also do not work. Any idea?
>>
>>
>>
>> Don't you need the absolute paths of latex etc within the batch file?
>>
>>
>>
>> --
>>
>> Tim
>>
>>
>>
>> "That excessive bail ought not to be required, nor excessive fines imposed,
>>
>> nor cruel and unusual punishments inflicted"  --  Bill of Rights 1689
>
>
> I have also tried with the absolute path of the latex but no success.
>
as others have said, this looks like a path problem.
Apache runs with a different path than the windows command line.

Try rewriting the commands in the batch file with complete paths 
and then execute it from windows command line and then from Apache.
Then if it doesn't work copy and paste it here (not retyping it).

BTW, to quote the revered Jerry, "this is not a PHP question."

bill

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

How to run a batch file using PHP? Fastian <abdulbasit.fast@gmail.com> - 2012-10-03 21:17 -0700
  Re: How to run a batch file using PHP? "Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid> - 2012-10-04 09:49 +0200
    Re: How to run a batch file using PHP? Fastian <abdulbasit.fast@gmail.com> - 2012-10-04 22:21 -0700
      Re: How to run a batch file using PHP? "Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid> - 2012-10-05 09:26 +0200
        Re: How to run a batch file using PHP? Fastian <abdulbasit.fast@gmail.com> - 2012-10-05 00:55 -0700
          Re: How to run a batch file using PHP? Shake <QUITAESTO@QUITAESTO.NOES> - 2012-10-05 10:00 +0200
            Re: How to run a batch file using PHP? Fastian <abdulbasit.fast@gmail.com> - 2012-10-05 04:24 -0700
      Re: How to run a batch file using PHP? Tim Streater <timstreater@greenbee.net> - 2012-10-05 08:56 +0100
        Re: How to run a batch file using PHP? Fastian <abdulbasit.fast@gmail.com> - 2012-10-05 01:00 -0700
          Re: How to run a batch file using PHP? bill <william@TechServSys.com> - 2012-10-05 07:35 -0400
            Re: How to run a batch file using PHP? Fastian <abdulbasit.fast@gmail.com> - 2012-10-07 21:33 -0700
              Re: How to run a batch file using PHP? Fastian <abdulbasit.fast@gmail.com> - 2012-10-08 03:19 -0700
                Re: How to run a batch file using PHP? Erwin Moller <erwinmollerusenet@xs4all.nl> - 2012-10-08 15:16 +0200
                Re: How to run a batch file using PHP? "Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid> - 2012-10-09 12:18 +0200

csiph-web