Jump to content
View in the app

A better way to browse. Learn more.

The Uniform Server Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

run an exe with php

Featured Replies

Hi!

 

I want to make a page that reads an xml file and presents some data.

the xml is exported from a "file.exe" and also takes a parameter "param.wpf".

 

I did it with python using the os module, but I dont know if is it possible to run an exe this way from php

and also with the uniform server.

 

If it's possible they both have to be in the server right?

 

If you know something about this, a command or a link or an example would be great :unsure: , I would be gratefull.

 

Thanks

The following example may be of help! I am using test.bat replace it with your .exe

 

Save the following test.bat to any folder (it does not need to be in server root) for example c:\test\test.bat It’s a simple batch file that just echos a few lines,

 

@echo off

if "%1"=="param.wpf" goto :REV

echo 123

echo 456

echo 789

goto :END

:REV

echo 987

echo 654

echo 321

:END

exit

 

Save the following test.php to root folder www

 

<?php

$output = `c:/test/test.bat param.wpf`;

echo "

$output
";

 

$output = `c:/test/test.bat`;

echo "

$output
";

 

$output = `dir *.php`;

echo "

$output
";

?>

 

Note: The $output’s are not using quotes but backticks, in other words they are running system commands.

 

The first demonstrates passing a parameter to the batch file (executable). Second just runs the batch file with no parameters. The last one demonstrates running a standard dos command and passing a parameter (if your executable is on a system path there is no need to specify a path)

 

This PHP page may be of use

 

Al the best

Ric :unsure:

be carefull of using backtick operations. safe mode might be a problem. you should also see into the other exec commands. (but the backtick way IS the easiest)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.