WordPress theme timeout

WordPress Theme Expired Link 

A very common issue when setting up a WordPress website for the first time is running into issues with trying to manually upload a custom theme. You select your the file, click upload and then you get an ambiguous error message saying the link has expired, so you try it again and you get the same error.

Now what is actually happening under the hood is that the upload size for PHP is set to 2Mb by default and the nice theme you are trying to install exceeds that limit. You can see the file size upload limit by visiting the Media » Add New page.

Option 1 .htaccess

You are going to need to edit the .htaccess file that is located in the root folder of your word press site for example /usr/www/example/.htaccess

Type sudo nano /usr/www/example/.htaccess and add the following to the bottom of the file before pressing Ctrl+X to exit and Y to save.

php_value post_max_size 128M
php_value max_execution_time 300
php_value max_input_time 300

Restart the server and verify the change has worked by visiting the Media » Add New page


Option 2 php.ini

The php.ini file is a configuration file used by PHP and WordPress. You need to edit this file which is located in /etc/php/8.1/apache2/php.ini bearing in mind this file path will be different depend of the version of PHP you are running and if you are using Apache or Nginx

Type Sudo nano /etc/php/8.1/apache2/php.ini and in the file you need to find the below settings and change the values.

upload_max_filesize = 128M
post_max_size = 128M
max_execution_time = 300

Restart the server and verify the change has worked by visiting the Media » Add New page