Closed gareth-prevalent closed 8 months ago
I just tried the latest version (2.0.1, although I notice it calls itself 1.8.1 in the output files ... I'll fix that). I tried it with Sequel Ace (Version 3.4.4, Build 20021) and Sequel Pro Nightly build (Build 5446 (97c1b857)). In both cases, the files were generated just fine.
This is on macOS Catalina (10.15.7). I know I had a similar issue when I started testing the plugin with Sequel Ace, and it required setting Full Disk Access in System Preferences > Security & Privacy > Privacy. I wonder if that needs to be reset in macOS Monterey?
At this point, I assume it's all related to the security of the macOS (System Integrity Protection). I've already tried granting full disk access to SequalAce to no avail. I added some stderr
output redirection to a log file, side-by-side the empty exported migration files, and I get the same error each time:
67 | # Capture all error output to log file
68 | exec 2>> "$DESTDIR/error.log"
69 |
parse.sh: line 190: /usr/local/bin/php: Operation not permitted
I was able to run the PHP script from a terminal (non-root user), after the *.tsv
files were created, and manually scrape the files for the migration code; Painful process to workaround this issue though.
I don't understand why the bash scripts can run without incident but the PHP ones are blocked by security. Perhaps there is some obscure context in which the module's script is executed that is causing it to get trapped by security...?
What do you get when you type /usr/bin/php -v
on your command line? I just realized that Apple announce they are unbundling PHP from future versions of macOS. And I think that kicked in with Monterey. So, at the least, this plugin won't work anymore unless I rewrite it in another language, or make installing PHP (via brew, etc.) a requirement, and then change the path as you did.
Running /usr/bin/php
just comes back with a -bash: /usr/bin/php: No such file or directory
message. It was the same error I was seeing with the script too until I changed it to /usr/local/bin/php
:
PHP 8.1.0 (cli) (built: Nov 28 2021 01:44:44) (NTS) Copyright (c) The PHP Group Zend Engine v4.1.0, Copyright (c) Zend Technologies with Xdebug v3.1.2, Copyright (c) 2002-2021, by Derick Rethans with Zend OPcache v8.1.0, Copyright (c), by Zend Technologies
Not only did Apple remove PHP from that location (symlink or otherwise) but they prevented all interaction with that folder, even if you have root access. You have to disable SIP and reboot the mac to restore functionality to that folder - something I don't want to do.
Exactly. So, unless I rewrite the PHP code into something else (natively supported in Monterey ... maybe python or node), then my bundle will have the requirement of needing PHP installed via some other method and I will need to change the path to PHP in my scripts.
Out of curiosity, does /usr/bin/env php -v
return your Brew installed version?
Yes, running /usr/bin/env php -v
does return my brew installed version - v7.4.26
While it seems that PHP is now an optional install for the macOS, even with my installed instance it fails to run because of the enhanced security measures. I'm not sure if a script can even be called from within another script anymore.
On another note, I did try adding the SequalAce application to the developers tools list in the Security & Privacy settings (no help though):
I've just tried this today on Monterey.
With Sequel Pro (latest nightly build) - it produces empty php files.
With Sequel Ace (latest) - it doesn't seem to export any files at all.
Any solutions? The same empty files on Mac M1.
Any solutions? The same empty files on Mac M1.
+1
Any solutions? The same empty files on macos 14 on Mac M2.
yes the solution is on Mac M1. open the parse.sh file an add exec 2>> "$DESTDIR/error.log" on line 68 an build it then the error.log is in the output dir.
My error is there is no php on /usr/bin/php ..... open Terminal php -v you need an php 7.x - if there is none install it. Terminal "which php" give the path. replace the path /usr/bin/php in parse.sh line 185 and 214 build it an it works
Did not work.
I installed version 7.4, built it and nothing.
Error that appears: parse.sh: line 185: /usr/local/bin/php: Operation not permitted
Macos: Sonoma 14.3.1 (23D60)
I converted the code php (parse.php and MigrationParser.php) to javascript using Gemini to see if it worked, but it doesn't work either.
Error: /Users/pedrosa/.nvm/versions/node/v20.11.0/bin/node: Operation not permitted
@pedrosalpr Error that appears: parse.sh: line 185: /usr/local/bin/php: Operation not permitted That means php not found, what shows php -v which php in the terminal? Copy the path from "which php" an replace /usr/local/bin/php in parse.sh line 185 and 214
@k-adam-e
I use PHP Monitor to have PHP versions. I have versions 7.4 and 8.3.
The location of php is /usr/local/bin/php
.
And it gave the same error: parse.sh: line 185: /usr/local/bin/php: Operation not permitted
For what it's worth, both ChatGPT and Gemini did a remarkably useful attempt at converting a table schema into a Laravel migration file. I just copied the sql from Sequel Ace's "Table Info" tab > "Create syntax", and asked the AI this:
"Please convert this sql into a laravel migration file, using the newer anonymous class syntax: ```pasted sql here```".
@pedrosalpr
/usr/local/bin/php: Operation not permitted
This may mean that the rights to php do not match (user / root?)
or that it is not found correctly in the script
Check the export PATH in ~/.bash_profile
vim ~/.bash_profile
I have different php version installations ,
As example for php7.4.33 i have an ~/.bash_profile7_4 with this
vim ~/.bash_profile7_4
export PATH="/usr/local/bin/php7.4/bin:${PATH}"
alias php='/usr/local/bin/php7.4/bin/php -c "/usr/local/bin/php7.4.ini"'
alias php-config='/usr/local/bin/php7.4/bin/php-config'
alias phpdbg='/usr/local/bin/php7.4/bin/phpdbg'
alias phpize='/usr/local/bin/php7.4/bin/phpize'
alias pear='/usr/local/bin/php7.4/bin/pear'
alias peardev='/usr/local/bin/php7.4/bin/peardev'
alias pecl='/usr/local/bin/php7.4/bin/pecl'
I activate it with source ~/. bash_profile7_4
As mentioned above, this tool will not work on newer versions of Mac OS that don't have PHP installed. Apple stopped bundling PHP in their OS, so you will either need to install it via brew, MacPorts, or some other method.
Until I get time to re-write this tool to use something other than PHP to do the parsing and migration generation -- or until someone makes a PR with this rewrite! -- the tool probably won't work out-of-the-box.
There appears to be an issue with the latest version of the plugin (2.0.1). I've tried running it using the latest versions of both SequalPro (v1.1.2) and SequalAce (v3.4.4), with SequalAce being the preferred app.
The tool behaves as before where it creates the PHP files in the SequalProLaravelExport folder, named as expected, however the files have "Zero bytes" as indicated in the finder view on my Mac.
I am running Mac version 12.0.1 which prevents installing PHP symlink to the location:
/usr/bin/php
I've tweaked the source code and change the location of PHP from
/usr/bin/php
to/usr/local/bin/php
to conform with the newer security standards for Mac OSX but that didn't resolve the issue.I've also tried different version of PHP including 7.4.26 (current) and the latest 8.1.0 (temporarily installed) but neither had an affect on the outcome.
As you can see from the file list below, I've successfully used this plugin in the past but something has changed since...