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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T10:17:38+00:00 2026-06-15T10:17:38+00:00

I am running a Java program on a web server and passing it arguments

  • 0

I am running a Java program on a web server and passing it arguments that come from PHP variables, and I’m running into a bit of a confusing issue. A Java program I am using seems to exhibit different behavior when I run it from shell and run it from shell_exec() in with PHP.

If I use a tool like Putty to execute the program from command line like so:

ksh runexample.ksh ClassName methodName

It runs properly, meaning the program sends a request and after about 20 seconds receives a response from gateway servers it connects to. I am then able to see that the communication was successful by seeing the resulting record in an outside database.

Now the issue arises when I execute this program from a PHP script by using.

shell_exec('path/ssh user@xxx.xx.xxxx.xx.x "cd /path/path/examples/ ksh runexample.ksh ClassName methodName;')

If I load this PHP script, and var_dump() the output, the program seems to load; but it gives me a short generic message from the Java program like “program running in connected mode etc etc”, and doesn’t output the usual response. The PHP script loads a page almost instantly with this output. Also, no record is created in the outside database.

I have set_time_limit(0) in the script, but could this issue be due to shell_exec() somehow timing out before the request/response in the Java program is complete?

Thanks for any insight/similar experiences, I appreciate the 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-06-15T10:17:40+00:00Added an answer on June 15, 2026 at 10:17 am

    It could be down to the fact that there is no (or another) .profile file loaded when running the application the way you do.

    I’ve done something quite similar to what you seem to be be doing here, and ended up posting this question here, as a follow-up to this question both of which might be of use to you now.

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

Sidebar

Related Questions

I am running a Java program that connect 1000 clients to a server at
I now have a running Java program which only lacks of the final step,that
I'm running a java program that uses many vectors. I'm afraid my use of
I have a java program that is running in the background(Windows). I would like
I want to call Java from PHP 5.2, running either on a webserver or
When running a java program using the java command you can specify the verbose
I am having trouble running a Java program with Windows Powershell 2.0. Any help
Say suppose I am running a java program through command line. And this program
I am running Java 6 on a Linux machine (RHEL 5) and my program
I get the following error when running mongo-hadoop streaming: java.io.IOException: Cannot run program "mapper.py":

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.