Getting Started Technical Problems with WordPress Integration

Technical Problems with WordPress Integration

You are using an obsolete PHP version

This is what the user sees

 

obsolete_php.png

 

Reason

The older PHP version that does not support new programming language capabilities used in one of the libraries. 

 

Solution

Update PHP. Currently, the minimum allowable version for our plugin is PHP 5.5.9. WordPress developers recommend using PHP 7.

Version 5.5 is too old, it was released in 2013, and critical vulnerabilities are not secured in it. The life cycle of versions is available here.

PHP version update is usually available as an option in your hosting provider control panel (Cpanel, ISPManager and others). It takes a few minutes and should not affect your website performance. Nonetheless, you can back up to the previous PHP version if something goes wrong.

You can find a detailed instructions on PHP version update from the major Wordpress platforms below:

BluehostDreamhostSiteground, IPageHostgator, 1&1, Ehost, MediaTemple, GoDaddy, Pagely.

If you can’t find your provider in this row, please, contact your web hosting customer support or system administrator.

After updating the PHP version deactivate Setka Editor plugin and activate it again.

  

The plugin files were partially downloaded 

When the plugin is not fully downloaded (i.e. when not all plugin files were copied to the server), errors occur in PHP. This happens if someone uploaded FTP manually and the connection was lost.

 

This is what the user sees

In most cases, the user will see a white page with or without errors. An error message can be seen if WP_DEBUG is active (you will get a simple white page without it) or if you look into error.log on the server (full address to the file depends on the server configuration), provided this log is enabled in web server settings.

Warning: include(/var/www/wordpress/htdocs/1/wp-content/plugins/setka-editor/source/Plugin.php): failed to open stream: No such file or directory in /var/www/wordpress/htdocs/1/wp-content/plugins/setka-editor/vendor/composer/ClassLoader.php on line 412

Warning: include(): Failed opening '/var/www/wordpress/htdocs/1/wp-content/plugins/setka-editor/source/Plugin.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/wordpress/htdocs/1/wp-content/plugins/setka-editor/vendor/composer/ClassLoader.php on line 412

Fatal error: Class 'Setka\Editor\Plugin' not found in /var/www/wordpress/htdocs/1/wp-content/plugins/setka-editor/plugin.php on line 30

Reason

Some files were either not downloaded or deleted. Another possible reason is that some files have incorrect content (for example, someone edited them manually and deleted their content).

Solution

Delete the plugin completely. If some files are missing, you will not be able to do that via the plugins control panel since when deleting a plugin, we use some of the files to delete plugin settings.


If the plugin cannot be deleted via the control panel, then simply delete the plugin’s folder from the server via FTP (SFTP or SSH) and then upload the latest version of the plugin again. You can upload a new version of the plugin in any convenient way, via the control panel or simply via FTP.

 

The uploaded file exceeds the permitted size

 

Screen_Shot_2017-04-14_at_17.40.23.png

 

This is what the user sees

When trying to upload the plugin via the WordPress administrator’s panel, you see the page with a message.

Note: this screenshot with the text are from WordPress 4.7, the error message looks differently in older versions.

Are you sure you want to do this?

Please try again.

Solution

Check the maximum upload file size settings. The easiest way to do that is to go to the Upload New Media page. The maximum upload file size will be specified at the very bottom of the page. For example: "Maximum upload file size: 3 MB.".

The maximum file size must be larger than that of the ZIP archive with the plugin.

In order to change this setting, contact the hosting’s technical support and ask them to increase the size of files allowed for uploading (for example, up to 20 Mb).

In the cases where a member of technical support does not know what to do or you would like to make changes on your own, find the php.ini file and make two changes. The php.ini file is usually located in /etc/php/apache2/php.ini (however, it can be located somewhere else depending on the server’s operating system and its configuration).

Two settings need to be changed in the file. They can have various values but post_max_size must not be less than upload_max_filesize. You can set any number, for example, 1024M (gigabyte).

Note: after making changes in the file, restart the web server or PHP-FPM (depending on the server’s configuration) for new settings to come into effect. If everything was done correctly, then you will see a different value on the Upload New Media page.

Sometimes, these settings can be specified several times in various locations (for example, in the .htaccess file or other PHP configurations) and values can be rewritten from php.ini. This setting can also be redefined by some of WordPress plugins or even a theme (although, it is highly unlikely).

upload_max_filesize = 3M

post_max_size = 3M

 

 

Inactive settings page

This is what the user sees

One of the settings pages of our plugin cannot be opened/accessed.

Reason

Such problem occurs when using HHVM and its settings.

Solution

Add the line below to the HHVM configuration.

hhvm.libxml.ext_entity_whitelist = file,http 

A more detailed description and discussion of the problem is available here.

 

