Unfortunately I was not ready so good as you could, and spent the couple of hours digging Internet to find the right decision for 3 little problems I met after my computer with updated operating system successfully rebooted. The 3 problem, little but critical, as anyone could stop your work as a Web developer.
It would be honest to say, that the troubles, which I will describe in this post, are not related neither to the operating system Ubuntu itself, nor to its version upgrade process. There are no bugs and no crashes. I may talk about my case of course.
You will meet the real problems in case you are the developer and have Apache/PHP installed at your desktop/server with a lot of virtual web servers defined. Add our popular and lovely WordPress here. Otherwise all update process took, of course, some time, but was fulfilled smoothly and without any headache.
Problem 1st: Ubuntu 13.10 – where are all my Apache’s virtual hosts?
Loading Ubuntu 13.10 1st time you will wonder that all your virtual hosts defined at /etc/apache2/sites-available
were disappeared. No, do not fear, all configuration files are in place. You just get 404 error when trying to load any usual working URL from your localhost. The reason is Ubuntu 13.10 replaces Apache version 2.2 to version 2.4. Apache 2.4 was configured that way, as it requires every site or virtual host configuration file has the .conf
extension. So the decision is simple:
1) rename al your configuration files at /etc/apache2/sites-available
to the files with .conf
extension.
2) re-enable them with sudo a2ensite <conf-file-name>
command.
Sources of the information:
– Virtual Host Issues When Upgrading from Apache 2.2 to 2.4;
– Virtual host on ubuntu 13.10 and apache 2.4.6.
Assume You resolved the 1st problem successfully. Congratulations! HTML error 404 was gone. But what the …?! Where is my development site? Why do I see this “Forbidden. You don’t have permission to access / on this server. Apache/2.4.6 (Ubuntu) Server at test.localhost Port 80”? message instead?
We come to the 2nd problem here.
Problem 2nd: Ubuntu 13.10 – why did I lose access to my localhost sites?
After update from Apache 2.2 to Apache 2.4 you will lose access to all sites defined for your Apache. Why? The reason is the differences between Apache’s version 2.2 and 2.4 Access Control directives. If Apache 2.2 used the “Order, Allow, Deny, and Satisfy” directives, version 2.4 uses the other “Require” directive syntax.
In short, look the quote from the Apache’s documentation:
Here are some examples of old and new ways to do the same access control.
In this example, all requests are denied.
2.2 configuration:
Order deny,allow
Deny from all
2.4 configuration:
Require all denied
In this example, all requests are allowed.
2.2 configuration:
Order allow,deny
Allow from all
2.4 configuration:
Require all granted
In the following example, all hosts in the example.org domain are allowed access; all other hosts are denied access.
2.2 configuration:
Order Deny,Allow
Deny from all
Allow from example.org
2.4 configuration:
Require host example.org
Sources of the information:
– Upgrading Apache to 2.4 from 2.2;
– Ubuntu Server, Apache 2.4.6 -> client denied by server configuration.
The problem decision is to replace all 2.2’s
Order allow,deny
Allow from all
at your virtual hosts configurations files
to the 2.4’s directive
Require all granted
It will resolve the issue for the localhost. For production server you should select appropriate value according to the security level needed of course.
Problem 3rd: Ubuntu 13.10, PHP 5.5.3 and WordPress.
Did you as the WordPress developer set WP_DEBUG
constant to true
define('WP_DEBUG', 1); |
for all your development WordPress installations? If you did not, think about it. You are really should, as you will see all errors and notices produced by themes, plugins, your mistakes, etc.
So, after updating PHP to version 5.5+ WordPress started show this warning:
Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /.../wp-includes/wp-db.php on line 1142
It is time to say bye to our old friend mysql
extension. PHP developers offers to switch on the mysqli
or PDO
instead a year or more ago. They declare mysql
as deprecated at the PHP documentation 1st,
then PHP 5.5 came to us with the real deprecation message noted above.
I said myself:
– Stop, guy. It’s could not be, as it’s never could not be. WordPress developers should do with it something already, really.
Searching the Internet leads me to this discussion thread “Use PDO or mysqli for MySQL queries when available” started more than 15 months ago. Core WordPress development team members are involved. And if in short, good news – WordPress will be switch to PDO in nearest future.
But what to do now? As the developer I should have all those PHP warnings and notices turned ON. But it is really bad to see mysql extension deprecation message with every new WordPress page load. The decision is made by the real time saver – Marko Heijnen. It is the “MySQLi database layer” WordPress plugin.
This plugin does the only thing – it copies file db.php
from the plugin’s folder to the wp-content
folder when you activate it, and deletes that file, when you deactivate it. So I did not install the plugin, but copied db.php
file to the right place manually. It works like a charm, in fully transparent manner, replacing global $wpdb
object to the class inherited from the WordPress’s wpdb
object and replaces all mysql
extension calls with the correspondent mysqli
extension calls. Thanks, Mark, for this excellent code, released just in time.
Valuable minute addition. After the couple of days as I wrote this post I discovered that fresh updated PHP 5.5.3 does not contain JSON extension. As the result you get this error message:
Fatal error: Call to undefined function Composer\Json\json_decode()
Fix is simple. Just execute this command:
sudo apt-get install php5-json
and restart Apache.
Do other surprises wait their time to be discovered? How do you think?