{"id":498,"date":"2019-01-14T17:46:14","date_gmt":"2019-01-14T23:46:14","guid":{"rendered":"http:\/\/csmartsolutions.net\/blog\/?p=498"},"modified":"2019-01-15T05:45:12","modified_gmt":"2019-01-15T11:45:12","slug":"enable-upload-progress-and-opcache-modules-for-php-7-3-on-1and1-shared-hosting","status":"publish","type":"post","link":"http:\/\/csmartonline.com\/blog\/2019\/01\/14\/enable-upload-progress-and-opcache-modules-for-php-7-3-on-1and1-shared-hosting\/","title":{"rendered":"Enable Upload Progress and OPcache Modules for PHP 7.3 on 1and1 Shared Hosting"},"content":{"rendered":"<p>I recently switched my hosting provider to 1&amp;1 IONOS Shared Hosting. I couldn&#8217;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!)<\/p>\n<p>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.<\/p>\n<h3>Setting Up the OPcache Module<\/h3>\n<p>1&amp;1 IONOS Hosting already has an excellent guide on how to setup OPcahce located at:\u00a0<a href=\"https:\/\/www.ionos.com\/community\/hosting\/php\/php-7-opcache-speed-up-websites-noticeably\/\">https:\/\/www.ionos.com\/community\/hosting\/php\/php-7-opcache-speed-up-websites-noticeably\/<\/a><\/p>\n<p>However, here is a short summary of the steps needed to enable the OPcache module:<\/p>\n<ul>\n<li>Create a directory to hold the cached files\n<ul>\n<li style=\"list-style-type: none;\"><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p style=\"padding-left: 60px;\"><span style=\"color: #ff0000;\"><strong>IMPORTANT<\/strong><\/span>\u00a0&#8211; Ensure the directory name starts with a period so that it is automatically protected by the Apache web server. (e.g. .opcache)<\/p>\n<ul>\n<li>Determine the absolute path to the directory by logging in via SSH, changing to the directory, and then issuing the command <strong>pwd<\/strong><\/li>\n<li>Create or edit your <strong>php.ini<\/strong>\u00a0file in the root directory of the your webspace to include the absolute path to the cache directory you previously created:\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li style=\"list-style-type: none;\"><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<ul>\n<li style=\"list-style-type: none;\">\n<pre class=\"snippet-code\">\r\nzend_extension=opcache.so;\r\nopcache.enable=1;\r\nopcache.memory_consumption=32;\r\nopcache.interned_strings_buffer=8;\r\nopcache.max_accelerated_files=3000;\r\nopcache.revalidate_freq=180;\r\nopcache.fast_shutdown=0;\r\nopcache.enable_cli=0;\r\nopcache.revalidate_path=0;\r\nopcache.validate_timestamps=2;\r\nopcache.max_file_size=0;\r\nopcache.file_cache=***absolute path to opcache directory***;\r\nopcache.file_cache_only=1;\r\n<\/pre>\n<\/li>\n<\/ul>\n<\/li>\n<li>Check that OPcache is enabled and active on your site by creating a <strong>phpinfo.php<\/strong> file or navigating to the cache directory you created and checking that files are being created<\/li>\n<\/ul>\n<h3>Setting Up the Upload Progress Module<\/h3>\n<p>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&#8217;ll opt for downloading a pre-compiled binary.<\/p>\n<p>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 <strong>lsb_release -a<\/strong>. You should receive similar output to the following:<\/p>\n<pre class=\"snippet-code\">\r\nNo LSB modules are available.\r\nDistributor ID: Debian\r\nDescription: Debian GNU\/Linux 8.11 (jessie)\r\nRelease: 8.11\r\nCodename: jessie\r\n<\/pre>\n<p>Here we can see that the server is running the <strong>Jessie<\/strong> release of <strong>Debian<\/strong>. Our next step is to find out if we are on a <strong>32-bit<\/strong> or a\u00a0<strong>64-bit<\/strong> system. To do this, issue the command <strong>uname -a<\/strong>. You should see output similar to the following:<\/p>\n<pre class=\"snippet-code\">\r\nLinux 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\r\n<\/pre>\n<p>At the end of the output, you&#8217;ll see\u00a0<strong>x86_64<\/strong> if you are on a <strong>64-bit<\/strong> system. Otherwise, assume that the system is <strong>32-bit<\/strong>.<\/p>\n<p>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&#8217;s binary file (<strong>uploadprogress.so<\/strong>) located at:\u00a0<a href=\"http:\/\/ftp.debian.org\/debian\/pool\/main\/p\/php-uploadprogress\/\">http:\/\/ftp.debian.org\/debian\/pool\/main\/p\/php-uploadprogress\/<\/a><\/p>\n<p>Here, you may need to do a little guess work as to which version of the file to download. I simply took the latest\u00a0<strong>*amd64.deb<\/strong>\u00a0file I could find as my server is a <strong>64-bit<\/strong> system. Download the file somewhere locally\u00a0 and then extract it&#8217;s contents using an archive manager of your choice. Next, extract the resulting\u00a0<strong>data.tar.xz<\/strong> file. Navigate to the resulting .\/<strong>usr\/lib\/php\/<\/strong>\u00a0directory. 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&#8217;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.<\/p>\n<p>Inside the directory you will find the needed\u00a0<strong>uploadprogress.so<\/strong> file. Create a new directory on your server that begins with a period and then upload the file to the directory.<\/p>\n<p style=\"padding-left: 30px;\"><span style=\"color: #ff0000;\"><strong>IMPORTANT<\/strong><\/span>\u00a0&#8211; Ensure the directory name starts with a period so that it is automatically protected by the Apache web server.\u00a0(e.g.\u00a0.extensions)<\/p>\n<p>Now that we have our module&#8217;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\u00a0<strong>pwd<\/strong> while in the directory you created.<\/p>\n<p>Create or edit your\u00a0<strong>php.ini<\/strong> file located in the root of your server&#8217;s webspace. Add the following line to the file:<\/p>\n<pre class=\"snippet-code\">\r\nextension=\/***absolute path to directory***\/uploadprogress.so\r\n<\/pre>\n<p>Check that the Upload Progress module is now enabled by creating a <strong>phpinfo.php<\/strong> file in the root of your webspace directory with the contents:<\/p>\n<pre class=\"snippet-code\">\r\n&lt;?\r\necho phpinfo();\r\n?&gt;\r\n<\/pre>\n<p>Navigate to the <strong>phpinfo.php<\/strong> file using your web browser and ensure the Upload Progress module is listed.<\/p>\n<p style=\"padding-left: 30px;\"><span style=\"color: #ff0000;\"><strong>IMPORTANT<\/strong><\/span> Be sure to delete the <strong>phpinfo.php<\/strong> file once you have confirmed the Upload Progress module has been successfully loaded by the server.<\/p>\n<h3>Final Comments<\/h3>\n<p>That&#8217;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 <strong>php.ini<\/strong> file is not being deleted by the server. (Mine was deleted a couple of times for unknown reasons before it finally stuck.)<\/p>\n<p>Good luck and thanks for reading!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I recently switched my hosting provider to 1&amp;1 IONOS Shared Hosting. I couldn&#8217;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 &hellip;<\/p>\n<p class=\"read-more\"><a href=\"http:\/\/csmartonline.com\/blog\/2019\/01\/14\/enable-upload-progress-and-opcache-modules-for-php-7-3-on-1and1-shared-hosting\/\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20],"tags":[128,126,123,124,127,125],"class_list":["post-498","post","type-post","status-publish","format-standard","hentry","category-tiptrick","tag-hosting","tag-module","tag-opcache","tag-php","tag-server","tag-upload-progress"],"_links":{"self":[{"href":"http:\/\/csmartonline.com\/blog\/wp-json\/wp\/v2\/posts\/498","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/csmartonline.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/csmartonline.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/csmartonline.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/csmartonline.com\/blog\/wp-json\/wp\/v2\/comments?post=498"}],"version-history":[{"count":40,"href":"http:\/\/csmartonline.com\/blog\/wp-json\/wp\/v2\/posts\/498\/revisions"}],"predecessor-version":[{"id":541,"href":"http:\/\/csmartonline.com\/blog\/wp-json\/wp\/v2\/posts\/498\/revisions\/541"}],"wp:attachment":[{"href":"http:\/\/csmartonline.com\/blog\/wp-json\/wp\/v2\/media?parent=498"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/csmartonline.com\/blog\/wp-json\/wp\/v2\/categories?post=498"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/csmartonline.com\/blog\/wp-json\/wp\/v2\/tags?post=498"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}