PHP - Running external .exe file

Jay59express

Senior member
Jun 7, 2000
481
0
0
I have a file called search.exe that I would like to call using php from a web page.
The file is in the same directory as the page that is calling it.
search.exe runs fine when I run it from a command line, but I can't get php to execute it.
I have tried ``, exec, etc.
Do I need to have 777 permissions set on the executable?
Full path to the file?
The file needs no arguments, and returns nothing (it writes its results to a file, results.txt)

I am 99% sure the server is *nix
Some tips would be appreciated on using these functions, thanks.
--Jay
 

BCYL

Diamond Member
Jun 7, 2000
7,803
0
71
Make sure you have the correct permissions... Since you are running the executable through PHP, your webserver will actually be the one running it... Make sure your webserver has the permission to execute the file...
 

Jay59express

Senior member
Jun 7, 2000
481
0
0
Originally posted by: notfred
windows executables don't run on unix.

I recompiled it under unix

BCYL,
How do I check to see if my webserver has permissions? Contact the sysad?


 

BCYL

Diamond Member
Jun 7, 2000
7,803
0
71
Originally posted by: Jay59express
Originally posted by: notfred
windows executables don't run on unix.

I recompiled it under unix

BCYL,
How do I check to see if my webserver has permissions? Contact the sysad?

Do you know what user/group the webserver is running as? In any case, you probably have to give everyone the permission to execute this executable (ie. a+x)...

Another possibility is that the admin who setup the webserver might actually be blocking execution of executables.... This is potentially very dangerous and people can bring down servers easily this way... So you might consider contacting the system admin... I thought this is your own server so I didnt mention this before...
 

notfred

Lifer
Feb 12, 2001
38,241
4
0
Originally posted by: Jay59express
Originally posted by: notfred
windows executables don't run on unix.

I recompiled it under unix

Even if you did, it doesn't matter. You don't know what OS the server is running. Unless you compiled it on the webserver, it's likely still not gonig to run.
 

Jay59express

Senior member
Jun 7, 2000
481
0
0
well I just named it .exe so it would be easily recognizable as an executable.
I will talk to the system administrator tomorrow to see what he says.