Reputation: 33
I have a program that should start my screensaver:
<?php
$cmd='automator /Users/myusername/Library/Services/Start_Screensaver.workflow';
shell_exec($cmd);
?>
When I run it with
php index.php
it works fine but when I try to run it from a browser I always get the following error in the apache error_log file:
The workflow file does not exist.
Which I find very weird since I do have the correct path starting from the root folder. Any help would be appreciated. Thank you!
Also, although I'm pretty sure apache is setup correctly on my mac I can only acces the web pages via the ip adres of my mac on my mac itself. So when I go to my Mac's IP on my phone for example it can't load the page, but when I go to my Raspberry Pi's IP address (which also runs apache) it works fine.
Edit: To be clear, the point of this is not to start the screensaver on my Mac but to start it remotely from my phone inside Tasker
Edit: I put the automator workflow file in the same directory and did
sudo chmod 777 start_screensaver.workflow
and now I'm getting the following errors:
2015-12-24 19:12:26.376 automator[2313:462937] Not loading action at /Library/Automator/Create Table from Data in Workbook.action: No bundleIdentifier.
2015-12-24 19:12:26.377 automator[2313:462937] Not loading action at /Library/Automator/Save Outlook Messages as Files.action: No bundleIdentifier.
2015-12-24 19:12:26.677 automator[2313:462937] CFPasteboardRef CFPasteboardCreate(CFAllocatorRef, CFStringRef) : failed to create global data
2015-12-24 19:12:26.678 automator[2313:462937] CFPasteboardRef CFPasteboardCreate(CFAllocatorRef, CFStringRef) : failed to create global data
2015-12-24 19:12:26.679 automator[2313:462937] CFPasteboardRef CFPasteboardCreate(CFAllocatorRef, CFStringRef) : failed to create global data
2015-12-24 19:12:26.680 automator[2313:462937] CFPasteboardRef CFPasteboardCreate(CFAllocatorRef, CFStringRef) : failed to create global data
2015-12-24 19:12:27.692 Automator Runner[2314:462973] Not loading action at /Library/Automator/Create Table from Data in Workbook.action: No bundleIdentifier.
2015-12-24 19:12:27.692 Automator Runner[2314:462973] Not loading action at /Library/Automator/Save Outlook Messages as Files.action: No bundleIdentifier.
2015-12-24 19:12:27.757 Automator Runner[2314:462973] Script Monitor is missing or damaged: Error Domain=NSCocoaErrorDomain Code=256 "The application “ScriptMonitor” could not be launched because a miscellaneous error occurred (OSStatus -10810)." UserInfo={NSURL=file:///System/Library/CoreServices/ScriptMonitor.app/, NSLocalizedDescription=The application “ScriptMonitor” could not be launched because a miscellaneous error occurred (OSStatus -10810)., NSUnderlyingError=0x7f80f3411190 {Error Domain=NSOSStatusErrorDomain Code=-10810 "kLSUnknownErr: Unexpected internal error"}}
2015-12-24 19:12:27.758 Automator Runner[2314:462973] Script Monitor is missing or damaged
2015-12-24 19:12:27.843 Automator Runner[2314:462973] CFPasteboardRef CFPasteboardCreate(CFAllocatorRef, CFStringRef) : failed to create global data
2015-12-24 19:12:27.844 Automator Runner[2314:462973] CFPasteboardRef CFPasteboardCreate(CFAllocatorRef, CFStringRef) : failed to create global data
2015-12-24 19:12:27.844 Automator Runner[2314:462973] CFPasteboardRef CFPasteboardCreate(CFAllocatorRef, CFStringRef) : failed to create global data
2015-12-24 19:12:27.846 Automator Runner[2314:462973] CFPasteboardRef CFPasteboardCreate(CFAllocatorRef, CFStringRef) : failed to create global data
2015-12-24 19:12:27.872 Automator Runner[2314:462980] warning: failed to get scripting definition from /System/Library/Frameworks/ScreenSaver.framework/Resources/ScreenSaverEngine.app; it may not be scriptable.
2015-12-24 19:12:27.966 Automator Runner[2314:462980] Scripting Bridge could not launch application /System/Library/Frameworks/ScreenSaver.framework/Resources/ScreenSaverEngine.app.
2015-12-24 19:12:27.997 Automator Runner[2314:462973] Error writing cache to /Library/WebServer/Library/Caches/com.apple.automator.actionCache-user-standardLocations.plist: The folder “com.apple.automator.actionCache-user-standardLocations.plist” doesn’t exist.
2015-12-24 19:12:30.830 Automator Runner[2314:462973] Error writing cache to /Library/WebServer/Library/Caches/com.apple.automator.actionCache-system-standardLocations.plist: The folder “com.apple.automator.actionCache-system-standardLocations.plist” doesn’t exist.
2015-12-24 19:12:31.148 Automator Runner[2314:462973] Error writing cache to /Library/WebServer/Library/Caches/com.apple.automator.actionCache-bundleLocations.plist: The folder “com.apple.automator.actionCache-bundleLocations.plist” doesn’t exist.
Upvotes: 2
Views: 404
Reputation: 4565
It looks like your Apache user does not have access to that directory. When you run php scripts from cli, you run them as myusername
, but, once you open it from browser, it's a different user (_www
).
So, you need to make sure that the file is accessible by the _www
user. Setting permissions to 777
for that file would probably do the thing.
P.S.: btw @Mike is absolutely right that you should rethink the way you're using your script.
The screensaver launches, that's cool. So, the issue is all about permissions. So, you can either try to run it with php built-in server
php -S localhost:8000 index.php
Or configure apache and change the apache user.
Alternatively, you can move all your screensaver-related stuff yo a publicly accessible dir, but, again, this may potentially cause some security flaws.
Upvotes: 1