I have a WooCommerce website that has been created by other party. When I was editing a template file and checking a minor change, a PHP error appeared on top of the page (literally the first line in the document, above )
[12-Jun-2017 19:08:58 UTC] PHP Fatal error: Call to undefined function add_action() in /home/SITENAME/public_html/wp-content/themes/booklovers/widgets/top10.php on line 8
I do know what it means, but it appears that the error itself is not the issue. The time does not change, it constantly displays 19:08:58. I've also tried renaming/moving the file to see what happens - and nothing happens at all. It is being executed, because the page results with a white screen when I put exit; in it. Renaming made no difference. Checking this path by file_exists() called in index results with false. In my opinion it has something to do with Wordpress, because if I put exit; on top of the index.php the page is totally blank, without error, so it is not being merged with the response by Apache or something. Also setting the error reporting in index/config has no effect (I realize that this is generally a bad idea, and would not leave production with a workaround like this).
My guess is that the error might be some kind of a cached artifact. But this WooCommerce has no cache plugins installed so far... I have only a minor experience with Wordpress, I do know the basics, but debugging this type of issues is a terrible pain. I would appreciate any tips suggesting where should I look.
Additional information worth mentioning: shared hosting on GoDaddy (not my choice...), php 5.6.
Resolved. A theme's error_log file was being prepended to the response.
Related
i am not able to access my wordpress frontend. After uploading the 'understrap' theme my backend and frontend throw an http 500 exception.
In order to debug the issue, i've set 'WP_DEBUG' to 'true' and receive the following exception:
PHP Fatal error: Interface 'Requests_Hooker' not found in /var/www/html/wp-includes/Requests/Hooks.php on line 15
Next, i've overwrite the complete "wp-includes" folder with an initial "wp-includes" from a new wordpess and now am able to access my backend again. Unfortunately, my frontend is still empty and in wp-content/debug.log is still the same exception.
Plugins, Themes and Uploads are not affecting the issue - that is sure (the first thing i did is to remove the uploaded theme - understrap).
Wp-uploads folder has been completely initialized.
Does anyone had this issue before and might know how to fix it? Any advice is highly appreciated.
I know this is an old request, but in case others have this issue, I found a solution today. It looks like someone deleted or renamed "Hooker.php" in "webroot/wp-includes/Requests". If you are able, I would recommend restoring a previous version of that file using whatever kind of control panel you are using to administrate your site.
I got this issue with my website using wordpress
I don't know what's the issue, could someone help us out please.
Fatal error: Cannot redeclare frm_dl() (
You seem to have duplicate function definitions of the function rm_dl() in wp-settings.php. Please review that file so there is only one definition.
It is also not a good idea to post links to your website and ask "please have a look". Much better and easier for us to help if you post the specific error together with the affected files (without passwords of course!).
If there is nothing wrong with your file the error is most likely caused by some newly installed or updated theme or plugin. In worst case it's some automated hack. In both cases you should reverse to a working backup and make sure you update carefully any plugins and base installations with security updates.
This issue is by cause of virus. It is one type of script when this run this create code in each php file like followuing.
.
the solution is that download your live project file and remove this code and upload again all file on live.
you can replace all that code one time replace all with blank cursor only.
Shiv
I have a website on Wordpress and I developed some theme options in my functions.php file of the theme folder.
Everything it`s fine on my localhost, but on server I get a white page when I save the options and also some url's don't work anymore.
I developed this code from some tutorials and the problem might be the php functions used, might be to old, or to new?
Here it is, not long!
http://pastebin.com/mKJYuUE2
OW, and the admin shows my options and saves them in database!
Edit after debug on!
I get an error like this Notice: Undefined index: action in "blabla" on line 63 and 93, 94 same error. I think this $_REQUEST['saved'] is the problem, but I don't even know what this does.
Thank you very much!
Edit after debug the code
Now I fixed all my wordpress errors. Everything looks fine in my admin options, but now the problem is that if I try to delete a post, or some submit actions, I will get a white screen. On localhost I dont have this problem.
On my functions.php even if I add an echo line will give me this white page. What can I doo???
UPDATE:
Since you now know the error message. On line 63 it says "save," but line 93 says "saved." Might this inconsistency be the error?
To show error messages, add the following line to your .htaccess file:
php_flag display_errors on
That way you will see the specific error message so you will know where the problem lies specifically. Alternately you can add the following line to your wp-config.php file:
define('WP_DEBUG', true);
That should also display error messages. This will help pinpoint the problem.
My guess is you don't have short_open_tag enabled in your php.ini file on the server. Try changing the <? on the first line to <?php.
It's widely considered best practice to disable short_open_tag and use the longer <?php form instead. One of the main reasons is that it makes outputting XML a lot simpler because XML documents start with <?xml which conflicts with PHP's short opening tag.
After debugging a CodeIgniter application that were installed into a new development environment, I have started to freak out when seeing white screens with nothing more available. I have been able to solve each and every one of the errors that have caused this, but it has taken seriously way too long time.
PHP error_reporting(E_ALL) & display_errors", 1 is set as well. I even installed Xdebug in hope of getting more output, but no. My logging settings are also working, but nothing is written to the log.
Is there a way to get something informative printed out instead of a complete white screen? It would certainly shorten my time spent on solving the eventual errors that cause this.
Reference:
Why does Code Igniter give me a white page?
If there's a fatal compilation error, then you may well get a blank page.
Try doing a
php -l <filename.php>
against your script
Look near the top of /index.php for a call to error_reporting() - and make sure it's not changing your php.ini configuration to something else (besides E_ALL).
And since you didn't mention your php.ini configuration, check to ensure you have error_reporting = E_ALL there as well.
I've found out, since the time of my question, that nothing seems to ensure that errors are always outputted with PHP, which seems to throw white screens here and there. Regardless of PHP's ini-settings.
I've found out that the best workaround however is to use the following line to ensure that error logging is put into a file easily is accessed and monitored by the application:
ini_set('error_log', MYPATH .'logs/errorlog.log');
As far as I've tested it, when white screens appear - it also gets logged into this errorlog. It seems to be the easiest way to know what happens when things go wrong.
Grep the files for 'error_reporting', and 'display_errors'. The application might turn it off somewhere.
Also, to be able to see parse errors, you need to set error_reporting/display_errors in the php.ini file, or a .htaccess file. Setting it in the script files will not do and will lead to the white page you describe if there are parsing errors.
Aside from everything else posted, also make sure that something masked with the # (error suppression operator) isn't throwing a fatal error.
The best thing is to have a checklist of the common problems that could cause this since CodeIgniter's default is already
error_reporting(E_ALL);
Same name controllers and models
using reserved words as methods
The list goes on...
Consider setting PHP's error_log configuration variable -- it can be helpful when you have code setting error_reporting() without your knowledge. Then you can check the error log and see what errors, if any, occurred.
I had this problem on my freshly installed server. Debian 7.
I enabled logging, error reporting, disabled gzip and so on.
However, my PHP-installation did not have MySQL enabled. Enabling MySQL did the trick for me.
Make sure your logs and cache folder inside /system are chmod'ed to 777.
Ensure that there isn't any whitespace in your files output outside of the CodeIgniter buffer, especially if compression is turned on. You can test this by turning off compression in your CodeIgniter configuration file.
See step two at: http://codeigniter.com/user_guide/installation/upgrade_141.html (Note that while this is for the upgrade, it contains a snippet of the configuration file which explains the problem.)
If you by chance have happened to create a cached output for that particular method inside your controller, then it may create a cached version of the page and practically that page is not even running.
The cached error output page is showing up. Please check your cache folder inside the application. It should only contain the index.html file.
How do I fix the following error.
Fatal error: Call to undefined function language_attributes()
It looks as if your theme either did not upload correctly, or it is not compatible with the version of wordpress that you are using.
This can happen if you have no wp-config.php file. Rename the wp-config-sample.php file to wp-config.php, edit the db-settings and try again.
What version of WP are you using? From my research I found that the language_attributes() function is a new feature as of WP 2.1. If you are using a version of Wordpress older than 2.1 then you can either remove the function call from your header.php file or upgrade your wordpress installation.
This error occurs because the function language_attributes() is unavailable. If you are seeing it in the logs but your site is working fine, it might just be that someone tried to access a file in your theme directly.
Files in the theme directory are normally accessed after WordPress has loaded (making a bunch of functions available, like language_attributes()). If you try to access them directly, for instance by visiting yoursite.com/wp-content/themes/yourtheme/header.php in your web browser, you should see an empty page, and an error should be logged (e.g. in the error_log file).
Other files will trigger slightly different errors, depending of what functions these documents are calling. On a site I just tested, if I hit mytheme/index.php a Call to undefined function get_header()... error is logged.
If you see this error in the logs but are not experiencing any issues, it's probably due to some bot or indelicate user snooping around. You can ignore the error (unless you have a ton of them, in which case you might want to install a security plugin just in case...)