Wp-admin is blocked

This is what the user sees

Updates for styles are not delivered. New themes do not appear. The editor stopped working. The plugin shows that the subscription expired and the editor cannot be opened.

Reason

Setka’s API failed to deliver updates to the site with updated CSS and JS files, as well as to update information on the subscription renewal. This can occur for several reasons:

  • When API accessed the site, the server was unavailable (switched off, heavily loaded, no Internet access) or malfunctioning.
  • Access to the wp-admin/admin-post.php file was blocked from the server’s side or by WordPress.
  • The plugin version used now is too old and not supported by the current Setka’s API.
  • Domain name you entered is incorrect. Make sure, that link to your domain name is actual. If your website works on https://, make sure, that URL starts with https://

Solution

Check with the hosting’s technical support whether a network firewall is active or other access restrictions to the wp-admin/admin-post.php file are enabled. External connections to this file must be permitted for everything to work fine.

Plugins can also block access. For example, some plugins restrict access to files in the wp-admin folder if the user is not authorized. Lockdown WP Admin is one of such plugins.

POST queries to the wp-admin/admin-post.php file must be permitted (also preferable GET, PUT, etc.).

A more detailed description of this file and its queries is available in the WordPress codex.  

In order to check the possibility to connect manually, please open the http://your-domain.com/wp-admin/admin-post.php page, having specified your domain. If the web-inspector on the Resources tab at the Request & Response section reads ‘Status OK, Code 200,’ then everything is most likely fine.

 

Installed Lockdown WP admin plugin

It is a special case of the problem described above, but the Lockdown plugin is used by many users, that’s why we examine this case separately.

Solution

Write the following code in any other plugin, theme, or mu-plugin.


function lockdown_wp_admin_no_check_files_2016_12_29($files) {
   $files[] = 'admin-post.php';
   return $files;
}
add_filter('no_check_files', 'lockdown_wp_admin_no_check_files_2016_12_29');

Check the code’s functionality by opening the example.com/wp-admin/admin-post.php page. If a white page opens up, then everything works fine. If you see the 404 page with a site, then the code did not work. Perhaps, you added it to the file that was not connected to WordPress.

 

Styles and fonts do not work

This is the user sees

When viewing the site outside CMS, you can see that makeup of posts ‘falls apart’ and all elements from the Setka Editor have no styles (i.e. a post looks like a simple text).

Reason

All CSS and JS files in the theme were not activated according to the common WP practice, hence third-party plugins cannot add or remove the necessary files.

Solution

There are two solutions to this problem:

  • Correct the CSS and JS files connection logic inside the theme according to WordPress developers’ recommendations. This approach allows achieving the same result as what we have now, i.e. this approach does not impose technical restrictions. Remove all hard-connected CSS and JS files inside the raw_header.php file (usually, files of such type in themes are named ‘header.php’), and remove all logic for their addition to separate files. Add the call of the wp_head()function inside the <head> section.
  • If you do not want to rewrite a theme, then activate CSS from the Setka Editor manually. There are two ways to do this, however, we did it as described below on the test site. We created an additional file called ‘setka-editor-resources.php.’ It is connected to raw-header.php. Contents of the file with comments are given below.


Note 1. The method described below enables only a CSS file. In order to enable TypeKit fonts and such, it is necessary to enable their JS in a similar manner (currently, the Paper does not use TypeKit, that’s why the example does not have it).


<?
php
// Added by Setka Editor team
function setka_editor_print_head_resources() {
   global $wp_styles;
// Checking if there is an enabled Setka Editor plugin
  // And the function that we want to call as well
  if( !is_callable( array( '\Setka\Editor\Service\ScriptStyles', 'register' ) ) )
      return;
  // Calling for the registration of necessary CSS and JS for the Setka Editor
  // Usually, WP does this when calling for wp_head() (mentioned above)
  \Setka\Editor\Service\ScriptStyles::register();
  \Setka\Editor\Service\ScriptStyles::register_theme_resources();
// Checking if there is a CSS file that we need and displaying its 
  if( isset( $wp_styles->registered['setka-editor-theme-resources'] ) ) {
      $url =& $wp_styles->registered['setka-editor-theme-resources']->src;
      ?><?php
  }
}
setka_editor_print_head_resources(); // Immediately calling for the function

Note 2. A link to CSS is stored in the setka_editor_theme_resource_css option. It can be acquired manually by means of get_option('setka_editor_theme_resource_css').


// Prior to the call, it is recommended to check if the class for prevention of fatal errors in PHP exists
$css = new Setka\Editor\Admin\Options\ThemeResourceCSS\Option();
// Returns only one type of data (if there is no link, then an empty line will be returned)
$url = $css->getValue();
// or (false can be returned if there is no value)
$url = $css->getValueRaw();