0

I need to execute this below code

E:\xampp\htdocs\acm\upload\P0005\A0020>pdflatex.exe demo

in php. I used the below coding

shell_exec("cmd pdflatex.exe upload/P0005/A0020/ demo");

But its not working .. How can i execute in php?

1
  • Why do you expect it to work? Do you know what a command is? Where is the binary placed? Why don't you use the exact same command? What's the reason of writing it differently if you want to do the same? Commented May 31, 2012 at 9:31

1 Answer 1

3

You need to include the full paths :

shell_exec("cmd E:\\xampp\\htdocs\\acm\\upload\\P0005\\A0020\\pdflatex.exe E:\\xampp\\htdocs\\acm\\upload\\P0005\\A0020\\ demo");

or

shell_exec("cmd E:\\xampp\\htdocs\\acm\\upload\\P0005\\A0020\\pdflatex.exe demo");

the second example matches the first command in your question - the double backslash (\\) is used to print a \ character - the first is \ is to escape the second

Sign up to request clarification or add additional context in comments.

5 Comments

i tried that one.. but its not working.. please check this image daytimeprofits.com/images/cmd.jpg . i need to execute the same in exec or shell_exec command in php
@DipenBaskaran which one did you try ? i suggest the second is probably the more correct one
Second one i tried. When i execute the same one in command prompt its working. but in php its not working . Please check this one daytimeprofits.com/images/cmd.jpg
@DipenBaskaran try removing the cmd
Are you running in safe mode ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.