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

  • SEARCH
  • Home
  • 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 8895591
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T23:49:12+00:00 2026-06-14T23:49:12+00:00

I’m having a hard time putting the output from an executable on my web

  • 0

I’m having a hard time putting the output from an executable on my web server into a web page. I’m hoping to get a simple “Hello World” going.

Specifically, I have a very basic C program that prints “Hello World”. I’ve compiled it using gcc, which produces HelloWorld.out, which I can run from the command line.

I then have a basic index.php file, in which I am attempting to use passthru() to output the result of the C program into the web page. The .php file looks like:

<?php passthru('HelloWorld.out'); ?>

I’ve uploaded both the php and the .out file to the same directory on my server. However, index.php produces no output. I’ve looked around online and there’s a few places I may be getting this wrong… My general goal is to be able to embed the output from an executable program on my web server into the page (doesn’t need to be HelloWorld.out; possibly the .out extension doesn’t work on the server?). Or I may be using passthru() incorrectly; as I understand this is the most barebones was to use it.

Thanks!

  • 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-06-14T23:49:13+00:00Added an answer on June 14, 2026 at 11:49 pm

    When you tell the operating system to run a particular executable without an explicit path it will use the PATH environment variable (colon separated set of paths) to find it.

    Typical paths would be /bin, /usr/bin/, etc.

    If the executable can’t be found in those paths, it will throw an error and give up. To fix this, you have these choices:

    1. Specify the absolute path to the executable (i.e. /path/to/HelloWorld.out)

    2. Specify a path relative to the current directory (i.e. ./HelloWorld.out)

    3. Use PHP to create an absolute path:

      passthru(__DIR__ . '/HelloWorld.out');

    Or:

        passthru(dirname(__FILE__) . '/HelloWorld.out');
    

    Lastly, the file you wish to execute must be executable, either using chmod to change the permissions or by passing the path of the file to sh.

    passthru('/bin/sh ' . dirname(__FILE__) . '/HellWorld.out');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I would like my Web page http://www.gmarks.org/math_in_e-mail.txt on my Apache 2.2.14 server to display
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
Seemingly simple, but I cannot find anything relevant on the web. What is the
I am currently running into a problem where an element is coming back from
I'm making a simple page using Google Maps API 3. My first. One marker
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text

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.