Posted on

wordpress error on qtranslate switching from php 5 to php 7

Switching from php 5 to php 7, you will get this error on the qtranslate X plugin

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /public_html/wp-content/plugins/qtranslate-x/qtranslate_frontend.php on line 497

Warning: Parameter 2 to qtranxf_postsFilter() expected to be a reference, value given in /public_html/wp-includes/class-wp-hook.php on line 286

Solution

Using ftp open the file qtranslate-x/qtranslate_frontend.php. you need to make 3 substitutions :

  • In line 497 change
continue;

to

break;
  • In line 523 change
function qtranxf_postsFilter($posts,&$query) {//WP_Query

to

function qtranxf_postsFilter($posts,$query) {//WP_Query
  • in line 597 change
function qtranxf_excludeUntranslatedPosts($where,&$query) {//WP_Query

to

function qtranxf_excludeUntranslatedPosts($where,$query) {//WP_Query
Posted on

Install wordpress using cPanel and Softaculous

cPanel is a simple to use dashboard that allows you to manage your server. Many providers provide cPanel to their customers. From cPanel, you can perform a number of important actions such as installing WordPress.

Softaculous is a web interface that allows the user to install the type of site they want with a simple click.

In this post we indicate the best procedure to quickly install wp using cPanel and Softaculous. The post starts first with the procedure not to perform.

Wrong Procedure

  1. With cPanel we create the mysite.it domain. The new directory will exist on the server.
  2. I don’t create the directory dir (example) under the root directory
  3. The installation through Softaculous tells me to indicate an installation directory and this must not exist. I write “dir”. The intent is to install wp in a directory dir below the main one which will be created automatically.
  4. I launch the installation
  5. the result is incorrect because the site installed will not be http://miosito.it, but http://miosito.it/dir

Correct Procedure

  1. With cPanel we create the mysite.it domain. The new directory will exist on the server.
  2. From cPanel, through the domain management program, I indicate the directory in which I want the site to reside. I put dir. The procedure automatically creates the directory dir.
  3. The installation through Softaculous tells me to indicate an installation directory and this must not exist. I don’t write anything. The program will only take delivery of the new site http://miosito.it but will install in the directory http://miosito.it/dir
  4. I launch the installation
  5. the result is correct because the site installed is http://mysite.it, All files reside in http://mysite.it/dir
Posted on

WordPress on Azure: Error establishing a database connection

You have a WordPress site hosted on Microsoft Azure.Perhaps your site is part of a free or shared app service plan.

Trying to connect to the site, one day, you have this wordpress error message:  Error establishing a database connection

How to find out and solve the problem?

Connecting  to Microsoft Azure Service with FTP

First of all you have to connect to the site via ftp to understand where the error is. We can connect to Azure web application with FTP also. In the Overview section of the your Azure web application, select “Get publish profile”. It will download a file that has a lot of things and teh details about FTP username and password, which is constant and can be used for FTP connection.

Enable WordPress Debug Logging

You need FTP connection to  enable WordPress Debug Logging. To enable error logging in WordPress, you will have to make both of the following changes :

  1. In wwwroot directory, create a file named .user.ini Add the following line:log_errors=on
  2. In wwwroot directory, open wp-config.php
    Add the following lines  :

//Enable WP_DEBUG mode
define('WP_DEBUG', true);

//Enable Debug Logging to /wp-content/debug.log
define('WP_DEBUG_LOG', true);

//Supress errors and warnings to screen
define('WP_DEBUG_DISPLAY', false);

//Supress PHP errors to screen
ini_set('display_errors', 0);

Also comment the line :

    /* define('WP_DEBUG', false); */

Analyze the Log File

Try to load your site. Now, through ftp, you can enter in the directoy LogFiles and analyze the file

php_errors.log

Database error

Perhaps you have a database error, for example a duplicate key problem. On azure, in your app service, select Mysql In -app button. On the top of the section, you can see the Manage button. Click on the button and you’ll load the phpMyAdmin portal on your local Mysql DB.

Duplicate entry

If you have this kind of error : Duplicate entry ‘XXXXX’ for key ‘PRIMARY’ for the  query INSERT INTO `table_name`, just ran following command :

REPAIR TABLE table_name

That’s it! It was done.

Posted on Leave a comment

WordPress on Azure. CNAME Settings

After installing WordPress on Azure using this “how to” : https://azure.microsoft.com/it-it/documentation/articles/app-service-web-create-web-app-from-marketplace/

You will have a website with an address like this: http://examplewp.azurewebsites.net

Now you have to set the CNAME on the provider’s DNS of your hosting because you want your wordpress site points to http://www.mydomain.com. You can use this “how to” : https://azure.microsoft.com/en-us/documentation/articles/web-sites-custom-domain-name/

Now go into your wordpress site, in the general configuration.
You have to change WordPress address (URL) and Site address (URL). from http://examplewp.azurewebsites.net to http://www.mydomain.com