exec() issues

Problems with the Windows version of XAMPP, questions, comments, and anything related.

exec() issues

Postby TheReborned » 12. May 2022 03:06

hello. i am using the function exec(); on xamp to start an exe on my vps. it seems to work using cmd/powershell and also with the php command. but when i use exec(); from site the exe runs in task manager but is at 0% cpu and doesnt open up. i tried using other similar functions and asked many people about this issue but they doesnt seem to understand whats going on either.
TheReborned
 
Posts: 3
Joined: 12. May 2022 03:02
Location: canada
XAMPP version: 8.0
Operating System: window 11

Re: exec() issues

Postby Nobbie » 12. May 2022 13:30

What is your "vps"?
What is your "site"?
Which programs do you start via exec? Can we see the original PHP code?
Nobbie
 
Posts: 13223
Joined: 09. March 2008 13:04

Re: exec() issues

Postby TheReborned » 12. May 2022 15:28

i use xampp with php 8.0. the provider is VPSDime. i already contacted them and they tried helping but found no fix. they told me to make a post on here and hope for an answer.
the line is exec("START render.exe"); the exe is in the same directory as the php file. i tried the full path and other solutions and nothing works. but if i run the file using "PHP test.php" in the command promp it works perfectly fine. it only doesnt work when i try executing the exe on site using xampp.
TheReborned
 
Posts: 3
Joined: 12. May 2022 03:02
Location: canada
XAMPP version: 8.0
Operating System: window 11

Re: exec() issues

Postby Nobbie » 13. May 2022 09:55

What is render.exe? You cannot start every program remotely, many programs need special devices (monitors, graphic cards etc.) and/or terminal access, which do not exist on remote webservers.

Only so called batch programs can run remotely and these must not produce any terminal output on stdout. To avoid terminal output you should redirect the output to a file. Also use fully qualified pathname for render.exe, dont use START as this a builtin command from cmd.exe.

exec("c:/path/to/render.exe > output.txt");

Replace /path/to by appropriate path. But still, if render.exe requires any special devices like GPU, it wont run.
Nobbie
 
Posts: 13223
Joined: 09. March 2008 13:04

Re: exec() issues

Postby TheReborned » 13. May 2022 14:29

i already tried doing the full path and without start. render.exe is a unity program built to make thumbnails. it works with xampp on my personal computer, but not on the vps. i also tried other programs but no luck. it only runs if i use cmd and write "START (path)" or "php test.php" but not exec();. i will try the line you provided tho and tell you what i get. EDIT: if i use -batchmode it seems to run!
TheReborned
 
Posts: 3
Joined: 12. May 2022 03:02
Location: canada
XAMPP version: 8.0
Operating System: window 11

Re: exec() issues

Postby Nobbie » 13. May 2022 23:04

TheReborned wrote:if i use -batchmode it seems to run!


Thats what i said.
Nobbie
 
Posts: 13223
Joined: 09. March 2008 13:04


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 156 guests