HOWTO: reset local wp-admin password

A little bit of background: I have like 3 copies of WP installed on local machines. If you want to know how to install WP locally, I wrote already a post about it. Then one day I come back to one of them and… surprise! I can’t log in anymore. Panic. Fever. What shall we do now? Why didn’t we pay attention to this install when it was just released? Fortunately, my WP was not alone and it was coming with a mariadb and a phpmyadmin installations. From there we can destroy fix everything. Let’s do it.

  1. Log into phpmyadmin
  2. Search for the database storing the wp information
  3. Browse wp_users until you find your username
  4. Click on Edit, and change the user_pass field for your new password
  5. Choose Function: MD5 (as seen above)
  6. Restart mariadb and httpd just to be sure.

Solution found on this link. Image taken from there also. I can’t believe it’s not meat 🙂

HOWTO: fix your wordpress install after a system update – main page shows only php code

Background: we had a very big disconnection and the local WP installation didn’t come back after all the other systems came back. I have access to the website (so the apache2 service is running) but the main site as well as the admin site show only php text code. I tried rebooting the computer (a virtual machine) without luck. A very simple solution this one has. As usual, the solution is in StackOverflow.

sudo apt install php7.0 libapache2-mod-php7.0 
php7.0-mysql php7.0-curl php7.0-json

I restart then my apache2 and my website comes back. Fiu! Have a nice weeked, or see you tomorrow for the Mars discussion post…

WordPress multisite: more than one WP site in one server

I don’t have so much mood to write lately. I guess I’ve been busy thinking or something like that. Anyway, here I am again. (B)logging the last thing I did, that is to transform a single WP install onto a multisite install.I will be following this guide to arrive to the desired multisite configuration.

I start with an installed version (so no docker) on CentOS 7. I deactivate the plugins, then edit /var/www/html/wp-config.php as indicated.

Add this code before the /* That's all, stop editing! Happy blogging. */ line:

/* Multisite */
define('WP_ALLOW_MULTISITE', true);

I save the edits on the wp-config.php, and restart httpd service. Unfortunately I don’t get the Network Setup Menu as in the guide (maybe you get it) but I don’t worry about it and continue. After that I will regret, and I will need to edit various other files to achieve what I want. Here you have the details about the file modifications needed. But basicallyt I have installed phpMyAdmin also. For that I have installed and configured mod_rewrite for apache and fixed a package error problem with php 7.4 install on CentOS 7.9. In brief

yum-config-manager --disable 'remi-php*'
yum-config-manager --enable remi-php74

And of course, I have given permission to access phpmyadmin on this server. But at the end, as usual I manage to get what I want. Or should I say you managed to get what you wanted? 🧐. Because what I want is to write about what I think, not about what I do. And I’m not in the mood 😔. See you around…

HOWTO: Install WordPress in debian 11 (no docker)

Previously I have installed WP on CentOS 7.X, now I have tried in another system, Debian GNU/Linux 11 (bullseye). I have followed this tutorial from Cloud Infrastructure Services basically cut’n’copying until Step 5, replacing :

In other words, replace the generic entries. I test the apache configuration

# apache2ctl configtest
Syntax OK

Then I go to http://IP_ADDRESS and create the root user, etc. Like it is written here, on the howto install WP on Debian. It was very easy, as it was for CentOS 😎! Note that in one of the tutorial we use an apache server, and in the last one it’s an NGINX Virtual Host. Happy wordpressing! 😁.

HOWTO: Install WordPress in a CentOS 7.X (no docker)

Sometimes you need to install the program for real. I have described you before how to install WP with a docker, now I want to tell you how to install it without dockers. I’ve followed this guide from VULTR. It worked like a charm. For the records:

## > mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 4
Server version: 5.5.68-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help.
Type '\c' to clear the current input statement.
MariaDB [(none)]> create database myexample;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> CREATE USER 'user'@'localhost' IDENTIFIED BY 'XXXX';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> use myexample;
Database changed
MariaDB [myexample]> GRANT ALL PRIVILEGES ON myexample.* TO 'user'@'localhost';
Query OK, 0 rows affected (0.00 sec)
MariaDB [myexample]> exit
Bye
## > yum install -y http://rpms.remirepo.net/enterprise/remi-release-7.rpm
## > yum --enablerepo=remi-php74 install php php-bz2 \
php-mysql php-curl php-gd php-intl php-common \
php-mbstring php-xml
## > systemctl restart httpd

## > wget http://WordPress.org/latest.tar.gz
## > tar -xzvf latest.tar.gz
## > mv WordPress/* /var/www/html/
## > chown -R apache.apache /var/www/html/

That’s it. It worked ❤️❤️.

HOWTO : install WordPress in a local computer with a docker

The first page. Image taken from here.

Like everything we do with dockers, this procedure is a little bit dark but it works out of the box. I will suppose you already have docker installed. I’m running on CentOS 7.X, that is my current weapon of choice. I am following the official docker WordPress image installation instruction. In principle it’s working out of the box with the one-liner

$ docker run --name my-wp --network some-network -d wordpress

The installer quickly appears on 0.0.0.0:8080, but we are asked for database to connect. I do have a database, but the idea is to reduce “coding” to the minimum, so I go for the next recipe, with a docker compose. With the small modification of my server IP (1.2.3.4) I take the sample yml from the official page but I save it as :

version: '3.1'

services:

  wordpress:
    image: wordpress
    restart: always
    ports:
      - 1.2.3.4:8080:80
    environment:
      WORDPRESS_DB_HOST: db
      WORDPRESS_DB_USER: exampleuser
      WORDPRESS_DB_PASSWORD: examplepass
      WORDPRESS_DB_NAME: exampledb
    volumes:
      - wordpress:/var/www/html

  db:
    image: mysql:5.7
    restart: always
    environment:
      MYSQL_DATABASE: exampledb
      MYSQL_USER: exampleuser
      MYSQL_PASSWORD: examplepass
      MYSQL_RANDOM_ROOT_PASSWORD: '1'
    volumes:
      - db:/var/lib/mysql

volumes:
  wordpress:
  db:

In my prompt, I simply type:

## > docker-compose up -d
Creating wordpress_wordpress_1 ... done
Creating wordpress_db_1 ... done

And after that I go to 1.2.3.4:8080 to start the installer. As we can read above, we now have two dockers, one for the database and one for the wordpress engine. Filling up the next details for the admin is trivial, and we end up with a page like the one above (template Twenty-Twenty-Two). New user creation is also working without issues. We’ll see if the client is happy with it also! 😉