FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » How to run a batch file using PHP?
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: How to run a batch file using PHP? [message #179326 is a reply to message #179325] Fri, 05 October 2012 07:55 Go to previous messageGo to previous message
Fastian is currently offline  Fastian
Messages: 20
Registered: June 2012
Karma:
Junior Member
On Friday, October 5, 2012 12:26:16 PM UTC+5, Álvaro G. Vicario wrote:
> El 05/10/2012 7:21, Fastian escribió/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?
>
>>
>
>
>
> Let's think about it. If logs complain about "latex" and "dvipng",
>
> doesn't that suggest that the batch file is actually being executed?
>
>
>
>
>
> --
>
> -- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
>
> -- Mi sitio sobre programación web: http://borrame.com
>
> -- Mi web de humor satinado: http://www.demogracia.com
>
> --
Yes you are right! But whats the solution?
I want to know that when the bat file is being run successfully from the command prompt then why not from Php script? On the other hand if I will write some command like for example 'convert picture.jpg newPicture.png' in my batch file and run it from my script using exec(), it works and I get the desired result. (perhaps as 'convert' is from a Windows built-in program)
I have googled this issue and found many people discussed the same issue. People have suggested different solutions that worked for them but still I am struggling. Any good idea will highly be appreciated. Thanks!
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: JOB - Sr. PHP Developer - Fort Lauderdale, FL - Relo/Sponsor OK
Next Topic: Regular Expression Help
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Dec 01 01:31:12 GMT 2024

Total time taken to generate the page: 0.04099 seconds