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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T13:40:22+00:00 2026-06-10T13:40:22+00:00

The exec command doesn’t work on my server, it does not do anything, I’ve

  • 0

The exec command doesn’t work on my server, it does not do anything, I’ve had safe_mode off, and verified that all the console commands are working, I’ve tried with absolute paths. I’ve checked the permissions on the applications and all the applications I need have execution permissions. I don’t know what else to do, here are the rundown of the codes I’ve tried.

echo exec('/usr/bin/whoami');

echo exec('whoami');

exec('whoami 2>&1',$output,$return_val);
if($return_val !== 0) {
    echo 'Error<br>';
    print_r($output);   
}

exec('/usr/bin/whoami 2>&1',$output,$return_val);
if($return_val !== 0) {
    echo 'Error<br>';
    print_r($output);   
}

The last two codes display:

Error
Array ( )

I’ve contacted the server service and they can’t help me, they don’t know why the exec command isn’t working.

  • 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-10T13:40:24+00:00Added an answer on June 10, 2026 at 1:40 pm

    have a look at /etc/php.ini , there under:

    ; This directive allows you to disable certain functions for security reasons.
    ; It receives a comma-delimited list of function names. This directive is
    ; *NOT* affected by whether Safe Mode is turned On or Off.
    ; http://www.php.net/manual/en/ini.sect.safe-mode.php#ini.disable-functions
    disable_functions =
    

    make sure that exec is not listed like this:

    disable_functions=exec
    

    If so, remove it and restart the apache.

    For easy debugging I usually like to execute the php file manually (Can request more errors without setting it in the main ini). to do so add the header:

    #!/usr/bin/php
    ini_set("display_errors", 1);
    ini_set("track_errors", 1);
    ini_set("html_errors", 1);
    error_reporting(E_ALL);
    

    to the beginning of the file, give it permissions using chmod +x myscript.php and execute it ./myscript.php. It’s very heedful especially on a busy server that write a lot to the log file.

    EDIT

    Sounds like a permissions issue. Create a bash script that does something simple as echo "helo world" and try to run it. Make sure you have permissions for the file and for the folder containing the file. you chould just do chmod 755 just for testing.

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

Sidebar

Related Questions

I have a working exec(java $file) command in php, but the problem is that
I have a PHP script involving exec() that will run fine from the command
When I have this PHP script. <?php exec('/usr/local/bin/mate hello.txt'); ?> It doesn't work on
I'm using the exec command to call R , but I don't understand how
Related: see here I've got this command: exec((wget -O http://domain/file.zip && mysql -u user
I wish to use the method with the following signature: exec(String command, String[] envp,
Let's say I have: $files = [file1, file2] exec { exec1 : command =>
I use exec() to execute command, either linux or windows. How do you execute
The command tries to sum up the sizes: find . -iname *.dmg -exec du
How can I implement chmod command on file by using exec? I would appreciate

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.