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
10,014
Replies
6
Views
3,839
Replies
4
Views
5,627
Replies
24
Views
8,750
Newer Threads
Replies
7
Views
3,158
Replies
6
Views
2,544
Replies
9
Views
5,234
Replies
12
Views
5,615
Latest Threads
Replies
0
Views
130
Replies
0
Views
66
Replies
0
Views
60
Replies
1
Views
90
Similar Threads
Replies
0
Views
1,175
Replies
8
Views
1,457

Latest postsNew 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