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
14,853
Replies
6
Views
5,586
Replies
4
Views
7,762
Replies
24
Views
13,443
Newer Threads
Replies
7
Views
4,948
Replies
6
Views
3,869
Replies
9
Views
7,626
Replies
12
Views
8,864
Latest Threads
Replies
1
Views
1,327
Replies
3
Views
1,099
Replies
1
Views
688
Replies
2
Views
1,281
Replies
1
Views
860
Recommended Threads
Replies
2
Views
4,638
Replies
3
Views
3,579
Replies
9
Views
8,836

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