PHP Fatal error: include_path=’.:/usr/share/php:/usr/share/pear’

A fresh install and an installation of WordPress via the Debian apt package management gave the error

PHP Fatal error: include_path='.:/usr/share/php:/usr/share/pear'

On a development computer I chose to install WordPress via the package manager as opposed to creating Apache site directories.

With MySQL and Apache installed WordPress is added by executing, at the command prompt

apt-get install wordpress.

However, when I first navigated to the website at localhost/wordress/ rather than seeing the start of the me WordPress website creation sequence I had a blank white screen, the so called white screen of death!

Debug reporting can be enabled within the file wp-config.php, located in the root of the website. Here’s the 3 debug options, as disabled:

define('WP_DEBUG', false);
define('WP_DEBUG_LOG', false);
define('WP_DEBUG_DISPLAY', false);

The packaged Debian version relocates this to the directory

/etc/wordpress

Editing the file config-localhost.php I enabled debug logging setting my chosen options to true.

Still with a blank screen shown I chose to look at the Apache error log.

/var/log/apache2/error.log

using

tail -f /var/log/apache2/error.log

The last few lines of the log file are:

PHP Warning: require_once(/etc/wordpress/config-localhost.php): failed to open stream: Permission denied in /usr/share/wordpress/wp-config.php on line 19
PHP Fatal error: require_once(): Failed opening required '/etc/wordpress/config-localhost.php' (include_path='.:/usr/share/php:/usr/share/pear') in /usr/share/wordpress/wp-config.php on line 19
PHP Warning: require_once(/etc/wordpress/config-localhost.php): failed to open stream: Permission denied in /usr/share/wordpress/wp-config.php on line 19
PHP Fatal error: require_once(): Failed opening required '/etc/wordpress/config-localhost.php' (include_path='.:/usr/share/php:/usr/share/pear') in /usr/share/wordpress/wp-config.php on line 19

The error suggested that Pear was not installed.

To check to see if pear was installed at command prompt I typed pear

neil@abc:/home/neil# pear
bash: pear: command not found

I then installed pear using

apt-get install php-pear

Giving the following:

Suggested packages:
  php5-dev
The following NEW packages will be installed:
  php-pear
0 upgraded, 1 newly installed, 0 to remove and 107 not upgraded.
Need to get 264 kB of archives.
After this operation, 2,108 kB of additional disk space will be used.
Get:1 http://mirror.ox.ac.uk/debian testing/main amd64 php-pear all 5.6.16+dfsg-2 [264 kB]
Fetched 264 kB in 0s (625 kB/s)  
Selecting previously unselected package php-pear.
(Reading database ... 218176 files and directories currently installed.)
Preparing to unpack .../php-pear_5.6.16+dfsg-2_all.deb ...
Unpacking php-pear (5.6.16+dfsg-2) ...
Setting up php-pear (5.6.16+dfsg-2) ..

A restart of Apache

service apache2 reload

To my disappointment – no effect it still showed the error

Tue Dec 22 13:57:38.596887 2015] [:error] [pid 24889] [client ::1:41744] PHP Fatal error: require_once(): Failed opening required '/etc/wordpress/config-localhost.php' (include_path='.:/usr/share/php:/usr/share/pear') in /usr/share/wordpress/wp-config.php on line 19

I considered the permissions of the file in the directory /etc/wordpress, assigning to it the apache permissions

chown www-data:www-data /etc/wordpress/config-localhost.php

Once more I revisited the website at /localhost/wordpress

Success! I was now getting the WordPress installation.

Verify Database Backup

I was working with a new computer system. I had made a backup of the database. But could I rely on it?

To confirm the first run of a database backup I wanted to test/verify it was OK.

What I didn’t want to do was to restore the database over the existing one, without the assurance that I wouldn’t be losing data. Too risky!

From within the SQL Server Management Studio. Click to run New Query. I ran the following:

RESTORE VERIFYONLY FROM DISK = 'restore verifyonly from disk = 'Z:\Backup\project1.bak'

You may have to wait a while for the verification process to run.

Here’s an example output showing that the database backup is good to be used:

The backup set on file 1 is valid.

