WordPress Database Error Out Of Resources When Opening File

How to Install WordPress on Docker (Windows, MacOS and Linux)

If you’ve been paying attention to the recent rumblings in the web/app development space, there’s a good chance you’ve encountered the term ‘containers.’ And for good reason. Containerization has multiple use-cases: whether you’re looking for an isolated environment to test your application, or want to make your application portable for easy deployment on any machine.

One of the most famous containerization solutions is Docker. It is so popular, that in fact, it is difficult not to bring up Docker when discussing containers.

In this tutorial, we will show you how to utilize Docker for your WordPress projects. This guide will prove to be beneficial for those who want a sound yet minimal environment to run isolated tests on their projects. It will also be useful for serving as a playground for experimentation with various WordPress plugins and themes.

So, sit back and behold the wonders of containerization.

What you’ll need

Before starting this tutorial you’ll need:

  • Access to the command line

First, A Word on Docker

Containers could easily be understood through the concept of virtual machines. Similar to virtual machines, containers provide security by running separate instances of operating systems simultaneously with no interaction with each other. Also, like virtual machines, containers enhance the portability and flexibility of your projects, as you are not dependent on any specific hardware, and can migrate over to any other cloud, local environment etc.

But in contrast to virtual machines, which require an installation of fully-featured operating systems along with their often-bulky overhead, containers share the kernel of a single operating system while still maintaining isolation with respect to other containers. In short, you get the same benefits of virtual machines, without the overhead costs.

Docker uses the same scheme to create containers on a Linux-based VM. In a single Docker container, you get access to all of your development needs: source code, dependencies, and runtimes.

This is especially useful for WordPress developers. Not only is it a chore to setup a test environment for WordPress (database, dependencies, server), but you also end up throwing away valuable system resources like server space, memory etc. Docker can vastly improve this, by setting up a minimal environment, that you can take anywhere with you.

Step 1 – Installing Docker

Fortunately, Docker is available on all the major operating systems: Windows, macOS, and Linux. Less fortunately, the level of Docker support fluctuates between these operating systems. So, depending on which operating system you’re using, your mileage may vary.

Option 1.1 Linux Installation

Linux is the recommended operating system when it comes to Docker deployment. This is due to the fact that Docker was originally released on Linux back in 2013. Docker installation on different Linux distributions will be different. Steps below show how to install Docker on Ubuntu 14.04 LTS, if you are running different Linux distribution, see official Docker documentation.

  1. Start by updating package list:
  2. Install Docker.io package:
  3. Run the following two commands to fix paths:
  4. Check if Docker is running by executing:
  5. If you want to start Docker when system boots, execute this command:

Option 1.2 macOS X Installation

Since the Yosemite update, macOS also supports Docker. Though not as robust as the Linux version, you can still mostly achieve the same on your Mac machine with Docker:

  1. Download Docker for Mac and install it like any other software.
  2. During configuration, Docker will ask you to enter your password. Click OK and enter the password.
  3. Docker will now launch for the first time (it can take up to a few minutes). The green light at the bottom will indicate whether it’s running or not.

Option 1.3 Windows Installation

Due to sufficient market demand, Docker was ported to mainstream Windows versions in June 2016. Before this, only Windows Server users were able to use Docker on Microsoft’s platform. Now, you only need to have a 64-bit version of Windows 10. In addition to the OS requirement, you also need to enable Hyper-V, which you can yourself by booting into your BIOS or let Docker’s Installer do it for you.

Speaking of which, download and run the Docker Installer for Windows. We recommend going with the Stable release, though you are welcome to choose the Edge or Legacy Edge versions. During the installation phase, you will be asked for your system password, which is necessary to grant Docker certain privileges.

Once the installation is complete, Docker will launch automatically. You should be able to see the Docker’s Welcome screen at this point. You can verify your installation by opening the Windows command shell (cmd.exe) and running the following commands:

If these are able to run successfully, you are good to go.

Now that you know that Docker has installed properly, you might want to test if it works just as intended. There are a few ways you can do this. The easiest and most common method of testing Docker is to execute”

This command pulls a‘Hello World’ sample image from Docker Hub (more on this later) and creates a new container using that image. As a result of executing the command, you should see the message:

At this point, you are done with Docker’s installation. If you wish to play further with what you can do, read Docker’s official Getting Started page.

Step 2 – Setting-Up WordPress on Docker

Now that you have a working distribution of Docker running on your operating system, we can proceed with deploying WordPress to gain the benefits of containers. Note that from this point onwards, it does not matter which operating system you’re using.

There are two methods of setting up WordPress on Docker. The first is the manual method, which uses the CLI to run WordPress. The second is the cleaner, more systematic method of getting WordPress to run on Docker using Docker Compose, therefore it will be used as an example in this Docker WordPress tutorial.

Running WordPress with Docker Compose

This is the recommended method for creating a WordPress container, or any container, in Docker. It uses Docker’s very own Docker Compose tool. Each container created via Docker Compose uses a config file, making it easier to port.

If you followed the instructions in Step 1 correctly, you should already have Docker Compose. You should probably still run a check:

Next, you need to create a new directory for WordPress:

Just like the previous section. Once inside the directory, open any text editor and create a new file called docker-compose.yml.

Paste the following in the .yml file and save changes:

This will instantiate a MySQL database service, provide credentials to the database, and pull the WordPress image from Docker Hub.

To run the file, execute this command:

Now in your browser enter localhost:8000 or http://127.0.0.1:8000 and it should result in the ‘Famous 5-Minute’ installation screen.

Conclusion

Docker is a great tool if you want to reap the benefits of containerization. It could be particularly useful for WordPress developers, as their work requires constant experimentation with plugins, themes etc.

In this WordPress for Docker tutorial, you have learned how to install Docker on Linux, macOS, and Windows. You also learned how to setup WordPress both manually using the CLI, and through the Docker Compose utility. By following this tutorial, we hope developers shun virtual machines in favor of containers when crafting WordPress applications.

WordPress database error out of resources when opening file

I am using MS Access 2010 and one of my databases on our shared network does not open for any user. Shows "Unrecognized Database Format." error message.

I can’t even get it to the point of opening. Is there a solution for this?

Is there any commercial tool to recover data from a corrupted database?

To repair a corrupt .mdb database of MS Access, one can try Compact and Repair feature of MS Access. It repairs corrupt database and makes it accessible for database users. Other than this one can also use import feature of MS Access that helps database users import their corrupt database to a new database file.

If both these solutions fail to fix this corruption,

Then one must check some third-party access database repair or recovery software. I would like to suggest MDB Repair Kit software here to repair corrupt .mdb and .accdb files. One can check its free demo version before buying its full version. Download the software from this page: http://www.mdb.repair/

Hope this would be helpful.

  • Marked as answer by PeterGreene Thursday, July 24, 2014 9:36 PM

All replies

To repair a corrupt .mdb database of MS Access, one can try Compact and Repair feature of MS Access. It repairs corrupt database and makes it accessible for database users. Other than this one can also use import feature of MS Access that helps database users import their corrupt database to a new database file.

If both these solutions fail to fix this corruption,

Then one must check some third-party access database repair or recovery software. I would like to suggest MDB Repair Kit software here to repair corrupt .mdb and .accdb files. One can check its free demo version before buying its full version. Download the software from this page: http://www.mdb.repair/

Hope this would be helpful.

  • Marked as answer by PeterGreene Thursday, July 24, 2014 9:36 PM

Based on your description, your Access database is corrupt.

The Access database file format is very complex. It starts with a file header containing the meta information of the whole file, followed by several parts containing the actual data. You can find more detailed information about the Access database file format by searching on Google with the keyword “Access database file format”. If the file header containing the meta information is corrupt, or any follow-up parts are damaged or corrupted, then you will not be able to open the file correctly with Access. In such a case, the first step is to try to use the built-in repair or recovery function in the Access, to see if it can repair or recover the corrupt file. If not, then you need to resort to a third-party Access recovery software to scan the corrupted file and repair Access database for you. It is also possible to find a data recovery expert or company to do the task, but in most of the cases, they will also use a third-party tool to do the recovery for you.

The main difference between using the software by yourself and by a third-party service company is:

(1) The company is familiar with the data recovery industry so he knows which software is the best one. While you need to search and compare the software online by yourself, which is time-consuming.

(2) The company purchases the software for multiple usages, while you purchase the software for one-time usage only. So normally the service fee may be cheaper than the license fee for the software.

(3) DIY will keep your data confidential while do the recovery via a company may cause data breach.

If you want to perform a DIY recovery, then you can first try the build-in "Compact and Repair" command in Access to repair your corrupt database, you can get more detailed info at:

If the above method does not work, then you can try third-party Access data recovery tools, such as DataNumen Access Repair at:

