-
Notifications
You must be signed in to change notification settings - Fork 642
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[4.x]: Installing plugins via CP fails #13681
Comments
Just tested installing CKEditor from the CP using MAMP Pro 6.8.1 and it’s working on both Craft 3.9.1 and 4.5.3. Can you share your |
Hi Brandon, thanks so much for taking a look. Strange! Sure, here they are. It's literally a clean install created using And here they are after the error occurs if that's useful. You can see The last entry in web.log is the request to |
I've solved part of the mystery after noticing the
with
as per https://stackoverflow.com/questions/76079982/how-to-stop-30s-timeouts-in-mamp The PHP's I don't know if this is relevant, but all web requests on the site stop responding after the install attempt, and as soon as I stop the servers in MAMP, the composer.json file reverts to its state as before the update was attempted (i.e. |
I've just found that this issue also applies to updating the CMS via the control panel. I guess any composer operation via the CP is getting stuck on "Updating Composer dependencies". I've narrowed down the Craft update where this issue began to occur on my environment. On a fresh Craft 4.4.17 install, tested just now, I can still install plugins via the CP, and update Craft via the CP too. On a fresh Craft 4.5.0 install, the issue occurs. Perhaps this is somehow related to switching to the bundled I realise you can't replicate this on your environment... so please let me know if there's anything I can check on for you – file permissions etc? Clutching at straws here, but in MAMP Pro under 'Ports & User' I am running the servers as my own username rather than |
Do Composer operations take longer than 30 seconds on 4.4.17 for you? In general they’re always taking under 10 seconds on my end, which is probably why I’m not affected by the 30 second default timeout. |
No, they’d typically only take the usual 5-10 seconds. 4.4.17 updated to the latest version via the CP in about 10 seconds. |
@realjoshharrison Can you put a
Then load yoursite.com/phpinfo.php in a browser and share the results here as a large image/PDF/etc. |
I am not entirely sure if this is related, but I just received the same "undefined" response when updating plugins in the CP using MAMP Pro. Looking at the logs, it appeared to be a "memory" issue -
I've since updated my PHP memory. I will advise if it happens again. |
Thanks @angrybrad – here's a phpinfo. And this log file shows everything from when I click MAMP's PHP has 512MB memory, so I'm not sure that would be the issue in my case... |
@realjoshharrison huh... nothing really jumping out at me in either of those. Can you try a few things to see if the behavior changes?
|
Good ideas... module mode (still with PHP 8.2) worked! 😀 I was able to install a plugin, and update Craft, via the CP. Based on this I've found a local fix that works on CGI mode. I see that Without setting anything in .env, I just tried setting If I set Not sure if there's a better solution, but I'm happy to set |
After updating to craft 4.5 I cannot update any other plugin from CP:
Before the update everything worked and I can ssh into the machine and run composer update manually without any issues. |
By setting MAMP to “module” mode, I think you’re effectively bypassing @stanislavprokopov basically the same issue, except your fix would be to set a PHP_BINARY env var to |
Thanks for the explanation @angrybrad, that makes sense. So it sounds like any environments using the I’m ok to continue with that myself, but I wonder if it would be worth documenting somewhere, or perhaps checking in the CMS whether |
Setting PHP_BINARY as proposed by @angrybrad resolved my issue, thx. |
We’ve made a couple changes for the next Craft 3 and 4 releases, which should help:
|
@brandonkelly, Tommy pointed to this thread and asked if i could add PHP_BINARY. I've got the same problem
Error (running on Plesk)
So basically the CraftCMS UI hasn't got a clue where to find the php command anymore after > 4.5.X I hope it can be fixed in the next release. I can update with CLI, that's is not a problem. |
It’s more that, Craft < 3.9/4.5 didn’t need to know the path to the appropriate Unfortunately, that’s not how Composer was designed to work, and Composer 2.3+ made it technically impossible to continue using it that way. So we could either continue shipping an old, unmaintained copy of Composer with Craft, with an increasing number of security holes and incompatibilities (#13396, #13441), or switch to bundling a This issue aside, option 2 is a clear improvement, so we aren’t going to be rolling it back. We’ll just have to keep working to improve support for different environments/configs. |
Thanks and clear
/////////////////// ... does work. I don't know if that's a good fix / workaround. |
@eugenebroeren I think that workaround is fine. It's basically saying that the web version of PHP ( The slightly inconvenient part is if you upgrade this site to PHP 8.2 in the future, you'll need to remember to update that path. I'm pretty sure that |
Craft 3.9.4 and 4.5.6 are out with those improvements. This should solve Composer operations for MAMP on CGI mode. No |
Looks like a great solution and should work on my MAMP environment. Not sure off the top of my head whether MAMP sets |
We tested it in MAMP + CGI and confirmed it works :) |
I tried 4.5.6 and in my case (Plesk env) i still getting "cant find php" (installing a package and perhaps updating packages in craft ui)
So for now my solution is this : or always update / install via CLI (that did not break) |
Yeah if the command was using |
Ah, I see what goes wrong due to PhpExecutableFinder (in my case), so i'll stick to adding php in openbase php : The problem is if (!is_executable($php)) { You can set PHP_BINARY="/opt/plesk/php/8.1/bin/php" in .env (or PHP_PATH) ############
..... |
If I'm following you, and |
Correct, but the strange thing is that when you just return $PHP_BINARY (/opt/plesk/php/8.1/bin/php) or return "/opt/plesk/php/8.1/bin/php" in the first line of of PhpExecutableFinder everything is fine and no need for adding /opt/plesk/php/8.1/bin/php in php settings openbasedir. Best option in my case would be if $PHP_BINARY (or another var $PHP_DIRECT_PATH for example) is set in .env then simply return it en do not launch PhpExecutableFinder. I don't know of more people running into this. |
What happened?
Description
Installing plugins via the CP's plugin store is failing with the following error:
Steps to reproduce
Expected behavior
The plugin installs as usual.
Actual behavior
The above error message is shown, the attempted plugin is added to
composer.json
's require list, but the files are not present invendor
. On the above error message page, the dev console shows:After this occurs, all requests fail to load with 500 Internal Server Error pages (in both CP and front end) until I restart the server.
I can't see any errors in craft's logs, Apache logs, or PHP logs... the last entry in Craft's web.log is a seemingly successful web.INFO request for
admin/actions/pluginstore/install/precheck
.Initially this seemed like it might be something to do with my server setup, but the odd thing is I hadn't changed anything when I first experienced this error today. I since updated my system composer and MAMP Pro to the latest versions, but still get the same errors.
Everything I'd think was relevant checks out in the System Report's requirements list. The only warnings are mysql timezone support,
@web
is not explicitly overwritten, and no OPcache.The same operations work fine when using e.g.
composer require craftcms/ckeditor -w && php craft plugin/install ckeditor
directly on the command line. It's only via the CP where this occurs.Thanks for your help with this. Please let me know if I can provide any specific files.
Craft CMS version
4.5.3
PHP version
8.2.0
Operating system and version
MAMP Pro 6.8.1, Darwin 22.6.0 (MacOS 13.5.1)
Database type and version
MySQL 5.7.39
Image driver and version
Imagick 3.7.0 (ImageMagick 6.9.6-2)
Installed plugins and versions
The text was updated successfully, but these errors were encountered: