shell exec - shell_exec() in PHP doesn't execute my specific command -
I am currently building a class in PHP which generates PDF documents using the command line app.
To do this, I am using call to shell_exec to call WKHTMLTOPDF executable. However, this special call is not executed; It returns almost immediately.
I gave me the following results for a small test:
var_dump (shell_exec ('ping nu.nl')); // It prints a string, in which the ping command var_dump (shell_exec ('"c: /wkhtmltopdf/wkhtmltopdf.exe" - Estimate "Landscape" - Page Size "A2" - Margin-Top "25mm" - Margin- Left "20mm" - margin-down "20mm" - margin-right "20mm" "http://www.nu.nl/" "C: /Temp/1280310218.pdf" ')); // It prints zero
, therefore shell_exec ()
is working, this is also closed safe_mode
, and complete The command pastes the command does command in Cmd.exe runs properly.
If any of the above problems (safe mode, a defective command, or shell_exec ()
itself) and what could be? All I can think about is a User Rights issue, but both executables and directories have full access settings for each user group on my system.
(Note: Although I'm developing on a Windows machine, this code will run on a Linux server in production. Therefore, windows are not the only solutions I see, as long as this problem The possibility of not related to the window itself)
Check permissions by creating a file using FOPAN () . Is this a PDF? This program may not output to stdout, but similar to ffmpeg for stderr example. Try adding "2> & amp; 1" after your order
Or, this software uses some files in that directory where it is installed. First try to change directory by adding something like "Cd c: \ wkhtmltopdf; YOUR_COMMAND"
Comments
Post a Comment