SENS will be upgrading all web servers running the CentOS 6 Linux distribution. The new operating system on these servers will be Ubuntu 20.04, another distribution of Linux with wide usage and support.
As part of the upgrade, the following software tools used by web developers will change:
| Software | Old Version | New Version | Resources |
|---|---|---|---|
| Apache Web Server | 2.2.15 | 2.4.41 | Upgrading to 2.4 from 2.2 |
| MySQL | 5.5.62 | MariaDB 10.3 | Upgrading from MariaDB 5.5 to MariaDB 10.0 |
| PHP | 5.3.3 | 7.4.3 | Migrating from PHP 5.6.x to PHP 7.0.x |
| Perl | 5.10.1 | 5.30.0 | Perl 5 version history |
The following sections will note some of the common issues that have been found in upgrading web software to these new versions.
Contributions to this document are welcomed and appreciated, as they will help other web programmers.
There are not a lot of user-side changes that need to be made when upgrading from Apache 2.2 to 2.4, but what follows are some to keep in your awareness.
If you have a ".htaccess" file that uses directives such as:
Order allow,deny Allow from all
They will need to change to something like:
Require all granted
See this document for more details.
If you have a ".htaccess" file that uses directives to enable network address access and/or password access such as:
Order deny,allow
Deny from all
Allow from 127.0.0.1 128.205. .buffalo.edu
AuthName "Restricted Access"
AuthType Basic
AuthUserFile /some/path/to/.htusers
Require valid-user
You will need to rewrite it as something like:
<RequireAll>
<RequireAny>
Require local
Require ip 128.205.0.0/16
Require host .buffalo.edu
</RequireAny>
AuthName "Restricted Access"
AuthType Basic
AuthUserFile /some/path/to/.htusers
Require valid-user
</RequireAll>
You can let the old code coexist with the new code by using something like this:
<IfVersion >= 2.3>
<RequireAll>
<RequireAny>
Require local
Require ip 128.205.0.0/16
Require host .buffalo.edu
</RequireAny>
AuthName "Restricted Access"
AuthType Basic
AuthUserFile /some/path/to/.htusers
Require valid-user
</RequireAll>
</IfVersion>
<IfVersion < 2.3>
Order deny,allow
Deny from all
Allow from 127.0.0.1 128.205. .buffalo.edu
AuthName "Restricted Access"
AuthType Basic
AuthUserFile /some/path/to/.htusers
Require valid-user
</IfVersion>
There are several documents here that may be helpful when upgrading from MySQL 5.5 to MariaDB 10.3 on this page: MariaDB versus MySQL - Features
In particular, these might be useful:
This section details some of the PHP code changes that need to be made when moving from a server with PHP 5.x to PHP 7.x.
If you have something like:
if (ereg('myname', $input)) {
Replace it with:
if (preg_match('/myname/', $input)) {
Note the following in addition to replacing the function name "ereg" with "preg_match":
ereg('hello/world', $input)
becomes:
preg_match('/hello\/world/', $input)
For eregi(), follow the same steps as above, but add the modifier "i" after the closing slash delimiter:
preg_match('/hello\/world/i', $input)
For ereg_replace(), replace it with preg_replace() and modify the pattern in the same way as described above.
A reference can be found here: https://www.php.net/manual/en/pcre.pattern.php
If you have something like:
while (list($key, $value) = each($input)) {
Replace it with:
foreach($input as $key => $value) {
There are two extensions that can be used in place of MySQL: MySQLi and PDO.
Here is a page that shows how to convert mysql*() functions to mysqli*() functions: https://dzone.com/articles/convert-mysql-to-mysqli
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP.
This can be fixed by changing code like this:
class FooBar {
public function FooBar($something) {
...
}
}
To something like this:
class FooBar {
public function __construct($something) {
...
}
public function FooBar($something) {
self::__construct($something);
}
}
Perl tries hard to stay backward-compatible. However, there are many changes between 5.10 and 5.30, some of which are new features that may help with existing code.
The module "CGI.pm" was removed in version 5.22. Programs using it will have to be recoded, or we can manually install this module if too many things break.
The include path, @INC, no longer contains "." (the current working directory) by default, for security reasons.
$* is a global variable that causes multi-line matching to be used by default by regex operations. It is no longer available in newer versions of Perl - instead, the /m and /s regex flags should be used.