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 8216539
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T12:09:39+00:00 2026-06-07T12:09:39+00:00

shell_exec and exec are not returning any content. I can’t figure out what’s wrong.

  • 0

shell_exec and exec are not returning any content. I can’t figure out what’s wrong.

Here’s some code:

echo 'test: ';
$output = shell_exec('whoami');
var_export($output, TRUE);
echo PHP_EOL . '<br>' . PHP_EOL;

And here’s the source of the output

test 2: 
<br>

I do not have control over the host, but I believe they’re running SuPHP. According to phpinfo, safe_mode is off. Running whoami from SSH outputs the expected value.

I’m at a loss. Any idea how to debug this?

  • 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-07T12:09:41+00:00Added an answer on June 7, 2026 at 12:09 pm

    You’re never printing the $output variable. The var_export() call returns the content of the variable when you call it with a true second parameter, it does not print it directly.

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

Sidebar

Related Questions

Code: $exchangesnapin = Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010; $output = shell_exec('powershell '.$exchangesnapin.';get-mailboxdatabase 2>&1'); echo( '<pre>' ); echo(
You can easily use exec() or shell_exec() to execute a system command, like ls
I'm trying to insert some data into a table with shell_exec (on localhost). Here's
i disabled safe_mode by off value and tried with shell_exec(),exec() both functions on 1and1
The case: Server doesn't support exec/shell_exec (so pdftotext is excluded) Other libraries don't accept
I want to run wget as follows shell_exec('wget 'http://somedomain.com/somefile.mp4''); sleep(20); continue my code... What
It seems like I can't use shell_exec or proc_open on my shared server. The
<?php // Execute a shell script $dump = shell_exec('bigfile.sh'); // This script takes some
bash shell: ./mimic_cmd startDaemon() Corresponding Ant code: <exec failonerror=true executable=/bin/mimic_cmd> <arg value='startDaemon()' /> </exec>
imagemagick convert does not work through php shell_exec but does through a shell. In

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.