Friday, December 27, 2019

WordPress fails to update plugins, Posts or Sign in


NOTE: 
Although the examples concern to Linux env, an analogy may be done to other environments converting the commands and paths.
In the examples below, replace "mysite" by the name of your site folder.

>ATTEMPT #1 - FILES' PERMISSION

Check the owner of your data, if www-data, do:

chown www-data -R /home/mySite/public_html
chgrp www-data -R /home/mySite/public_html

>ATTEMPT #2 - PLUGIN'S ISSUE

CHECKING ONE BY ONE BEGINNING BY THE LAST ONES

If the issue happens after plugins' update or a new plugin installation, it is necessary to identify the plugin that causes the issue.
In this case, just remove the plugin by moving its code to a temporary folder.
If the issue disappears, the last removal indicates the responsible.
Example:

mv /home/mysite/public_html/wp-content/plugins/do-something /home/temp/plugins


REMOVING ALL AND REINSERTING ONE BY ONE 

Another method removes all and insert one by one (or small groups) until the issue comes up, identifying the cause.
Example reinserting a group of three:

mv /home/mysite/public_html/wp-content/plugins /home/temp
mkdir /home/mysite/public_html/wp-content/plugins
mv /home/temp/plugins/do-something /home/mysite/public_html/wp-content/plugins
mv /home/temp/plugins/do-something2 /home/mysite/public_html/wp-content/plugins
mv /home/temp/plugins/do-something3 /home/mysite/public_html/wp-content/plugins
chown www-data -R /home/mySite/public_html/plugins
chgrp www-data -R /home/mySite/public_html/plugins
#Go to the site, menu, plugins and activate the inserted plugins, then test.
#If the issue returns, one of the new three plugins is the responsible.
#To discover the one, repeate the operation removing the three ones and inserting one by one.
More details at:


>ATTEMPT #2 - WORDPRESS FILES' ISSUE

If the attempt one is ineffective, then it may be a major problem like Wordpress corruption, considering that any other procedure above was successful.

>PROBLEM

The site fails to update post.
Attempt to update a plugin works differently, redirecting to another page retuning a detailed log like wordpress upgrade - unusual since upgrade is done on the same page - the plugins' page.
After log off, login also fails.
The problem comes apparently from nothing.

>SOLUTION

Rename the current site to preserve its content.
Performed a new Wordpress installation but preserving its current database.
The new installation is connected to the previous database.
The configurations and contents from the previous installation are copied to the new one, including plugins, uploads and other key folders.

Example:

- database backup, just in case:
  mysqldump --all-databases --routines  --triggers -uroot -proot > dump.sql

- creating a new mysite directory to install a new wordpress:
  mv /home/mysite /home/mysite_
  mkdir /home/mysite
  chown root:root -R /home/mysite
  chmod 755 -R /home/mysite
  mkdir /home/mysite/public_html

- set permissions required by wordpress running by apache2:
  chown www-data -R /home/mysite/public_html

- create log dir:
  mkdir /home/mysite/public_html/logs

- installing the new site:
  cd /home/backup/wordpress
  unzip wordpress-5.3.2-en_GB.zip
  mv wordpress/* /home/mysite/public_html
  chown www-data -R /home/mysite/public_html
  chmod 755 -R /home/mysite/public_html

- create a symlink on apache2's /var/www folder:
  cd /var/www
  ln -s /home/ipstuff/public-html mysite

- point to mysite:  
  http://ultering.com/mysite/

- get the database information
database name: mysite
username: mysite
password: secret
host: localhost

- after the initial login, the key folders are copied from previous intallation to preserve configuration and content:

  rm -Rf /home/mysite/public_html/wp-content/plugins
  cp -R /home/temp/mysite/plugins /home/mysite/public_html/wp-content
  chown www-data -R /home/mysite/public_html
  chmod 755 -R /home/mysite/public_html

  cp -R /home/mysite_/public_html/wp-content/themes/* /home/mysite/public_html/wp-content/themes

   cd /home/mysite

- backup from previous content, just in case:   
   tar czvf itstuf_temp.tar.gz /home/mysite/public_html

- copying key folders containing content and configuration:
  cp -R /home/mysite_/public_html/wp-content/uploads /home/mysite/public_html/wp-content
  cp -R /home/mysite_/public_html/wp-content/w3tc-config /home/mysite/public_html/wp-content
  cp -R /home/mysite_/public_html/wp-content/wflogs /home/mysite/public_html/wp-content
  cp -R /home/mysite_/public_html/wp-content/nfwlog /home/mysite/public_html/wp-content
  cp -R /home/mysite_/public_html/wp-content/.tmb /home/mysite/public_html/wp-content
  cp -R /home/mysite_/public_html/wp-content/.quarantine /home/mysite/public_html/wp-content
  cp -R /home/mysite_/public_html/wp-content/mu-plugins /home/mysite/public_html/wp-content
  cp -R /home/mysite_/public_html/wp-content/wp-link-status-salt.php /home/mysite/public_html/wp-content
  cp -R /home/mysite_/public_html/wp-content/index.php /home/mysite/public_html/wp-content

- moving the backup to a temp dir to be downloaded and removed:  
  mv /home/mysite/public_html/wp-content/uploads /home/temp



No comments:

Post a Comment

eclipse: java: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder" or Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/impl/StaticLoggerBinder

  >PROBLEM Using Eclipse, you try to run a simple logging test using "org.slf4j.Logger" like the sample below: package Test; im...