C++ app on linux via PHP

thickglass

New member
Registered
Joined
Nov 17, 2016
Messages
1
Points
0
Hi guys, is there a way to run a C++ app on linux via PHP? For example user passes post request to php script and php runs a C++ app...
 

LJSHost

Well-known member
Hosting Provider
Registered
Joined
Jul 5, 2016
Messages
1,031
Points
63
You can execute an external program using PHP with the exec() function.

Example usage:

<?php

exec ("/home/user/file_to_execute");

?>

You could have problems with permissions depending if PHP is executing as the user or the webserver, i.e suPHP.

Hope this helps.
 

stackstar

Member
Registered
Joined
Nov 22, 2016
Messages
30
Points
0
Executing binary files via web such as PHP has security concern implications. Its generally not a best practice to execute binary (i.e. compiled C++ applications) via a web interface because the binary file usually doesn't have the same constraints as native PHP.

Usually most web hosts disable the exec() function anyways because of this.
 
Older Threads
Replies
14
Views
9,451
Replies
6
Views
3,429
Replies
4
Views
5,162
Replies
24
Views
8,011
Newer Threads
Replies
7
Views
2,857
Replies
6
Views
2,316
Replies
9
Views
4,819
Replies
12
Views
5,132
Latest Threads
Similar Threads
Replies
0
Views
810
Replies
5
Views
1,015

Latest Hosting OffersNew Reviews

Sponsors

Tag Cloud

You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.

Top