Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3337626
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T00:16:29+00:00 2026-05-18T00:16:29+00:00

I am making a program that will run a persons C++ code from PHP.

  • 0

I am making a program that will run a persons C++ code from PHP. How can I compile, run, return the output of a C++ program securly? By securly I mean how can I do it without making my system vulnerable to hackers? I guess I would just use the exec comman to GCC to compile the program then run the program using exec. But how can I do this securly?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T00:16:29+00:00Added an answer on May 18, 2026 at 12:16 am

    This is something just a little bit more advanced that something you would be able to do with a non-custom server. Most likely. Because most server providers won’t let you execute processes, and even if, they SURELY won’t let you install GCC there and run potentially unsafe code on their machine (executing processes, remember?)…

    I thought of doing something like this (online development tools with multi-language compilers, sandboxes, SVC…) someday, but just because I have a lot of space as well as a custom server right next to my normal computer.

    IF you’ve got a custom server (supposing it’s Linux, and most likely LAMP):

    • have gcc or even better g++ installed
    • have a Virtual Machine (such as Bochs) installed, along with a basic install of any Linux (other platform) – this is just for C and D steps
    • put the files on some temporary place
    • use proc_open to start the g++ with the files listed, but make sure you run this as a dedicated user – for example gccuser – a user with NO permissions but to read from the directory where the files are stored
    • A) read out the output (success or the errors / warnings) from g++
    • B) let the user download the result file
    • C) put the result file through a linker, and then write that file on the VM’s HDD – THEN run it, and you can show the output to user
    • D) (most advanced) – make a GUI kinda thing (terminal) in JavaScript / AS to talk to the running file in real-time – add a time limit… this however also means you need more than one Bochs running at once (more users) – that means you need to copy a Bochs to a temp directory, together with an empty HDD (with only OS), run it on THAT one, when finished – delete

    proc_open – http://php.net/manual/en/function.proc-open.php

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am making an application that does some custom image processing. The program will
I'm making a program that fits the wizard concept ideally; the user is walked
I'm making a program that retrieves decently large amounts of data through a python
I'm experimenting with internationalization by making a Hello World program that uses properties files
I'm fairly new to C# programming. I am making a program for fun that
I'm making a C program where I need to get the directory that the
I'm making a program which the user build directories (not in windows, in my
How would a go about making a program where the user enters a string,
I am making a C++ program. One of my biggest annoyances with C++ is
If something is making a single-thread program take, say, 10 times as long as

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.