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 #179330 is a reply to message #179329] Fri, 05 October 2012 11:24 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 1:00:53 PM UTC+5, Shake wrote:
> El 05/10/2012 9:55, Fastian escribi�:
>
>> 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!
>
>>
>
>
>
> Looks like path problems.
>
>
>
>
>
>>>> latex first-program.tex
>
> 1 2
>
>>>> dvipng first-program.dvi
>
> 1 2
>
>
>
>
>
> 1.- Command have no absolute path.
>
> 2.- Alsto argument files have no absolute path.
>
>
>
> Perhaps from command line you have de argument files in the directory
>
> where you execute the batch? PHP probably have not this path.
>
>
>
> The error I think is clear:
>
>
>
> 'latex' is not recognized as an internal or external command, operable
>
> program or batch file.
>
>
>
> If you search "not recognized as an internal or external command" you
>
> will find that 'cmd' is who writes the errors. So. this text is the
>
> result of the php exec command.
>
>
>
> path.... put the correct paths and everything will work.
>
>
>
> Regards

You may be right that the issue is due to inappropriate paths but still I am unable to figure out the problem. As far as giving absolute paths both for command and the file; i have tested it already and it did not work. By the way, right now for the sake of simplicity my php, batch and my first-program.tex files..... all are present in the same folder on the root of www (using wamp)

On google the error, I found the following link which suggest setting up of PATH if you are unable to run the latex command from cmd:
http://educ.jmu.edu/~taalmala/245_2006post/miktex/miktex_setup.html
[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:36:24 GMT 2024

Total time taken to generate the page: 0.04023 seconds