Rockstar
Rockstar

Reputation: 191

PHP exec() not working

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?

Upvotes: 0

Views: 1461

Answers (1)

Manse
Manse

Reputation: 38147

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

Upvotes: 3

Related Questions