• Skip to main content

Uly.me

cloud engineer

  • Home
  • About
  • Archives

phpmyadmin

WordPress on Docker

November 28, 2016

WordPress is a content management system for running blogs or websites. Meanwhile, Docker is a software container platform for building, shipping and running applications or utilities. Since there are thousands of Docker images already built, installing an application such as WordPress is fairly easy. In this article, I will show you how to install WordPress, MySQL, PHPMyadmin in a Docker environment. First things first, install Docker. Docker is agnostic, meaning it really doesn’t matter what platform you use, whether you’re on Windows, Linux or the Mac. Download Docker Docker. Install.

Create A Project Folder

$ mkdir wordpress
$ cd wordpress

$ mkdir wordpress $ cd wordpress

Create a Docker Compose file

The docker file for composing an image is called docker-compose.yml. It’s a YAML file that contains instructions on what to do and apps to use.

$ nano docker-compose.yml

$ nano docker-compose.yml

Type in the following configuration in the YAML file. In this example, I’m telling docker to install WordPress, MySQL and PHPMyAdmin and using the following TCP ports, credentials, and volumes.

wordpress:
  image: wordpress
  links:
    - wordpress_db:mysql
  ports:
    - 8080:80
  volumes:
    - ~/Docker/wordpress/html:/var/www/html
wordpress_db:
  image: mariadb
  environment:
    MYSQL_ROOT_PASSWORD: password
phpmyadmin:
  image: corbinu/docker-phpmyadmin
  links:
    - wordpress_db:mysql
  ports:
    - 8181:80
  environment:
    MYSQL_USERNAME: root
    MYSQL_ROOT_PASSWORD: password

wordpress: image: wordpress links: - wordpress_db:mysql ports: - 8080:80 volumes: - ~/Docker/wordpress/html:/var/www/html wordpress_db: image: mariadb environment: MYSQL_ROOT_PASSWORD: password phpmyadmin: image: corbinu/docker-phpmyadmin links: - wordpress_db:mysql ports: - 8181:80 environment: MYSQL_USERNAME: root MYSQL_ROOT_PASSWORD: password

Run Docker Compose

$ docker-compose up -d

$ docker-compose up -d

The installation may take anywhere from 5-10 mins or longer. So, grab a cup of coffee.

Access WordPress

Once installed, open up your browser and access WordPress and PHPMyadmin

http://localhost:8080
http://localhost:8181

http://localhost:8080 http://localhost:8181

You can access the WordPress files from your project’s “wordpress/html” directory.

wp-docker

That’s it.

Filed Under: Linux, Mac, PHP, WP Tagged With: docker, phpmyadmin, wordpress

Password Protect phpMyAdmin

September 9, 2016

phpMyAdmin is an open-source MySQL database administration application written in PHP. The software allows database administrators, web administrators, application programmers to perform several database functions via the browser. Functions such as browse and drop databases and tables, views fields and indexes, create, copy, drop, rename and alter databases, tables, fields and indexes, perform queries, update and delete, to name just a few.

Since phpMyAdmin has direct access to your database, it needs to be secure. By default, phpMyAdmin is secured using it’s built-in login feature. If you like to make it even more secure, you can add .htaccess password protection to it by simply adding .htaccess file to the phpmyadmin pages and creating username and password file to go along with it. The following instructions will show you how to add .htaccess protection to phpMyAdmin.

Edit the phpMyAdmin Apache conf file.

sudo nano /etc/phpmyadmin/apache.conf

sudo nano /etc/phpmyadmin/apache.conf

Add the following in the /usr/share/phpmyadmin directory section.

<Directory /usr/share/phpmyadmin>
  <IfModule mod_authn_file.c>
  AuthType Basic
  AuthName "phpMyAdmin"
  AuthUserFile /etc/phpmyadmin/htpasswd.protect
  </IfModule>
  Require valid-user
</Directory>

<Directory /usr/share/phpmyadmin> <IfModule mod_authn_file.c> AuthType Basic AuthName "phpMyAdmin" AuthUserFile /etc/phpmyadmin/htpasswd.protect </IfModule> Require valid-user </Directory>

Make sure the htpasswd file is not accessible from the web.

Create the htpasswd file. You’ll be asked to enter the password twice.

sudo htpasswd -c /etc/phpmyadmin/htpasswd.protect username

sudo htpasswd -c /etc/phpmyadmin/htpasswd.protect username

Finally, to make sure your changes are in effect, reboot Apache.

sudo service apache2 restart

sudo service apache2 restart

Filed Under: Linux, PHP Tagged With: .htaccess, phpmyadmin

Change WordPress Password

July 18, 2016

One of the worst things that could happen to your blog is losing your login credentials. It’s a rare event, but it does happen occasionally. This is particularly true if you run hundreds of blogs and websites. Keeping track of all usernames and passwords can be a bit of a challenge.

If you have forgotten your WordPress password, you can quickly recover it, by using the “Lost your password” link underneath the login form. In my case, WordPress mail was not working. So, not only I can’t remember my password, but I also can’t send out lost passwords via email.

Thankfully, I had access to PHPMyadmin, a MySQL database administration tool.

Log in to PHPMyadmin. Access the WordPress database and look for the wp_users table. Edit the admin user and change the “user_pass” field. The WordPress password field uses the MD5 encryption instead of being in the clear.

password

Save your changes. Log in to WordPress.

Filed Under: WP Tagged With: admin, md5, password, phpmyadmin