I have used the tool in the past and it helps recovering some valuable data for me. The tool has a free demo so that you can try before you buy.

Setting Up a Local Server for WordPress Development

Today I’m going to talk to you about setting up a local server to use with WordPress. Using a local server is important for many reasons, if only to keep you from having to upload and download your files all the time. Anytime we need to make changes, we can use the local server.

To keep your website live without putting it in maintenance mode for a very long time, we can use the local server.

Downtime is an enormous fear of many website owners and this alone keeps them from making big changes or upgrades, because after all, downtime can cause your website to miss out on sales, affiliate income, new visitors or it may even cause some search engines to drop a few pages from their indexes. With a local or testing server, this no longer has to be a concern.

So now that we know a few good reasons to set up a local server, let’s go ahead and find out how we can do this.

Step one

The first step is to find out which software you want to use. Two of the most popular are XAMPP and WAMPSERVER.

WAMPSERVERis only compatible with Windows but is a much more user-friendly software. Since Windows can be added to a Mac partition, there’s no reason not to go with WAMPSERVER.

For this tutorial we’re going to use WAMPSERVER. The many benefits of WAMPSERVER are apparent once you start using the software, but let’s go over a few. WAMPSERVER uses Apache2, PHP and MySQL and gives you the ability to change settings for each of them.

With PHP you can change the version, change different settings such as “display errors” or “short open tags”, you can even turn on and off different PHP extensions such as “PHP_curl” and “PHP_tidy”. A few other things you can do with the PHP options is to read the error log or even set up a PHP.ini file.

Taking a look at the Apache options, you can change the version, stop/start the service and set up testing ports, enable/disable modules such as the “actions_module”, you can even add an alias directory like “http://localhost/yoursite” with the click of a button. A few other Apache options are to read the error and access logs as well as configure directly your httpd.conf file.

As we can quickly see WAMPSERVERhas many options to offer with those listed above including the ability to change many MySQL settings and use phpMyAdmin.

Step two

Your second step is going to be actually installing the software, so go to http://www.wampserver.com/en/ and click the WAMPSERVER download that applies to your system: 32 or 64 bits.

Once you have downloaded and saved the file to your desktop or somewhere else, go ahead and double-click it to install.

When the window pops up click Next and accept the user agreement on the next window.

Then choose your directory which can even be on a removable storage device such as a flash drive. Click Next twice, then install.

Step three

Once you’ve installed Wampserver, it’s time to get it set up. If you put a shortcut icon on your desktop, click on that and it will start the service, otherwise you will need to go to the Windows start menu > all programs > Wampserver.

After starting WAMPSERVER you will notice a pink icon turned to a green icon, then you can simply go to local host in your address bar and you will be greeted with the WAMPSERVER homepage.

Here you will have access to your PHPinfo, phpMyAdmin and your projects.

These two services should already be set up for you, so click on the green icon in your taskbar, go to Apache and click on httpd.conf because we need to set up a few things in here.

Once you have opened the httpd.conf file, look for #LoadModule vhost_alias_module modules/mod_vhost_alias.so and take out the #, this will enable the vhost module which is what we’ll be using in the next step.

Step four

Now you can set up your first WordPress site directly on your local server. There are two ways to do this and I will show you each one, but the second is the more preferred and more dynamic way.

The first we can do this is by simply clicking on the green icon in your taskbar, and going to Apache > alias directories and adding a new directory such as http://localhost/yoursite. Afterwards you would simply go click on the green icon again and click on www directory. Here you will get an Explorer window where all of your sites folders are listed. Simply create a new folder with the same name as your alias such as “yoursite” and you’re done.

One of the major problems with this method is with the URLs, especially dynamic URLs that are generated by WordPress. Using localhost can cause you to get lost in dynamic sites, it just doesn’t look as natural, it can also cause confusion because it looks like everything is in a subdirectory.

The second method is to use the virtual host which we enabled earlier in the httpd.conf file. This method is also pretty simple, looks more natural and I believe it handles dynamic URLs much better. J

Just open your httpd.conf file and start configuring from there. Search the file until you find:

Here is where you will put all of your virtual host directories. To add a new site simply copy the above code and change the information to something like:

Then save your httpd.conf file.

After you’ve done that, click on the green WAMPSERVER icon again and go to your www directory. Create a new folder and call it something like “yoursite”.

