Help installing Fishpig Extension

Hi,
I used to used the Fishpig extension for M1.
I just tried to install it for my M2 but something is not working.

I tried to follow the fishpig instruction.
At first, I run the following command in the magento root directory

curl -sS https://wordpress.org/latest.tar.gz | tar xzf - && mv -f wordpress wp

Then, I create a separate database for WordPress. The post can be useful.

Next, I created wp-config.php file re-plicating wp-config-sample.php file within /var/www/html/wp directory filling the following: DB_NAME, DB_USER, DB_PASSWORD

Next, installed WordPress navigating to 127.0.0.1/wp (I’m testing it on my local machine)

Finally, I installed the FishPig module via the composer.

composer require fishpig/magento2-wordpress-integration:*

Enabled the module in Magento 2

bin/magento module:enable FishPig_WordPress

Run the Magento upgrade system

bin/magento setup:upgrad

And something is not correct. I get the following warning message in the Magento admin panel.

In theory, the message is self-explanatory instructing to copy contents of app/code/FishPig/WordPress/wptheme to wp-content/themes/FishPig, however, I haven’t got app/code/FhisPig…

I think it is something to do with my file permissions. Can you guys give me a tip on how to fix it?
I’m guessing it is a very easy solution to this.
Thank you.

What’s your ls -la output for both the Magento and Wordpress root directories? I suspect that the Owner:Group (e.g. magento:www-data) would need to be the same in order for files to be cross-written. That’s just an educated guess.

I have the following.

What’s the ls -la for wp-content/themes?

All chmods are magento www-data

Looks like /wp-content/themes/ (rwxr-xr-x) only allows owners to write and not groups. Try allowing groups to write too (rwxrwxr-x), is it might be www-data trying to write to the directory, not magento.

chmod 775 app/code/wp/wp-content/themes/
1 Like

Great, thank you very much!
WP blog is not working in Magento. Just need to find out how to configure WP’s ftp connection with local hosting. I think I have done it once before.

Hi Craig,

I stil have issues I’m guessing with my WP file permissions.
I can remove/install new plugins. WP displayed the following message during the attempt of installing a plugin: “Installation failed: Could not create directory.”

Can you give me a tip how to set my chmods?
Setting chomd to 775 to app/code/wp/wp-content/themes/ made the FishPig plugin working so now I can see WP blog on my Magento but can’t do much with WP itself.

Hmm… So, let’s layout what we know.

Our web servers run on Apache. By default Apache requires our web directory to have a www-data set as the group for all of the files and directories. This paired with Permission 775 to allow both Read/Write access for www-data. We have already confirmed that this is correct.

Magento, requires it to set the owner as magento, again with the Read/Write privileges. This is because Magento also needs to make file modifications… Of which are executed by the cron-jobs we have setup as the magento user. We also know that this is confirmed to be correct with your setup.

So, amending the permissions to 775 allowed Magento/Apache to make the necessary changes to the wordpress directory during the Magento Module part of the installation. :+1:

Test 1
But now for whatever reason, we’re on the second hurdle, where Wordpress is complaining about privileges. That only leads me to 1 theory right now: More Files/Directories have been added to the wp/ directory (maybe by magento during the last step), therefore you need to run the 775 commands again to the entire wp/ directory.

Test 2
If this does’t work then you can attempt to run an experiment… To set everything in the wp/ directory to 777 (never recommended), restart the install process. If it works then identify what those Files/Directories where created as (owner:group). For some crazy reason, it might turn out that Wordpress is trying to write files as bob instead of magento or www-data - which would explain why 775 doesn’t work. Unlikely, but we’ll see.

1 Like

Hi Craig,

Setting chmod to 775 to the entire directory fixed the issue.
I hate messing with privileges. I just don’t get it. I need to get back to your tutorial and experiment with this.

Once again than you.

1 Like

Hi,

There is always something. :rage:

I’ve just tried to update a plugin and the following error message is displayed:
“Update Failed: The update cannot be installed because we will be unable to copy some files. This is usually due to inconsistent file permissions.”

Have you got an idea how to bite this one?

All I can suggest is running 775 again. But you can always run the test I mentioned to see what the files are trying to be written as in order to work out what’s going on.