Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by tylo · Jan 12, 2012 at 12:13 AM · php

Cannot Start Unity from PHP exec() method

I have a similar question here that I asked the other day, but thought I would post a second one for a more simple problem.

It seems I can get the PHP exec() method to open any Application on my Mac except for Unity (5 applications chosen at random of varying memory size all succeeded). It always crashes due to some mysterious exception that is posted to Apache's error_log. The details of the exception are never included. A return code of 6 is always fed back to PHP as well, but there's no way of knowing what return code 6 actually means.

If you are hosting a PHP server and are on a Mac, I invite you to please try and execute this PHP script on your server and to let me know if it works. If you are on a PC, you'll just need to change the path to Unity.

Note: If you receive "Error #-5000 while verifying your authorization. Unknown error." while attempting to run this script, I was able to "fix" that by changing User and Group inside of /private/etc/apache2/httpd.conf to my username/group (instead of the default _www).

 <?php
 $retval = -1;
 $output = null;
 
 $program = "/Applications/Unity/Unity.app/Contents/MacOS/Unity";
 
 exec($program, $output, $retval);
 
 echo "<pre>".var_export($output, TRUE) . "</pre>";
 
 echo "Return Value: $retval";
 
 die;
 ?>


Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by tylo · Jan 16, 2012 at 06:09 AM

Incase anyone else runs into this problem, I was able to open Unity by changing line 5 to:

 $program = "sudo -u yourUserName /Applications/Unity/Unity.app/Contents/MacOS/Unity";

where "yourUserName" is your preferred Unix user you'd like to open it with.

For some reason I couldn't pass a password through PHP using echo PASS | sudo -u yourUserName -S despite people reporting that it would work.

This means you have to go into your sudoers file and change it so _www (or whatever user you use to run Apache) can use sudo commands without a needing to type a password.

I don't really LIKE this solution, but it works on my development machine. I'll post a more production friendly solution if I find it.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

A node in a childnode? 1 Answer

Why the Value of form.AddField won't accept string 1 Answer

Put user list in 2d array 1 Answer

Unity php functions 1 Answer

Android and PHP high scores 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges