Hiding the site name in the phpBB header

Did somehow a great logo in the header of the forum phpBB and of course the name of the site and the description was imposed on it and prevented.
To hide the site name and description in the directory of the active theme (style), find the file /style/stylename/template/overall_header.html

Open it in a text editor and find the following two lines in it:

<h1>{SITENAME}</h1>
<p>{SITE_DESCRIPTION}</p>

Just they are responsible for displaying the site name and description in the forum header, we will not delete them, they will come in handy, but simply comment:

<!-- <h1>{SITENAME}</h1>
<p>{SITE_DESCRIPTION}</p> -->

After that, clear the forum cache by clicking the button in the administrator’s pane.

Done.

How to enable PHP short tags?

It was necessary recently to include short PHP tags since the site code that I transferred to another server was written with their use.
By default, they are disabled.
For example, the usual tags look like this:

<?php  code  ?>

And short ones like this:

<? code ?>

To include short ones, you need to find the short_open_tag parameter in the php.ini configuration file and specify its value in On, for example:

short_open_tag=On

php.ini is usually located in the /etc/php5/directory, if cpanel is used, in /usr/local/lib/php.ini.

You need to reboot the web server to apply the change, in Ubuntu apache2 is rebooted with the command:

sudo service apache2 restart

The solution of the error “PDOException “could not find driver””

I noticed somehow the following error:

PDOException “could not find driver”

The reason may be not activated pdo_mysql or not installed php5-mysql.
Let’s look at the PDO:

php -i|grep PDO

In php.ini or connected configuration files there should be a line:

extension=pdo.so
extension=pdo_mysql.so

Let’s see the information about php5-mysql:

dpkg --get-selections | grep php5-mysql

If not installed, then install, in Ubuntu it can be done like this:

sudo apt-get install php5-mysql
sudo apt-get install php-mysql
sudo /etc/init.d/apache2 restart
sudo service apache2 restart

Comments in PHP

In PHP, comments can be of three types.

I will give an example of the first (one-line in the style of C ++):

<?php
echo "TEXT"; // Comment
?>

The second one in Unix style:

<?php
echo "TEXT"; # Comment
?>

The third multiline:

<?php
     /* Comment
        Comment
        Comment */
     echo "TEXT";
?>

PHP. Redirect to another page

I’ll give an example of redirecting to another page:

<?php
  header("Location: http://www.example.com/");
  exit;
?>

Example of redirecting in specified number of seconds:

<?php
  header('Refresh: 5; URL=http://www.example.com/');
  echo 'After 5 seconds you will be automatically redirected to another page.';
  exit;
?>

Example of Redirect in JavaScript (this may not work for everyone):

<script type="text/javascript">
  location.replace("http://www.example.com/");
</script>

Example Redirect in JavaScript after 5 seconds (this may not work for everyone):

<script type="text/javascript">
  setTimeout('location.replace("http://www.example.com/")', 5000);
</script>

An example of Redirect in HTML after 5 seconds (if you specify 0, it will redirect immediately):

<meta http-equiv="refresh" content="5; url=http://www.example.com/">

How to remove W3 Total Cache plugin from WordPress

To uninstall W3 Total Cache from WordPress, you need:

1) In the plugin menu, click the cache clear button.

2) Deactivate the plugin in the plugins menu and click “Delete”

3) In the root directory of the site, at the beginning of the wp-config.php file, if left, delete the lines:

/** Enable W3 Total Cache Edge Mode */
define('W3TC_EDGE_MODE', true); // Added by W3 Total Cache

/** Enable W3 Total Cache */
define('WP_CACHE', true); // Added by W3 Total Cache

4) As I noticed after the plug-in there are a lot of files, and on large sites there can be millions of files with cached data.
In the wp-content directory, delete the files, if any, advanced-cache.php, object-cache.php, w3tc-config and cache (here cached data).

Done.

Solving the SSL problem “Connection is not secure – Parts of this page are not secure (such as images)”

I noticed once one site with a signed SSL certificate, a message from the Mozilla Firefox browser:

Connection is not secure – Parts of this page are not secure (such as images)

As it turned out, images from other sources were inserted on the site, so the connection can be considered not protected, and to solve this problem, you need to upload images to the current site and change the link on the pages, necessarily starting with https://.

If the site works on http:// and https://, and the pictures are on it, then the links should be changed for example from:

<img src="http://www.ixnfo.com/img.jpg">

to

<img src="/img.jpg">

Done.

How to install PHP 5.6 in Ubuntu 16

In Ubuntu 16, installing PHP with apt-get install php installs PHP version 7, so to install PHP 5.6, you can add a third-party repository.

If the system has PHP 7 installed, then you can delete all of its components like this:

sudo apt-get purge `dpkg -l | grep php| awk '{print $2}' |tr "\n" " "`

Now add a third-party source:

sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ondrej/php

And install from it PHP 5.6:

sudo apt-get update
sudo apt-get install php5.6

Similarly, you can install modules, for example:

sudo apt-get install php5.6-mysql php5.6-mcrypt php5.6-mbstring php5.6-xml

To check the installed version of PHP, perform:

sudo php -v

See also my article:
Upgrading PHP Version on Ubuntu 14.04