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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T21:24:46+00:00 2026-05-16T21:24:46+00:00

i am using PHP to run exec() on a script which looks like this:

  • 0

i am using PHP to run exec() on a script which looks like this:

exec("pdftk xx.pdf fill_form xx.fdf output xx.pdf flatten");

the strangest thing is that when i log in to ssh and put the command in manually – it works fine! it outputs a 224k pdf. but when i use the exec() command, only the first 36k of the script comes out. (i checked – the first 36k of the good file is identical to the bad file)

no heres the strange thing – this was working fine with exec() until i added some more variables to the fdf file, making it longer. i thought it was a problem with the fdf because of the new data – but why would this process run fine from ssh?

update: also I tried running php -f test.php (which just had the one exec line in it). that output the entire file properly. but even if i go to http://mydomain.com/test.php i only get a part of the file.

the script is not timing out, because i make it echo something after the exec() command and it works fine.

it can’t be a permission issue (ssh logs in as root) because it is still able to write the file

also – when i try getting a return or exit value from exec or passthru, i get nothing. the return value is always 0.

update: in the apache error logs, I am getting

[Fri Sep 17 20:00:57 2010] [error] Unhandled Java Exception:
[Fri Sep 17 20:00:57 2010] [error] java.lang.OutOfMemoryError
[Fri Sep 17 20:00:57 2010] [error] <>

i changed the php_ini from 32M to 64M – still get it. considering these are all tiny files, i dont think that’s it. but would PHP be able to limit the memory of a child process like that? is there another setting for that somewhere?

help!

  • 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-16T21:24:47+00:00Added an answer on May 16, 2026 at 9:24 pm

    It turns out this was a memory issue afterall. Apache had RLimitMEM set in the main conf file, which i just disabled for now. Now it works like a charm. Although it was set to about 89MB and since these files are under a meg I can’t see how this app would be using that much memory.

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

Sidebar

Related Questions

I'm using exec to run a background script like this : $command = /usr/local/bin/php
Can I run a PHP CGI script as a background process using exec() ?
Is it possible to run hip-hop php in cygwin which is using more script
I am using exec function in a php script, if I run the script
I am trying to run a mysql insert query using php exec with parameters.
how to insert inner array in mongodb using php I run this command in
i wanna using curl in php script and run it in command line mode.
I would like to run a PHP script from another PHP script so that
I'm trying to run a pull request from git using PHP's exec on windows
Using PHP on Linux, I'd like to determine whether a shell command run using

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.