In this article, I want to address an important issue that some users deal with in installing OJStat. For some reason, out of the application issue, some users could not install OJStat because the setup page went blank while no errors are displayed on the page. The setup page only shows the Instruction but the status of the OJStat Database Table and the Install button are not shown. What we need to make clear at this point is that the issue is not located at the app but in the server configuration. The reason why I confidently said that is because this issue is server-specific; only some users have this issue.

Last night, I got a message from a user that he could not install OJStat because the Setup Page is blank. I asked him to send his OJStat link and when I checked it, yes it's true. I reviewed my browser console and I found that it was an Internal Server Error with code 500. This error can be due to the app as well if there are errors in the script but in most cases, this is caused by the server configuration. If OJStat cannot run in all server with the same error number, then the issue is in the app but if it is server-specific then the issue is in the server itself.

What is Internal Server Error (500)?

The biggest problem in this error is this: the error is not descriptive enough so the users cannot identify the exact problem that they are dealing with. I quote Hubspot:

A 500 internal server error is, as the name implies, a general problem with the website's server. More than likely, this means there's an issue or temporary glitch with the website's programming.

Because this error implies general problem, we do not have any clear clue of the problem. So, we need to do some checks both in the web app and in the server configuration.

Checking the App, OJStat in this case

We need to know if the issue is located in the app. Since OJStat is a PHP web app, we can put the following code right at the top of the file setup/index.php right after the opening PHP tag (<?php) to see what error we are encountering:

ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL);

The code above will enable the app to show if errors have occured when the page loads. In case that no error is displayed, we can test installing OJStat in different server or domain. Basically, OJStat has been tested in different domains and servers and it works perfectly. Based on the test, we do not find any errors with the app. Therefore, we can continue to check the server.

Checking the Server

The potential issue regarding this error include but not limited to:

  1. Corrupted or broken .htaccess file,
  2. Permission error,
  3. Faulty third-party plugins or themes (this one has been discussed above), and
  4. The PHP memory limit being exceeded

Now, let's see what we can do to resolve this issue.

.htaccess file

I quote Cloudways:

In many cases, rules in the .htaccess file can also cause 500 Internal Server Error. This is generally caused by rules that point to modules that are not installed/available at the Apache server. Another scenario involves recursive rewrite rules that can end up in a 500 Internal Server error.

Based on the information above, we may need to review the .htaccess file and set it the correct way, the way that gives permissions to the app to run as expected.

Permission

The server may by default block several PHP functions used in the app. This can be reviewed on PHP.INI file especially in disable_functions directive. Review this file if you want to use OJStat.

Another thing that we need to do is to set permission to OJStat folder and its subfolders by changing the file permissions in the cPanel File Manager.

Memory Limit

In most cases, this is the issue. In OJStat Setup, several functions are executed recursively to check the database structure. This may consume the memory (just like in OJS installation). When the memory limit is reached, 500 Internal Server Error occurs. I quote Cloudways:

PHP libraries require a memory limit for the successful execution of PHP scripts. Increasing the available PHP memory limit from the Server and Packages tab can also fix the 500 Internal Server error. If you have defined a memory limit in the application configuration files, simply increase the value in these files. Changing the PHP memory limit will also help you avoid the “Allowed memory size” error.

Therefore, it is important to increase the Memory Limit by setting its limit in the PHP.INI file. Check the directive below and set the value to the one suggested or higher:

memory_limit = 256M

Last, clear the browser cache and cookies, refresh the page, and if the error persists, contact the server admin.

Whenever OJStat or any other web app is expected to run, we need to correctly configure the server. By correct here I mean the configuration that allows the app to run. Disabling the app while expecting it to run is the same with asking a trusted friend to enter the house while we keep locking the the door.

Of course, the server security is of the most important part we need to take into account, but nothing to worry with the app you know safe, like OJStat.