Seem to have messed up Admin backend

Hi,
I’m new to Magento and coming to terms with the steep learning curve.

I tried installing SMTP extension - mageplaza/module-smtp - using Composer.

I ran these three commands …

composer require mageplaza/module-smtp … worked fine
php bin/magento setup:upgrade … got a warning … Path “/var/www/html/app/etc/” cannot be used with directory “/var/www/html/app/etc/”
php bin/magento setup:static-content:deploy … would not work so used -f flag and it worked.

Now, the frontend store loads fine but the backend doesn’t appear to be loading CSS or JS.

Has anyone come across this before? Any recommendations?

Server: Ubuntu 16.04
Hosting: AWS Lightsail
Magento: 2.3.0

Hi @damianduffy,

As of yet, I’ve not come across this issue before. Did you:

  1. Run composer require mageplaza/module-smtp as the magento file user (not root)?
  2. Run composer require mageplaza/module-smtp from within the Magento root directory?

Developer Mode
If you’re working in Developer Mode, try running the following series of commands (from Magento root directory as magento file user):

  1. rm -rf var/cache var/log var/page_cache var/view_preprocessed
  2. bin/magento setup:upgrade

Production Mode
If you’re working in Production Mode, try running the following series of commands (from Magento root directory as magento file user):

  1. bin/magento setup:di:compile
  2. bin/magento setup:static-content:deploy en_GB en_US
  3. bin/magento cache:flush

Note: In step 2, I deploy static content in the the languages that I’ve been working in. So, I always add en_US and my stores use en_GB locale. So, I add both.

Permissions and Ownerships
Also, check that your Folder/File permissions are correct by running ls -la within the Magento root directory. In many cases, I’ve found a common cause of issues are down to either a) File/Folder Ownership or b) File/Folder Permissions.

Side-note
Mageplaza SMTP randomly stopped working for me a few months ago (not related to this issue). As an alternative, if you’d like another option try Ebizmarts SMTP. It’s worked fine for me, and the devs still support it.

Please, let us know how you get on.

Disclaimer: Always backup your files/database/server before executing any commands when debugging - As blindly executing commands may make things worse.

thanks for the quick reply!

Yes, to your first two questions. I used the magento user account and ran the command from the Magento root (/var/www/html/).

I’m in ‘default’ mode.

Tried bin/magento setup:di:compile but it fails to complete…

Compilation was started.
Repositories code generation... 1/7 [====>-----------------------]  14% < 1 sec 66.5 MiBPH
P Fatal error:  Class 'Zend_Application_Resource_Mail' not found in /var/www/html/vendor/m
ageplaza/module-smtp/Mail/Rse/Mail.php on line 31

At this point I would be happy to remove all traces of Mageplaza SMTP. Is there a clean way to remove this module?

I try to check in at least once a day :slight_smile:

Based on the Compilation error, I would lean towards the issue being on their end - not yours. You could spend an hour or so trying to fix their work if you really wanted to. But I’d try something else.

I can’t remember what the module is called to uninstall it. So, run the below to find the module name (it’s not the same as the composer name):

List all installed (Enabled/Disabled) modules

  • bin/magento module:status

Scroll through the list and find a module that resembles the mageplaza extension. It might be something like Mageplaza_Smtp. Once you’ve found the exact name, you can do one of the following:

Disable a module

  • bin/magento module:disable <module_name> (to disable it)
  • bin/magento setup:upgrade

Ref: Magento Documentation on Enabling/Disabling Modules

Uninstall a module

  • bin/magento module:uninstall <module_name> (to uninstall it)
  • bin/magento setup:upgrade

Ref: Magento Documentation on Uninstalling Modules

I’m not sure if you still have to compile in Default Mode (as I don’t use that mode). But it should give you instructions afterwards. If you’re learning Magento and setting it all up, I’d recommend Developer Mode because you don’t need to compile or deploy static content of the Command Line Interface when you make changes like these.

Hope this helps :+1:

The module was already set to disabled (I don’t recall intentionally doing this). I tried to uninstall but got the following error again…

You are about to remove a module(s) that might have database data. Do you want to remove t
he data from database?[y/N]y
You are removing data without a database backup.
Removing Mageplaza_Smtp from module registry in database
Removing Mageplaza_Smtp from module list in deployment configuration
Path "/var/www/html/app/etc/" cannot be used with directory "/var/www/html/app/etc/"
Please disable maintenance mode after you resolved above issues
Disabling maintenance mode

Then I tried changing to developer mode - and I got the same error again?

Path "/var/www/html/app/etc/" cannot be used with directory "/var/www/html/app/etc/"

On a separate note, I’m really impressed with Magento :grinning: - it seems to have everything I need and has me really excited to work on developing my store BUT OMG I can’t remember a time where a piece of software has made it so necessary to make constant backups/snapshots before clicking anything … even the most “business as usual” tasks have me wondering if Magento is going to hit the dust after I click save. :tired_face:

Looks like you’re not the only one with this compilation issue. This GitHub issue seems related to your own. Although, it doesn’t mention the “Path…” error.

Unfortunately, you’re going to come across issues like this. Magento is being developed rapidly, and this is catching many developers off-guard who can think they can just release an extension and forget about it. You definitely get what you pay for in this game - Especially, when it’s free.

Working with Magento 2 definitely gets “easier”, the longer you work with it. You’re going to make a lot of mistakes (as I have), but the important thing is that you learn from them and apply them to other obstacles. Keep a diary of what you learn and bookmarks of useful resources. Half of Digital Startup is sharing what I’ve learned from the mistakes I’ve made or the problems I’ve run into.

Thanks Craig - I’ll keep an eye on that open issue thread for a fix.

By the way, fantastic job on the Magento 2.3 install guide. Followed the blog post steps. It was all very clear and worked without any issues.

1 Like

Posting this in case anyone else comes across this error

Path "/var/www/html/app/etc/" cannot be used with directory "/var/www/html/app/etc/"

I checked some of my previous snapshots and they all had this error except my very first snapshot following installation of Magento 2.3. As far as I can tell, the error is related to app/etc directory permissions. I had removed write access to group. I tried adding write permission back but it didn’t solve the problem. Starting fresh with the original snapshot and hoping to avoid these early mistakes.

Thank you for sharing, @damianduffy :+1:

I was having a similar conversation with @PawelP earlier today about the permissions of the app/etc/ directory. But I kind of dismissed it relating to your case because I hadn’t come across it myself (or seen it on Google).

Out of curiosity, did fixing the permissions also fix the Mageplaza installation?

Unfortunately not, the problem persisted after changing the folder permissions. That said I only changed the folder permissions, not the contents.

Mageplaza are offering a patch but you have to contact them. It’s not publicly available so I’m guessing they’re still testing. https://github.com/mageplaza/magento-2-smtp/issues/127#issuecomment-452547490

I think I had two unrelated issues. One with the app/etc/ folder permissions (which I updated due to a notice at the end of Magento 2.3 setup). I didn’t notice this particular issue until days later while troubleshooting SMTP. Secondly, the Mageplaza SMTP extension appears to have it’s own issues related to changes in 2.3.