Categories
tip

illuminate/contracts[v5.6.0, …, v5.8.36] require php ^7.1.3 -> your php version (8.x) does not satisfy that requirement.

Recently while working on Goform, I was trying to upgrade from Laravel 9 to 10 and this error kept coming up. I had no idea why, I had followed the upgrade guide for Laravel and updated the packages it was telling me to.

The fideloper/proxy package

Turns out, Laravel hasn’t used the fideloper/proxy package for a while (I think since 9.x, but don’t quote me on that).

Here’s how I fixed the issue.

Remove the fideloper/proxy package from your composer.json file:

"require": {
    ...
    // Remove the following line
    "fideloper/proxy": "...",
    ...
}

Clear the composer cache by running composer clear-cache

Update dependencies by running composer upgrade

If you’re still having issues, you can also try removing the vendor directory and composer.lock files before clearing the cache.

Good luck!

Categories
tip Uncategorized WordPress

Branded Error Pages in WordPress

Something that came up on a project I was working on recently is that when WordPress encounters a server error, you will get a generic message.

Default WordPress error screen when the server responds with an HTTP 500 status code.

This is generally okay, it’s not like you’ll be seeing it very often (hopefully) but I wanted to make sure if a user did see one, it wouldn’t feel completely alien to them.

As it turns out, WordPress has a simple solution. Create a file named php-error.php in the wp-content directory.

I created one with the following:

<h1>Woops, it broke ☹️</h1>

Now, the error page will look like this!

A custom PHP Error template in WordPress

It’s essentially an HTML file, so you can hook up your stylesheet, maybe include a brand logo, you have options!

Testing locally

Usually when you’re testing locally you’ll have WP_DEBUG switched on. To test your page, make sure WP_DEBUG is false in your wp-config.php and pop this code somewhere, I usually put it in functions.php but it doesn’t really matter.

<?php

throw new Error('You broke it.');

That’ll make PHP throw an error, as if something had gone wrong and you’ll be able to see your error page.