A simple command to run, with a lot of reassurance as a result.

References

RESTORE Statements
Checking to make sure a SQL Server backup is useable

Adapting Menu for Touch

Before the proliferation of touch devices website menus were controlled with mouse hovers and clicks.

To view the child items associated with a particular menu item, simply hover over the item to pop up the child menu with the list of child items.

If you wanted to view the parent page, a simple click was all that was required.

Adapting menu for touch: child menu

But hovering doesn’t work with touch devices. Touching on the parent page in the menu navigates to the page, not showing the child menu.

To facilitate child menus on touch enabled devices clicking on the parent should not open that page, but rather show the list of child items.

To modify the traditional menu for touch devices the parent menu items are disabled.

If the parent page isn’t accessible how to view it?

Adapting menu for touch: child menu incorporating parent

If you need to implement the parent page move it, possibly with a variation in name into the child list. For example, the Veg page could be moved as a child below with the renamed parent Vegetables.

The parent page in the menu is there solely for structure it’s no longer a physical viewable page.

Open IceDove Email Link in IceWeasel

Links in IceDove email messages weren’t opening in IceWeasel.

How to configure IceDove link options?

I found reports on the Internet that the file ~/.mozilla-thunderbird/default/<profile>/prefs.js should be edited as follows:

user_pref("network.protocol-handler.app.http","iceweasel");
user_pref("network.protocol-handler.app.https","iceweasel")

I considered IceWeasel’s configuration, available through the about:config

To make mailto links in firefox (iceweasel) open thunderbird (idedove) automatically, type about:config in the address bar and edit (or insert if it doesn’t exist) the following key and value

network.protocol-handler.app.mailto => icedove

 

open-icedove-link-iin-iceweasel

There’s a pop-up window to confirm that you know what you are doing:

Changing these advanced settings can be harmful to the stability, security and performance of the application. You should only continue of you are sure of what you are doing.

I'll be careful,  I promise!

I scrolled down the list and changed the entry to IceWeasel.

This didn’t work!

I used the popup dialogue when clicked on the link

1. From the pop-up menu, select "New".
2. From the next pop-up menu, select "String".
3. In the pop-up dialog box "Enter preference name", enter network.protocol-handler.app.http 
4. In the pop-up dialog box "network.protocol-handler.app.http" enter /usr/bin/iceweasel 

Subsequent to following the dialogue I tried returning to the preferences and the config editor.

I was only able to find the one entry for IceWeasel in my search. Closing and restarting IceDove

The settings achieved through the linked dialogue proved to be used in place of any settings selected within the preferences.

$.browser is undefined

Following the update of WordPress perhaps a feature in one of the plugins has stopped.

Reviewing the page errors with the browser inspector shows the error

$.browser is undefined

I have also encountered the $.browser is undefined error when I took over a website and updated the jQuery references as a part of my initial actions.

With the introduction of jQuery version 1.9 jQuery browser was no longer supported.

To our rescue is a set of scripts called jquery-migrate. The aim of which is to add back in those missing functions. Allowing more time for the changes to jQuery to be incorporated.

To add migration support add

<script src=”http://code.jquery.com/jquery-migrate-1.0.0.js”></script>

to the web page. Take care in its position on the page to get the sequencing right.

$.browser was used to determine which browser was in use, visiting the web page.

References

jQuery Core 1.9 Upgrade Guide – jQuery.browser() removed

Github jQuery Migrate

jQuery.browser

dpkg: warning root’s PATH should usually contain sbin

Whilst updating a computer:

apt upgrade

It listed all the gets and then concluded with this error:

dpkg: warning: 'ldconfig' not found in PATH or not executable
dpkg: warning: 'start-stop-daemon' not found in PATH or not executable
dpkg: error: 2 expected programs not found in PATH or not executable
Note: root's PATH should usually contain /usr/local/sbin, /usr/sbin and /sbin
E: Sub-process /usr/bin/dpkg returned an error code (2)

I chose to resolve by editing root’s .bashrc (/root/.bashrc)file adding an export reference for the path at the end of the file.

export PATH=/sbin:/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin

You’ll need to login afresh for the change to be adopted.

Update Row or Insert if Doesn’t Exist

When adding an entry to a database it would be nice to combine the addition with an update.

For example adding a new entry if it already exists then that entry can be updated.

This means putting more of the sequence within the database stored procedure. But it will save on a database query, with possible action – the addition, and a result confirming that the addition occurred, or a value to denote that it already exists.

If the entry already exists then there is a further call to the database to update that entry.

Dependant upon the circumstance it may be better to combine this sequence all within a single stored procedure call to the database.

There is the option to check if a particular row value exists. If it does then update or add a new entry.

Here’s the initial setup of the stored procedure, with the passed in parameters:

CREATE PROCEDURE AddUpdateProduct
  @ProductId   INT
  @Name        NVARCHAR(150)
  @Details     NVARCHAR(max)

Lets begin with a classic update

UPDATE
  Product
SET
  Name = @Name,
  Details = @Details
WHERE
  ProductId = @ProductId

Similarly an insert would look like:

INSERT INTO
  Product
  (
    Name,
    Details
  )
  VALUES
  (
    @Name,
    @Details
  )
SELECT SCOPE_IDENTITY()

I’ve added SELECT SCOPE_IDENTITY(), to retrieve the ID of the added entry.

In our example we wish to combine the two together. We’ll start by trying to update the entry.

A test on the rowcount will tell us whether we were successful. If no rows were affected then a new row is added.

Here’s the  example with the combined code:

CREATE PROCEDURE AddUpdateProduct
  @ProductId   INT
  @Name        NVARCHAR(150)
  @Details     NVARCHAR(max)
  UPDATE
    Product
  SET
    Name = @Name,
    Details = @Details
  WHERE
    ProductId=@ProductId
  IF @@ROWCOUNT =0
    BEGIN
      INSERT INTO Product
      (
        Name,
        Details
      )
      VALUES
      (
        @Name,
        @Details
      )
      SELECT SCOPE_IDENTITY()
    END

A short piece of SQL to update an existing row in a database table, or if the row doesn’t exist then to add a new entry.

I like this idea. By putting the whole action in the SQL we are saving going backwards and forwards between the database server and our website software.

Add New Admin User in Windows 2012 Server

Adding a new admin user will be divided into two actions: first the creation of the new user and then secondly the assignment of the user to the admin group.

Connect to the Windows 1012 Server with Remote Desktop click on little down arrow at the top bar

Select start and then click on the server manager icon (what happened to the small icons?)

In the black bar at the top click on tools and select computer management

Add New User

To add a new user expand Local Users and groups in the tree menu on the left.

Select Users

Right click on the centre pane. For a new system there is Administrator and Guest listed.

Select New User from the popup window and enter the details for the new user.

Add User To Administrator Group

Expand Local Users and groups in the tree menu on the left

Select Groups

Double click on Administrators Properties

Click on Add to add a user to the group

In the box enter the name of the user and then click on check names. Accept the user.

Creating Content Border with Images

Website content blocks, often called modules, or widgets, can be surrounded by borders to make them stand out. Perhaps notepad paper or an old parchment.

Different surrounds and backgrounds can be used to make the content pleasing to the eye and to add distinction. The styling enables the content to be categorised either by content or importance.

CSS3 allows for the replacement of some of the older work, for example borders with radius corners and drop shadows.

However, to implement graphic design surrounds, an image is still chopped into segments, as previously.

Where possible the segments are created such that either a horizontal or vertical repeat can be implemented.

Care is taken to ensure that frilly or castellated edges are seen to blend smoothly, not with a jagged edge, step, or hard change of colour.

A repeat allows for an efficient use of downloaded images, keeping the weight of the web page downloaded to a minimum and allowing for expansion of the content area according to the content added.

The two methods generally employed to provide this border styling are tables and divs.

In both methods the image design is chopped up into segments which are either corners or repeats for the sides. There may also be background styling for the content within the block.

The smallest table is based upon a 3×3 grid. Whilst the div method uses a number of divs stacked one above the other.

Borders Using Tables

An example of the table layout is given below. It uses a combination of fixed size table cells.

<table>
<tr>
<td width="6" height="6" background="/images/topleft.gif">&nbsp;</td>
<td width="100%" height="6" background="/images/top.gif" height="6">&nbsp;</td>
<td width="6" height="6" background="/images/topright.gif">&nbsp;</td>
</tr>
<tr>
<td width="6" height="100%"><img src="/images/left.gif" width="6">&nbsp;</td>
<td width="100%" height="100%" >Content is added here</td>
<td width="6" height="100%"><img src="/images/right.gif" width="6">&nbsp;</td>
</tr>
<tr>
<td width="6" height="6" background="/images/bottomleft.gif">&nbsp;</td>
<td width="100%" height="6"><img src="/images/bottom.gif"  height="6">&nbsp;</td>
<td width="6" height="6" background="/images/bottomright.gif">&nbsp;</td>
</tr>
</table>

Here’s an image showing a container with blue and white edges, with a yellow background for the content

Creating ontent border with images: grid of images

Perhaps a little small to view properly, so here it is enlarged:

Creating content border with images: grid of images (enlarged)

As can be seen the corners are of a fixed size. The sides joining them are set to be the full length of that side. As shown the edge middle sections are 6px in length. To minimise the saved image this could be 1px.

The side and top/bottom images are set to to match the width (6px) or height (6px). These images will then be repeated within the table cell.

The table cell in the centre is the content area. Within this area will be added the appropriate code for the CMS to generate the content.

I have found that to ensure the desired results the images added along the top and sides should be specified fully, to avoid the browser making guesses as to your intent.

The table code above can be improved upon by adding CSS class references and moving the image and sizing to CSS.

For example here’s a 3×3 table with the HTML layout and associated CSS.

<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td class="BlueBorder-tl"></td>
<td class="BlueBorder-tc"></td>
<td class="BlueBorder-tr"></td>
</tr>
<tr>
<td class="BlueBorder-cl"></td>
<td class="BlueBorder-cc">
Content goes here
</td>
<td class="BlueBorder-cr"></td>
</tr>
<td class="BlueBorder-bl"></td>
<td class="BlueBorder-bc"></td>
<td class="BlueBorder-br"></td>
</tr>
</tbody>
</table>

In the CSS below, I have merged the corner images together as a single image. This is then positioned to show the desired corner.

/* begin Box, BlueBorder */


.BlueBorder-tl
{
	width: 6px;
	height: 6px;
	background:url(images/BlueBorder-corners.png) no-repeat;
}

.BlueBorder-tr
{
	width: 6px;
	height: 6px;
	background:url(images/BlueBorder-corners.png) no-repeat;
	background-position: -6px 0px;
}

.BlueBorder-bl
{
	width: 6px;
	height: 6px;
	background:url(images/BlueBorder-corners.png) no-repeat;
	background-position: 0px -6px;
}

.BlueBorder-br
{
	width: 6px;
	height: 6px;
	background: url(images/BlueBorder-corners.png) no-repeat;
	background-position: -6px -6px;
}

.BlueBorder-t
{
	height: 6px;
	background: url('images/BlueBorder-t.png') repeat-x;
}

.BlueBorder-l
{
	height: 6px;
	background: url('images/BlueBorder-l.png') repeat-x;
}

.BlueBorder-r
{
	height: 6px;
	background: url('images/BlueBorder-r.png') repeat-x;
}

.BlueBorder-b
{
	height: 6px;
	background: url('images/BlueBorder-b.png') repeat-x;
}

/* end Box, BlueBorder */

 

Borders Using DIVs

The div method uses a number of divs either stacked on top of each other or absolutely positioned to give the same effect.

<div class="topLeft">
 <div class="topRight">
  <div class="top">
   <div class="left">
    <div class="right">
     Content is added here
    </div>
   </div>
  </div>
 </div>
</div>

Like the use of tables the original image is chopped up into segments which are then put back together.

In the div method all the items are of the same size the background images are moved to their appropriate edge and the repeat set for the x or y direction accordingly.

For example the top left corner is set using:

.topLeft{
background:url(/images/topleft.gif) no-repeat
}

I have found using this method that there is a need to stack the DIVs in a correct order to ensure that the edges and overlaps of the backgrounds match up and can be viewed correctly.

I have also used a method whereby each div is referenced sequentially with the use of absolute positioning moving the div to its required location.

Creating content border with images using divsThe image above shows an example of the result. In this case I have used a fixed width for the div sizing. It would be normal to allow 100% sizing, the div taking the full width of its bounding container.

Again the DIVs are stacked, but in many respects the code looks simpler to view and there is less chance of omitting one of the closing tags </div>.

Note how the edges are constructed first, allowing the corners to sit on top hiding the continuous edges.

<div class="border">
 <div class="top">
 <div class="left">
 <div class="right">
 <div class="bottom">
  <div class="topLeft">
  <div class="topRight">
  <div class="bottomLeft">
  <div class="bottomRight"> 
   <div class="content">Content is shown here </div>
  </div>
  </div>
  </div>
 </div>
 </div>
 </div>
 </div>
 </div>
</div>

And the associated CSS to position the above elements:

 .border{ position:relative; }
 .top{
 position:absolute;
 width:100px;
 height:100px;
 top:0px;
 left:0px;
 background:url(images/GreyBorder-t.png) repeat-x;
 background-position:0 0;
 }
 .left{ position:absolute;
 width:100px;
 height:100px;
 top:0px;
 left:0px;
 background:url(images/GreyBorder-l.png) repeat-y;
 background-position:0 0;
 }
 .right{
 position:absolute;
 width:100px;
 height:100px;
 top:0px;
 left:0px;
 background:url(images/GreyBorder-r.png) repeat-y;
 background-position:100% 0;
 }
 .bottom{
 position:absolute;
 width:100px;
 height:100px;
 top:0px;
 left:0px;
 background:url(images/GreyBorder-b.png) repeat-x;
 background-position:0 100%;
 }
 .topLeft{
 position:absolute;
 width:100px;
 height:100px;
 top:0px;
 left:0px;
 background:url(images/GreyBorder-tl.png) no-repeat;
 background-position:0 0;
 }
 .topRight{
 position:absolute;
 width:100px;
 height:100px;
 top:0px;
 left:0px;
 background:url(images/GreyBorder-tr.png) no-repeat;
 background-position:100% 0;
 }
 .bottomLeft{
 position:absolute;
 width:100px;
 height:100px;
 top:0px;
 left:0px;
 background:url(images/GreyBorder-bl.png) no-repeat;
 background-position:0 100%;
 }
 .bottomRight{
 position:absolute;
 width:100px;
 height:100px;
 top:0px;
 left:0px;
 background:url(images/GreyBorder-br.png) no-repeat;
 background-position:100% 100%;
 }
 .content{padding:8px;}

Thoughts

I have found using a 3×3 table with border edges and a central content area was most successful.

The use of stacked DIVs with positioned images and the use of relative and absolute positioning didn’t always work, for example as a DotNetNuke container. The JavaScript associated with the container elements couldn’t derive the position and tended to then misplace the required action menu.

For efficiency there is an advantage to creating a single image comprising the components to be used. Only the single image is then downloaded which saves on the overhead employed in asking for each image download, checking it’s version.

The single image is then positioned as required. This is like taking a larger image and moving it behind a window cutout to show the desired section.

As shown in the examples above the border images are quite simple. The container themes below are more akin to this style of table and div layouts.

creating content border with images examples

SDDM Fails to Show, Requires Command Line Login First

The computer was showing a command line login. The SDDM login was failing to show.

Once logged in, if I waited a while and then pressed any key the SDDM login screen would appear. Username and password to be entered as usual.

Interestingly in the top bar it was the US layout which was selected (no others available).

I also found that entering the wrong password I was returned to the login screen once more, where the gb layout was shown.

Through searches on the Internet I found this reference

https://forum.manjaro.org/t/sddm-very-slow-to-show-up/46361/5

Whilst not my answer, the included reference to this article

https://forum.manjaro.org/t/sddm-not-loading-properly-on-boot/34484

provided the solution.

The recommendation was to add the haveged package.

First install the package: apt get install haveged

Whilst the recommendation was to enable and start haveged:

systemctl enable haveged
systemctl start haveged

I chose to restart the computer to view whether the problem was persisting.

Problem solved! Albeit still with US layout.