Editing a Blob in PHPMyAdmin

March 1, 2016

One of my projects this week requires editing a blob. A blob is a binary large object used primarily for storing images, audio and other media types in the database. Unfortunately, the application didn’t allow me to edit a blob. So off to the PHPMyAdmin I went. PHPMyAdmin is a MySQL administration tool.

By default, the blob entries in PHPMyAdmin can’t be edited. Simple texts in blobs are sometimes scrambled. In order to make changes to the blob entries, we need to reconfigure PHPMyAdmin by editing the configuration file.

Edit the /etc/phpmyadmin/config.inc.php file.

$ sudo nano /etc/phpmyadmin/config.inc.php

$ sudo nano /etc/phpmyadmin/config.inc.php

Add the following entries at the end of the file.

$cfg['ProtectBinary'] = FALSE;
$cfg['DisplayBinaryAsHex'] = FALSE;
$cfg['ShowBlob'] = TRUE;

$cfg['ProtectBinary'] = FALSE; $cfg['DisplayBinaryAsHex'] = FALSE; $cfg['ShowBlob'] = TRUE;

There is no need to restart any services. Changes are automatically reflected in PHPMyAdmin.

Filed Under: PHP Tagged With: blob, phpmyadmin

Importing SQL in phpMyAdmin

February 18, 2014

If you have a problem importing SQL files into phpMyAdmin, the issue could be that the upload limit in PHP is set too low. By default, PHP sets the upload file limit to 2MB, which is too low for most people. You can increase the limit to something more realistic such as 16MB, if you’re working mostly with medium-sized SQL databases.

If you have access to the Terminal and have root access, you can edit your PHP.ini settings. First, you need to find out where your default PHP.ini is located. There might be several PHP.ini files in your system, but there’s only one bound to Apache. To determine to which one is being used, I suggest you create a file that contains the PHP function called phpinfo(). Place this file your web server and run it.

Create a file called phpinfo.php. Enter the code below. Save. Upload to server.

<?php phpinfo(); ?>

<?php phpinfo(); ?>

Now, open your browser and point the URL where your phpinfo.php is stored on your web server. The phpinfo.php file will run the phpinfo() function and will display the environment variables being used by Apache. Near the top of the page, you’ll see the path of the php.ini. Now that you know where your php.ini file is exactly located, you’ll need to edit that file and look for the Upload Limits.

In Ubuntu, my php.ini is located in /etc/php5/apache2/php.ini.

sudo nano /etc/php5/apache2/php.ini

sudo nano /etc/php5/apache2/php.ini

Look for the File Uploads text as displayed below. Change from 2M to 16M. Save file.

;;;;;;;;;;;;;;;;
; File Uploads ;
;;;;;;;;;;;;;;;;
 
upload_max_filesize = 16M

;;;;;;;;;;;;;;;; ; File Uploads ; ;;;;;;;;;;;;;;;; upload_max_filesize = 16M

Finally, you need to reboot Apache for your changes take effect.

sudo /etc/init.d/apache restart

sudo /etc/init.d/apache restart

Filed Under: PHP Tagged With: phpmyadmin, sql, upload

Install PhpMyAdmin on Mac

December 27, 2013

This article covers how to install PhpMyAdmin on Mac OS X. PhpMyAdmin is a software tool written in PHP to manage and administer MySQL databases. It supports not only MySQL, but also MariaDB and Drizzle databases. PhpMyAdmin supports a variety of database operations such as managing databases, tables, columns, relations, indexes, users, and permissions.

This article is part of a series of articles on how to manually install Apache, PHP, MySQL on the Mac OS. Installing the popular MAMP application is as simple as installing any other application on the Mac, but it will not give you any valuable learning experience, nor will you have complete control of your development environment. I recommend manually installing the individual applications to maximize your learning experience.

How to Install PhpMyAdmin on Mac OS X

To install PhpMyAdmin, download the latest version.

Unzip the file and rename the folder to ‘phpmyadmin.’

Move the ‘phpmyadmin’ folder to ‘/usr/local/phpmyadmin.’

$ sudo mv phpmyadmin /usr/local/phpmyadmin

$ sudo mv phpmyadmin /usr/local/phpmyadmin

Copy the config.sample.inc.php to config.inc.php.

$ cd /usr/local/phpmyadmin
$ sudo cp config.sample.inc.php config.inc.php

$ cd /usr/local/phpmyadmin $ sudo cp config.sample.inc.php config.inc.php

Create a config file in ‘/etc/apache2/other.’

$ sudo touch /etc/apache2/other/phpmyadmin.conf

$ sudo touch /etc/apache2/other/phpmyadmin.conf

Edit the config file.

$ sudo nano /etc/apache2/other/phpmyadmin.conf

$ sudo nano /etc/apache2/other/phpmyadmin.conf

Add the following:

Alias /phpmyadmin /usr/local/phpmyadmin
<Directory /usr/local/phpmyadmin>
    Options Indexes
    Order allow,deny
    Allow from all
</Directory>

Alias /phpmyadmin /usr/local/phpmyadmin <Directory /usr/local/phpmyadmin> Options Indexes Order allow,deny Allow from all </Directory>

Restart Apache

$ sudo apachectl restart

$ sudo apachectl restart

Finally, access PhpMyAdmin from your browser. Example: http://localhost/phpmyadmin

Filed Under: Mac Tagged With: phpmyadmin

  • Home
  • About
  • Archives

Copyright © 2023