WP errors and their solutions – fatal error

The average user or less technically skilled administrator usually has no problems with WordPress, just clicks happily, installs themes, and adds modules as needed.
Sometimes, however, the PHP gods conspire with FTP daemons, and suddenly, instead of our beautiful website, black text lights up on a white background, succinctly informing us of a bleak future spent over Google: a system error .

In the following article, we will try to deal with the most common of them that you can commonly meet.

WP challenge accepted!

Problem A:

When upgrading to a newer version of WordPress or installing a new WordPress, an error message appears stating:

Warning: Cannot modify header information – headers already sent by (output started at /www/wp-config.php:34)

Solution : As the error message suggests in this case, the problem is in the file and you need to delete spaces, lines, or other stray characters from places where they do not belong. It is especially important to remove everything before the first tag< ? php or after the last tag ?>

This error may affect other files. However, unlike the problem we talked about in the previous part (white screen of death), the message itself will tell us where the problem is.

Problem B:

When you upload a photo or picture, an error message appears stating:

Fatal error: Allowed memory size of 33554432 bytes exhausted

If you need to upload images of similar or larger size on a regular basis, you will need to increase the amount of memory that can be allocated for PHP scripts.

There are several solutions to the problem, choose one of them :

– If you have this option, you can edit the PHP.ini file (a file that specifies the PHP settings on the server; depending on the hosting or access to it via FTP), the following line, in which you can try to override the standard limit of 64M, for example 128M:

memory_limit = 64M; Maximum amount of memory a script may consume (64MB)

– Edit the .httaccess file by adding a line

php_value memory_limit 128M

– Edit the wp-config.php file in the root directory of the WP installation by adding the following lines:

//Zvacsenie limitu pamate na PHP
define('WP_MEMORY_LIMIT', '128M');

– Increase your web hosting settings memory or contact your hosting provider to request an increase.

You can read more about the solution in the WordPress Code .

Problem C:

The ” Call to undefined function ” error message indicates that the module or topic is calling a function that has not been defined anywhere. It most often occurs in the following cases:

  • During an automatic update or installation. Try to do them manually.
  • The module or theme is not compatible with the current version of WordPress or even PHP. This happens when you have an older system and you are trying to activate a new module. In case the module or theme is not compatible with Multisite installation and the like. You can deactivate them the way we mentioned last time .
  • Code errors. We do not recommend using it unless you are an experienced programmer who can look into it.
Fatal error: Call to undefined function is_post_type_archive() in myrootdomain/_sites/dcambrose/wp-content/plugins/qa/core/functions.php on line 24

This error tells us that the “QA” module is trying to work with the is_post_types_archive function, but it is nowhere in the code. You can prevent such problems by carefully checking the compatibility of the extensions with your current version of WordPress and using modules. If this situation has already occurred, simply delete or rename the module directory on your FTP.

Another example: After updating to a newer version of WordPress, an error message appears:

Fatal Error Undefined Function Is_network_admin()

The error is most likely caused by a failed automatic update.

Solution : Manually update WordPress.

  1. Download the new version of WordPress (unzip the .zip file, the resulting directory is called “new” WordPress)
  2. You are backing up your site
  3. For example, you rename the wp-inludes and wp-admin directories to wp-includes-debug and wp-admin-debug
  4. Upload the wp-includes and wp-admin directories from the new WordPress to the root directory of your WordPress installation
  5. You will overwrite the files in the wp-content directory from your WordPress installation with files from the wp-content directory from the new WordPress.
  6. Overwrite the files in the root directory of your installation with files from the root directory of the new WordPress
  7. Delete the .maintenance file from the root directory
  8. Log in to the administrator interface, click on the link that appears (for example http://domain.com/wordpress/wp-admin/upgrade.php ) and use the instructions to update your installation.

You can find more about installing WordPress manually in the WordPress Code .

Problem D:

Sometimes when you try to edit something in the code (most often in functions.php in the directory of the used topic) you may encounter the error message “Parse error”:

Parse error: syntax error, unexpected T_STRING in /cesta-ku-vasej-teme/functions.php on line 25

This means that someone in the code (in this case on line 25 in the functions.php file) has an error and the program cannot process the code. Often you just need to check that you have entered everything on the given line correctly and if you do not know the advice, try to contact the experts or write to us on the forum .

Concluding remarks:

WordPress has functionality that allows you to log all similar errors to a file. You can read how to enable error logging in the Code .

We are at the end of another article in the series about the bugs you may encounter when working with our favorite CMS.
This time we looked at a bit more technical matters, although of course we still just gently peel into the peel of a very dense electronic orange.

Do you like this direction, or would you rather hear about more general problems?
Problems with WordPress that we haven’t written about yet?
Let us know!

 

WordPress Návod v PDF

LEAVE A REPLY

Please enter your comment!
Please enter your name here