Posts

WordPress shows white page after site move

WordPress just showing a white page means it is experienceing PHP errors. When it occurs after a site has been moved from one hosting to another it can be caused by several reasons.

To make it possible to track down the cause you can temporarily add the following to the .htaccess file in the root. If this gives you a internal server error 500 it means it is not allowed by the host. If allowed, you will get error messages from PHP dispayed on screen when accessing the site:

php_flag display_startup_errors on
php_flag display_errors on

There are visbible PHP ending tags ?> on the site

If you see more or less normal output from the site but once in a while you see lines ending with ?>. This can happen if the site has been running on PHP 5 where the short PHP start tag <? is allowed (instead of the longer <?php.

If the site has been moved to PHP 7 where this is not longer allowed, it can cause this kind of strange behaviour.

If you don’t want to go through all the code and find all the occurrences of <? and replace them with <?php (which is one solution), you can simply add the following to your php.ini:

short_open_tag=On

You need to restart Apache after this.

Wordfence plugin is installed

You need to manually edit the system specific paths in the following files:

  • .user.ini in the site root, change the path after auto_prepend_file
  • wordfence-waf.php in the site root, change the paths on all occurrences

WP Rocket plugin is installed

The file wp-content/advanced-cache.php contains system specific paths. You can manually update them or just simply delete the file and login to wp-admin of the site and it will be recreated automatically with the correct paths.

Error 404 when trying to password protect administrator folder in Joomla using Apache htaccess

When protecting the administrator folder in Joomla using Apache htaccess to increase the security of the website (which by the way is a good thing to do to prevent too interested individuals to peek where they shouldn’t), you might get an error 404 message when trying to access administrator and the expected password prompt never appears.

The cause can be that the server is configured to allow user defined error pages stored in for example the error folder. If some of the error files are missing the above mentioned problem can occur. Make sure you have the correct folder name and file names for your error files.

This particular problem occured for me when I moved a Joomla site from one hosting provider to another and by mistake also replaced the error folder with the one from the old hosting provider which had a completely different file name structure for the error message files.

Err 310 ERR_TOO_MANY_REDIRECTS in Chrome and Firefox using Apache’s mod_rewrite

I used Apache’s mod_rewrite in order to direct a couple of domains pointing to the same website using the 301 moved permanently (to avoid duplicate content), i.e. something like this in .htaccess: 

RewriteEngine On
RewriteCond %{HTTP_HOST} !^example\.com$
RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]

I randomly got the error message 310 ERR_TOO_MANY_REDIRECTS when trying the different domains in both Chrome and Firefox (other browsers seemd to work). I had decided my site should be reached without "www", so http://www.example.com was redirected to http://example.com also. 

After a while of head scratching I found a couple of forgotten DNS entries. Two of them where outdated. My domain setup for example.com in DNS looked like this (sample IP-addresses): 

example.com zone:

@  IN  A  192.168.100.1
@  IN  A  192.168.100.2
@  IN  A  192.168.100.3

www  IN  A  192.168.100.1

But only 192.168.100.1 was valid and had a running web server on it.

I guess what happens is when Chrome/Firefox tries to talk to 192.168.100.2 or .3 and get no response, they add "www" in front of the domain name, i.e. http://www.example.com. Now it got a response from the webserver saying 301 redirect to http://example.com. Now trying to talk to example.com on 192.168.100.2 or .3 no response, adding "www" and there we have our loop.

Fixing the DNS entries (removed the invalid 192.168.100.2 and .3) fixed the problem. A bit odd and hard to find, and most of all stupid to have the outdated records still in the zone. 

 

PrestaShop module TECHNICAL ERROR

On a PrestaShop 1.3.2.3 installation I purchased the One Page Checkout 1.2.2 and installed it. After that I got the following error message when trying to add a product to the basket in the shop front end: TECHNICAL ERROR: unable to add the product.

Details:
Error thrown: [object XMLHttpRequest]
Text status: parserror

Solution: The reason is the web server is running in SAFE MODE and the user owning all the PrestaShop files is the FTP user I use to upload the shop. When installing the One Page Checkout module it will be owned by the user running the web server process (in my case www-data:www-data). In SAFE MODE a php script is not allowed to execute a script owned by another user. The solution is to set the owner of all the order-files in the PrestaShop directory to my FTP-user (including the files installed by the OPC module). In a shell this is simply done by the chmod command: cd prestashop-installation-dir chown -R my-user:my-group order* (Replace prestashop-installation-dir with the real path where PrestaShop is installed and my-user:my-group to the userid:grouid owning the rest of the files in the Prestashop installation.)

TYPO3 cms installation fails in step 2

If you are installing the TYPO3 content management system (CMS), after uploading the files to your web server and setting some directory permissions, you are supposed to point your browser to your web server’s root where you just have installed TYPO3 in order to continue the installation. A screen similar to this is displayed:

TYPO3 installation step 1

Click to enlarge

Enter database username, password and server (normally “localhost”) and click continue. If the following screen (as step 2) is displayed, you are in trouble:

TYPO3 installation step 2

Click to enlarge

This screen is supposed to show you the availible databases for selection. But as you can see it ends just below the word “Database”. No error message is displayed.

The reason for this is that PHP is running in Safe mode. By configuring your webserver/PHP to run with Safe mode off the installation will work.

This situation is actually described in the TYPO3 Wiki under troubleshooting saying “This could cause the Install Tool to display an error message”. In my case it didn’t and it took some time of head scratching to figure it out.