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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T18:10:25+00:00 2026-05-31T18:10:25+00:00

I have a Symfony task that generates some files calls exec to a jar

  • 0

I have a Symfony task that generates some files calls exec to a jar and then parses the output. The jar runs fine from the command line, the task runs fine from the command line.

The problem:

I call the task in an action based on a form submission. I have the action start a new php process in the background to run the task regardless of what the page the spawned it does now.

When it gets to the java call, say exec(java -version); it outputs this:

Error occurred during initialization of VM
Unable to load native library: libjava.jnilib

I feel like it has to do with the way I call php when I start the task but I’m lost as to why it wouldn’t have the same libraries as when I use the command line.

How can I make java run from the ‘background’ Symfony task?

Notes:

It used to work with no hitch until I upraded mamp from 1.9.6 to 2.0.3.

I’ve looked at:
Broken Java Mac 10.6
but since I can run it fine from the command line it seems to be a different issue.

I’ve also looked at Execute symfony task command from the shell_exec() permission denied but I don’t think permissions are the issue here.

Update:

I’ve narrowed down the problem to MAMP and getting to php from the browser.

<?php
echo exec("java -version")
...

Will work when called from the command line but not when the php file is opened through the browser. So the way MAMP is configured is causing the issue.

Here’s the environment info:

  • Variable Value
  • SHELL /bin/bash
  • TMPDIR /var/folders/YH/YH+uW3hDHZyxQ5AiUtr0T++++TI/-Tmp-/
  • Apple_PubSub_Socket_Render /tmp/launch-3rr9ZI/Render
  • USER myuser
  • COMMAND_MODE unix2003
  • SSH_AUTH_SOCK /tmp/launch-zinaMI/Listeners
  • __CF_USER_TEXT_ENCODING 0x1F5:0:0
  • PATH /usr/bin:/bin:/usr/sbin:/sbin
  • PWD /
  • HOME /Users/myuser
  • SHLVL 2
  • DYLD_LIBRARY_PATH /Applications/MAMP/Library/lib:
  • LOGNAME myuser
  • DISPLAY /tmp/launch-FYrw70/org.x:0
  • _ /Applications/MAMP/Library/bin/httpd

Dyld seems to be present in here. I need to find a way to unset it from mamp’s environment.

Solved

I’ve figured out a solution. It seems like a hack but it worked. I’ll post it here just incase anyone else runs into the same problem.

As Broken Java Mac 10.6 mentions the DYLD_LIBRARY_PATH must be unset. Not sure why, it seems to be needed on Unix systems but not MacOSX.

If MAMP sets to /Applications/MAMP/Library/lib here’s how to disable it:
Edit /Applications/MAMP/Library/bin/envvars and comment out the following lines

DYLD_LIBRARY_PATH="/Applications/MAMP/Library/lib:$DYLD_LIBRARY_PATH"
export DYLD_LIBRARY_PATH

So that it looks like this:

#DYLD_LIBRARY_PATH="/Applications/MAMP/Library/lib:$DYLD_LIBRARY_PATH"
#export DYLD_LIBRARY_PATH

This should fix the problem and java 1.6 can run fine.

Is this a hack? or is this a bug in MAMP? Please answer if you know a better way to solve this issue.

  • 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-31T18:10:26+00:00Added an answer on May 31, 2026 at 6:10 pm

    This is the solution of @paaat added. Im just posting to get this question out of the unanswered list.

    I’ve figured out a solution. It seems like a hack but it worked. I’ll
    post it here just incase anyone else runs into the same problem.

    As Broken Java Mac 10.6 mentions the DYLD_LIBRARY_PATH must be unset.
    Not sure why, it seems to be needed on Unix systems but not MacOSX.

    If MAMP sets to /Applications/MAMP/Library/lib here’s how to disable
    it: Edit /Applications/MAMP/Library/bin/envvars and comment out the
    following lines

    DYLD_LIBRARY_PATH="/Applications/MAMP/Library/lib:$DYLD_LIBRARY_PATH"
    export DYLD_LIBRARY_PATH
    

    So that it looks like this:

    #DYLD_LIBRARY_PATH="/Applications/MAMP/Library/lib:$DYLD_LIBRARY_PATH"
    #export DYLD_LIBRARY_PATH
    

    This should fix the problem and java 1.6 can run fine.

    Be sure to restart your installation of MAMP for the changes to take effect.

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

Sidebar

Related Questions

I have created a task in Symfony 1.4 that loads in some CSV files
On a current project which I'm currently working, i have a symfony task that
We have FireSymfony that allows one to view the Symfony, PHP variables in a
I have an application that I'm converting to Symfony/Doctrine. It currently stores a serialized
I have a Symfony app that populates the widgets of a portal application and
Normally, we can have the Symfony Form to output the field errors using the
I have a Symfony 1.4 project that I am unable to successsfuly run the
I have set up some custom symfony project-level settings in the file config/project.yml following
I have a symfony admin generator page where each row makes several function calls
I have a symfony app that uses the json_encode and json_decode to keep a

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.