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

Installare wordpress con cPanel e Softaculous

cPanel è una dashboard semplice da usare che vi consente di gestire il vostro server. Molti provider forniscono cPanel ai propri clienti. Da cPanel, potete eseguire una serie di azioni importanti come installare WordPress.

Softaculous è una interfaccia web che permette all’utente di installare il tipo di sito che desidera mediante un semplice click.

In questo post indichiamo la procedura migliore per installare velocemente wp usando cPanel e Softaculous. Il post indica prima la procedura da non eseguire.

Procedura Errata

  1. Con cPanel creiamo il dominio miosito.it. Nel server sarà presente la nuova directory.
  2. Non creo la directory dir (esempio) sotto la directory principale
  3. L’installazione attraverso Softaculous mi dice di indicare una directory di installazione e che questa non deve esistere. Scrivo “dir”. L’intento è quello di installare wp in una directory dir sotto la principale che sarà creata automaticamente.
  4. Lancio l’installazione
  5. il risultato è errato perché il sito installato non sarà http://miosito.it, ma http://miosito.it/dir

Procedura Corretta

  1. Con cPanel creiamo il dominio miosito.it. Nel server sarà presente la nuova directory.
  2. Da cPanel, attraverso il programma gestione domini, indico la directory in cui voglio che risieda il sito. Metto dir. La procedura crea in automatico la directory dir.
  3. L’installazione attraverso Softaculous mi dice di indicare una directory di installazione e che questa non deve esistere. Non metto niente. Il programma prenderà in consegna solo il nuovo sito http://miosito.it ma installerà nella directory http://miosito.it/dir
  4. Lancio l’installazione
  5. il risultato è corretto perché il sito installato è http://miosito.it, Tutti i file risiedono in http://miosito.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 Lascia un commento

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