I recently switched my hosting provider to 1&1 IONOS Shared Hosting. I couldn’t find anywhere else that came close to the features offered for the price that this hosting company was offering. (I mean, $24 and I was able to not only move to a host that has SSH and SSL capabilities but, I was also able to buy up several more domain names to boot!)
Anyway, long story short, after migrating my site files and databases, I was left without the necessary PHP 7.3 modules to efficiently run a self-managed Drupal installation. Namely, I was missing the OPcache and Upload Progress modules.
Setting Up the OPcache Module
1&1 IONOS Hosting already has an excellent guide on how to setup OPcahce located at: https://www.ionos.com/community/hosting/php/php-7-opcache-speed-up-websites-noticeably/
However, here is a short summary of the steps needed to enable the OPcache module:
- Create a directory to hold the cached files
IMPORTANT – Ensure the directory name starts with a period so that it is automatically protected by the Apache web server. (e.g. .opcache)
- Determine the absolute path to the directory by logging in via SSH, changing to the directory, and then issuing the command pwd
- Create or edit your php.ini file in the root directory of the your webspace to include the absolute path to the cache directory you previously created:
-
zend_extension=opcache.so; opcache.enable=1; opcache.memory_consumption=32; opcache.interned_strings_buffer=8; opcache.max_accelerated_files=3000; opcache.revalidate_freq=180; opcache.fast_shutdown=0; opcache.enable_cli=0; opcache.revalidate_path=0; opcache.validate_timestamps=2; opcache.max_file_size=0; opcache.file_cache=***absolute path to opcache directory***; opcache.file_cache_only=1;
-
- Check that OPcache is enabled and active on your site by creating a phpinfo.php file or navigating to the cache directory you created and checking that files are being created
Setting Up the Upload Progress Module
The Upload Progress module is a little harder to setup as it is not installed on the server by default, unlike the OPcache module. So, we have to obtain or create our own module file and then upload it to the server. If you know how to compile your own module and wish to do so, feel free to but, this section will not cover compiling the module. Instead, we’ll opt for downloading a pre-compiled binary.
First, we will need to know the version of Linux that the serve is running. Log into the server via SSH and issue the command lsb_release -a. You should receive similar output to the following:
No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux 8.11 (jessie) Release: 8.11 Codename: jessie
Here we can see that the server is running the Jessie release of Debian. Our next step is to find out if we are on a 32-bit or a 64-bit system. To do this, issue the command uname -a. You should see output similar to the following:
Linux infong789 3.16.0-ui18276.29-uiabi1-infong-amd64 #1 SMP Debian 3.16.59-1~ui80+1 (2018-10-03) x86_64 GNU/Linux
At the end of the output, you’ll see x86_64 if you are on a 64-bit system. Otherwise, assume that the system is 32-bit.
Now that we know what release we are on and the architecture of the system, we need to find a pre-compiled version of the Upload Progress module’s binary file (uploadprogress.so) located at: http://ftp.debian.org/debian/pool/main/p/php-uploadprogress/
Here, you may need to do a little guess work as to which version of the file to download. I simply took the latest *amd64.deb file I could find as my server is a 64-bit system. Download the file somewhere locally and then extract it’s contents using an archive manager of your choice. Next, extract the resulting data.tar.xz file. Navigate to the resulting ./usr/lib/php/ directory. Here you will find directories named with dates of the PHP build. I believe, you should try to select the directory that matches your server’s PHP build date. However, I simply selected the latest directory since I could not find an exact match and the server currently has the latest version of PHP enabled.
Inside the directory you will find the needed uploadprogress.so file. Create a new directory on your server that begins with a period and then upload the file to the directory.
IMPORTANT – Ensure the directory name starts with a period so that it is automatically protected by the Apache web server. (e.g. .extensions)
Now that we have our module’s file uploaded, it is time to enable it. First, find the absolute path to the module file we just uploaded by using the command pwd while in the directory you created.
Create or edit your php.ini file located in the root of your server’s webspace. Add the following line to the file:
extension=/***absolute path to directory***/uploadprogress.so
Check that the Upload Progress module is now enabled by creating a phpinfo.php file in the root of your webspace directory with the contents:
<? echo phpinfo(); ?>
Navigate to the phpinfo.php file using your web browser and ensure the Upload Progress module is listed.
IMPORTANT Be sure to delete the phpinfo.php file once you have confirmed the Upload Progress module has been successfully loaded by the server.
Final Comments
That’s it! You should now have a fully operational OPcache module with the Upload Progress module being loaded as well. If you do not, ensure that your paths are correct and that the php.ini file is not being deleted by the server. (Mine was deleted a couple of times for unknown reasons before it finally stuck.)
Good luck and thanks for reading!
Comments are closed.