Next go into My Computer and C:\Windows\System32\drivers\etc, here you should see your host file. Right-click on the file and open with notepad, and directly under where it says “127.0.0.1 localhost” create a host name for your new site such as “127.0.0.1 yoursite”.

At this point you are nearly finished, click on the WAMPSERVER icon again and restart all services. Now you can simply go into your browser and put www.yoursite.dev into your address bar. You won’t see anything right now except for a blank page but at least you know it’s working. If it’s not working then retrace your steps and make sure you didn’t miss something.

Step five

Now go to www.WordPress.org and download the latest version, save it into your local WAMPSERVER www directory and extract everything in the zip file to that folder.

After downloading WordPress, click on the WAMPSERVER icon again and open phpMyAdmin.

Once inside phpMyAdmin, create a new database by clicking on the databases tab and entering a database name in the space at the bottom of the page. For easy recognition will just name this “yoursite”. After your database is set up, click on the WAMPSERVERicon again and restart all services.

As you notice your database will be empty but we’ll fill it up real quickly when installing WordPress.

Now go into your WAMPSERVER www directory and open the “yoursite” folder and find wp-config in the main directory. Open the file in your HTML or PHP editor such as Notepad++ and set the following information:

If you have set a password for phpMyAdmin then go ahead and set it in the appropriate place, otherwise leave it blank.

Save the config file and now you can go into your browser, put in www.yoursite.dev and you should see the WordPress installation page. If you used the wp-config-sample file then take out the word -sample and simply save it as wp-config.

At this point go ahead and enter your information in the WordPress installation page and click install.

After installing WordPress, go back to phpMyAdmin and you should see your database with 11 tables.

Now proceed by logging into WordPress and go to settings, here you should see all of your initial information filled in for you.

If you have done everything correctly, you should have a brand-new WordPress installation and now you’re ready to begin working on your local website.

Summary

Now that you understand how to set up and use a local server for WordPress, it’s time to start using it and get familiar. There are many benefits to this including the fact that it is never a good idea to work on your website on a live server unless you’re testing it for a client, plus your workflow is so much faster. This is poor practice, so you will be happy to know the ways of the local server.

Do you use your own local installation of WP for development and testing? Let us know your experiences in the comments!

How to Connect to the MySQL Database

In order for your MySQL database to work as intended, it will need a script calling or querying the database for the information it stores. In order to do this, you must connect your script to the database with a configuration file.

If you are not sure where your configuration file is, check this list of different scripts to find its location:

Configuration Settings

Database driven scripts, such as WordPress, WHMCS and Joomla, will generally have a default configuration file ready for you to edit with the appropriate information. Below you will find examples of what this access information will look like:

Host Name = localhost (literally input localhost)
Database Name = cpanelUsername_databaseName
Database Username = cpanelUsername_databaseUsername
Database Password = whatever you selected

// ** MySQL Settings ** //
/** The name of the database for WordPress */
define(‘DB_NAME’, ‘joe1337_wrdp1’);

/** MySQL database username */
define(‘DB_USER’, ‘joe1337_wp1’);

/** MySQL database password */
define(‘DB_PASSWORD’, ‘eHTb7%Pxa9’);

/** MySQL hostname */
define(‘DB_HOST’, ‘localhost’);

To learn how to connect to the MySQL server remotely, please see read:

  • How to Connect to MySQL Remotely

Tips and Tricks for Moving Databases

  • When you move databases to our servers, the database name and username may change. This change must be updated in your script code. (The database name and username is clearly displayed in cPanel, in the MySQL area.)
  • On Shared servers, the database username cannot be changed to something without the cPanel username in it. This is to keep database names and usernames from conflicting with others on the server.

MySQL User Has No Privileges

Since the 11.25 update, we’ve noticed an occasional bug where adding an IP to the MySQL remote access list results in the corresponding MySQL user having no privileges.

In order to get the correct privileges added:

  1. Go to your MySQL Databases in cPanel.
  2. Re-add the user to each database by selecting the user and the database from the drop-down menus.
  3. Reassign the privileges.
  4. Click Add.

We have notified cPanel about the issue in hopes of this bug being corrected in newer updates.

Related Articles

cPanel is a popular web hosting control panel that helps you manage your hosting account and assists you in creating web sites, managing e-mail addresses, & installing applications to a server.

cPanel is available on all HostGator Linux hosting plans, including Shared Hosting, Reseller Hosting, VPS and Linux Dedicated Servers.

Leave a Reply

Your email address will not be published. Required fields are marked *