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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:17:03+00:00 2026-05-25T16:17:03+00:00

I have a PHP script which calls exec() . I’ve been having trouble all

  • 0

I have a PHP script which calls exec(). I’ve been having trouble all day with some code calling the same script working and some not (exec() returns a 127 error code).

I have finally worked out that the code that is not working is the code that is being called from jQuery on my web page:

$('#next_button').click(function(event) {
    $.get('download_forms.php', function(data) {
        alert(data);
    });
});

However, if I type the url for download_forms.php into the address bar of my browser, then exec() will execute properly. I have tries to run other scripts that call exec() from jQuery to test and they all fail, but work if typed into the address bar.

I don’t see why this would be an issue. Whether I type the url into Firefox’s address bar, or whether pressing the button on my webpage, an HTTP request will be made.

Does anybody know what the difference could possibly be?

Note: I have tried different commands in exec() and they are all failing from my jQuery (note all the rest of the PHP code runs fine) but work when the script address is typed directly into the address bar.

Many thanks

Update

This is my download_forms.php code. The initial exec() was just to see if exec() worked at all. As above, it only executes properly if typed directly into the address bar.

include ('inc/session.inc.php');
require_once('Downloader.php');
exec('id', $output, $r);
echo var_dump($output);
echo($r);
try {
    $downloader = new Downloader();
    $saveMessages = $downloader->saveToDatabase();
    // exec() in the combineAndDownloadForms() method
    $downloadMessages = $downloader->combineAndDownloadForms();
} catch(Exception $e) {
    echo $e->getMessage();
}

Further Update

I made a hyperlink through from my webpage to the download_forms.php page (ie a <a>), but exec() still doesn’t execute. At least I know it’s nothing to do with ajax.

  • 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-25T16:17:03+00:00Added an answer on May 25, 2026 at 4:17 pm

    For what it’s worth, I fixed this issue and all of the above was a red herring.

    I hadn’t noticed that the page I was on was using the secure https protocol, so when the download_forms.php script was being used, it was also accessed using https and it seems that the exec() and passthru() functions won’t execute commands on the server in these circumstances, which makes sense.

    I changed the script so that it changed the protocol of the download_forms.php url to ordinary http and it’s now functioning fine.

    HTH

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

Sidebar

Related Questions

I have a php script written which calls an external command using exec which
I have a php script which accesses a MSSQL2005 database, reads some data from
I have a PHP script which calls another script in order to add IP
I have a PHP script which calls methods from a class I have written.
I have PHP script which takes some file (FLV for example) and returns it
I have a php script which can take some GET params. I would like
I have an upload system based on SWFUpload which calls PHP script. The problem
Hello I have a php code which by echo calls the javascript function expand(txt)
I have a script which calls a php file and gets the proper fields
I have a Javascript function which calls a PHP script on my server. 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.