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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T06:17:19+00:00 2026-06-13T06:17:19+00:00

I am creating a simple web page that will allow the user to select

  • 0

I am creating a simple web page that will allow the user to select an option on a basic php page, click submit, and then the backend PHP should execute a bash script, that will execute some AppleScript.

I can run the bash script from Terminal and it runs the Applescript file fine using osascript but when I try executing the bash script from php, it will run echo commands, but will not execute the osascript line. I imagine this is a permissions issue, but I changed everything to full privilege using chmod 777 (admittedly not the best idea, but that is besides the point)

Is there something I am missing? It is weird that it seems to skip completely over the osascript line. Any suggestions? Thanks in advance!

CODE:

PHP

<?php
if (isset($_POST['submit'])) {
    $username =  $_POST['username'];
    if (strcasecmp($username, 'user1') == 0) {
        echo 'test1';
    } else if (strcasecmp($username, 'user2') == 0) {
        echo 'test2';
    } else if (strcasecmp($username, 'user3') == 0) {
        echo 'test3';
    } else if (strcasecmp($username, 'user4') == 0) {
        shell_exec('cd ~/Sites;./a.out');
    }
}
?>

BASH

#!/bin/bash
echo "test String"
cd /Users/Zimmerman/Library/Scripts
osascript /Users/Zimmerman/Library/Scripts/testscript.scpt
echo "test String"
  • 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-13T06:17:21+00:00Added an answer on June 13, 2026 at 6:17 am

    Your apache $PATH variable is probably not looking within /usr/bin/. If you echo shell_exec('which osascript'); within a PHP file, you might not see anything, but you will see results on terminal.

    You can add paths to your webservers $PATH variable or you could perhaps try using the full path to the executable /usr/bin/osascript on your scripts.

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

Sidebar

Related Questions

I am interested in creating a simple web application that will take in user
Greetings! I'm creating a web form prototype (ImageLaoder.aspx) that will return an image so
I'm writing a simple web page that displays a table. It the right column
I'm creating a very simple chat application. It has an ASP.NET web page as
I am creating a simple function that warns the user when they are about
I've created a web page that lets you input some information and then draws
I am creating a simple web app. There is a <video> element on the
I'm following this example for creating a simple Web application using JAX-RS, MongoDB and
I am creating a very simple web service and I don't want to bother
I'm creating a simple pastebin web application on top of Symfony2, but I can't

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.