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,134
Replies
6
Views
3,153
Replies
4
Views
4,993
Replies
24
Views
7,751
Newer Threads
Replies
7
Views
2,754
Replies
6
Views
2,219
Replies
9
Views
4,607
Replies
12
Views
4,833
Similar Threads

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