meganz / MEGAcmd

Command Line Interactive and Scriptable Application to access MEGA
Other
1.89k stars 406 forks source link

Run from PHP from Apache Webhook #945

Open jamesn81 opened 4 months ago

jamesn81 commented 4 months ago

Can the MegaCMD commands (mega-mkdir, mega-ls etc etc) be run from inside a PHP script that gets triggered by a webhook?

Or is there some issue with environments that won't let it happen?

The program works flawlessly and all commands work until it gets executed from within a php file and I get this in the Apache error log (note the the server is in fact running and the user running the command is the user logged in to Mega):

[Initiating MEGAcmd server in background. Log: /var/lib/usbmux/.megaCmd/megacmdserver.log] Another instance of MEGAcmd Server is running. Execute with --skip-lock-check to force running (NOT RECOMMENDED) Unable to connect to service: error=2 Please ensure mega-cmd-server is running Failed to create socket for registering for state changes [Initiating MEGAcmd server in background. Log: /var/lib/usbmux/.megaCmd/megacmdserver.log] Another instance of MEGAcmd Server is running. Execute with --skip-lock-check to force running (NOT RECOMMENDED) Unable to connect to service: error=2 Please ensure mega-cmd-server is running Failed to create socket for registering for state changes