Skip to content
This repository has been archived by the owner on Aug 31, 2019. It is now read-only.

Cannot install, disable, or uninstall extension #15

Closed
finferflu opened this issue Oct 29, 2014 · 23 comments
Closed

Cannot install, disable, or uninstall extension #15

finferflu opened this issue Oct 29, 2014 · 23 comments

Comments

@finferflu
Copy link

Hello,

When I try to enable/install or disable this extension I get the following error on the top of the page:

fwrite() expects parameter 1 to be resource, boolean given

Nothing shows up in the PHP error log.

If I try to actually uninstall it (after the above error the extension name turns black, as if it was installed, however there are no Mailchimp options in the Symphony Preferences page), I get a blank page and this shows up in the PHP error log:

PHP Fatal error:  Call to undefined method Configuration::saveConfig() in /path/to/symphony/install/www/extensions/mailchimp/extension.driver.php on line 9

Could you please help me out?

Thank you :)

@finferflu finferflu changed the title Cannot install extension Cannot install, disable, or uninstall extension Oct 29, 2014
@nitriques
Copy link
Collaborator

Which version of Symphony ? Which version of PHP ?

@finferflu
Copy link
Author

Sorry, I forgot to include these important details:

Symphony version: 2.3.1
PHP version: 5.6.2 and 5.3.29 (I tried both of these through MAMP).

@nitriques
Copy link
Collaborator

Symphony 2.3.1 won't work with 5.6.x (so use 5.3.29 instead)

saveConfig has been renamed to write A LONG TIME AGO and it looks like nobody ever uninstall this extension. (a fix is on its way...)

Finally, AFAICT, the only fwrite call in Symphony is this one: https://github.com/symphonycms/symphony-2/blob/2.3.1/symphony/lib/toolkit/class.general.php#L837

How can $handle be boolean blows my mind...

Maybe try to replace it with

if (!($handle = fopen($file, $mode))) {

?

@nitriques
Copy link
Collaborator

2.1.1 is out with the saveConfig fix...

@finferflu
Copy link
Author

@nitriques Thanks for the suggestion and for the fix :) I'll let you know what happens.

@nitriques
Copy link
Collaborator

@finferflu my pleasure 😄

@finferflu
Copy link
Author

I just tried by modifying line 837 in symphony/lib/toolkit/class.general.php as you suggested, however I still get that fwrite error, now I even get it when I try to uninstall the extension. Additionally, I'm seeing a few of these errors in the PHP log (I'm using version 5.3.29 now as you suggested):

PHP Catchable fatal error:  Argument 1 passed to Configuration::setArray() must be an array, null given, called in /path/to/symphony/install/www/symphony/lib/core/class.symphony.php on line 171 and defined in /path/to/symphony/install//www/symphony/lib/core/class.configuration.php on line 81

Additionally, I have tried to remove the mailchimp folder from the extensions folder, and now Symphony is just blank, showing the above error whenever I try to load the page. I have reverted the changes in class.general.php and I have put the mailchimp folder back into the extensions folder, but Symphony is still just blank.

@nitriques
Copy link
Collaborator

To make the Symphony install work again, go in the DB, the table sym_extensions and delete the row holding the mailchimp extension.

As for your fwrite error, I am speechless since I can't reproduce it...

@nitriques
Copy link
Collaborator

Also, can you confirm that the file is writeable ?

@finferflu
Copy link
Author

Actually, the problem was that the Symphony configuration file was completely blank, something must have emptied it as I tried to uninstall the mailchimp extension. Fortunately I had a backup, and after I restored it Symphony is working again.

Back to the original issue, the strange thing is that I can see that the extension is enabled in the database, however nothing is really showing up in the Preferences page…

@finferflu
Copy link
Author

Which file should be writable (I assume by the web server)?

Thanks! :)

@nitriques
Copy link
Collaborator

manifest/config.php and yes by the user running the php process (which can be different from the user running apache)

@finferflu
Copy link
Author

Yes, it is. PHP is running as an Apache module, and the Apache process is owned by my user.

@nitriques
Copy link
Collaborator

And you're back with the fwrite error ?

Can you try to delete the row in the extension table and install from scratch ?

@finferflu
Copy link
Author

Yes, I'm back to that error. I have tried removing that row from the database and I have installed from scratch both with the original line in class.general.php and the modified line you suggested. Nothing seems to help so far :(

@nitriques
Copy link
Collaborator

:(

Let me recapitulate:

  1. The extension is not enable nor installed
  2. You try to install it.
  3. You get the error message about fwrite
  4. Extensions is somehow installed (?)
  5. Config values are NOT saved in config.php ?

If that 100% correct, can you please try to change the same line to

if (($handle = fopen($file, $mode)) === false) {

Also, could you try to var_dump the parameter ? (just before the fopen if)

var_dump($file, $data, $perm, $mode);die;

@finferflu
Copy link
Author

That is 100% correct although I'm not sure about what the extension should do in the background as it is being installed (from what you say I suppose it should write something to config.php), all I know is that I can't find any Mailchimp options in the Symphony Preferences page.

Anyway, I've edited line 837 in class.general.php just as you instructed, and I got the same fwrite issue. I then tried to var_dump those variables just above line 837 as you told me, but no variables are displayed on the screen when I try to enable/disable the extension, just the usual fwrite error again.

@finferflu
Copy link
Author

OK, what you said about the extension writing to config.php just opened my eyes. I double checked the permissions, and while config.php itself was writable by the web server, its containing folder wasn't. I have updated the permissions and the extension is finally enabled! :)

On a side note, uninstalling the extension now doesn't empty the config.php file any longer.

Thanks a lot for your help, and sorry for taking so long for figuring out this simple permissions issue (I don't know too much about the internals of Symphony unfortunately).

@finferflu
Copy link
Author

I just wanted to mention that when I tried to open the Events page, Symphony threw and error and I found that the file mailchimp/lib/mailchimp-api/MailChimp.php isn't included in the extension. I went ahead and downloaded it from the official repo and everything seems to work now. So it might be a good idea to have that file included with the extension.

@finferflu
Copy link
Author

Also, the extension version shown in the Mailchimp event is outdated: "2.0 released on 16 November 2013".

(I hope I'm paying back all the time you've wasted for me by finding these :)

@nitriques
Copy link
Collaborator

Thanks a lot for your help, and sorry for taking so long for figuring out this simple permissions issue

No problem! Glad you found out the problem. But it is still weird since there is a check about both the directory and the file (https://github.com/symphonycms/symphony-2/blob/2.3.1/symphony/lib/toolkit/class.general.php#L829).. I might log and issue in the core...

So it might be a good idea to have that file included with the extension.

It is, but as a git submodule, so you need to git submodule init && git submodule update when you check it out.

*EDIT: * just went to check the .zip download and it's missing. DAMN. Thanks for reporting!

@nitriques
Copy link
Collaborator

Finally, there was a bug in the write function in Symphony 2.3 (that's where the fwrite error comes from) and it has been fixed. Pffffeeewww!!

@finferflu
Copy link
Author

Oh I see, thanks for the heads up! :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants