i am having weird situation last week i open my site and then i open my wp-admin page it should work like my front but i am having 500 error.
i tried almost every thing on google to find this situation but nothing helped me.
as i remember last time i work in theme function file and WordPress config file i checked .htaccess file eveything is fine.
also i did replace content with old content and create new file for config but nothing works. i disabled all plugins enabled debug mode but nothing helped me
what should i do ? i dont want to lose anything
Glad you sorted your error with incompatible PHP versions.
In order to properly debug an HTTP 500 error, you should do the following.
In your php.ini, set error_reporting to -1
Turn display_errors off
Set a custom error_log path.
Then in your terminal, type tail -f /path/to/error_log.
Now as you work on your project, you can go into your terminal and you will see all notices, warnings, deprecation messages, and fatal error messages, scrolling past in real time.
Then you can tighten the screws. An empty log means well written code!
Related
I'm having an issue where I get an "Internal Server Error" on my php page. To try and debug it, I attempted to use the error_log function in php. However I could not get it to write anything to the error log. Even in a simple php file:
httpdocs/temp.php
<?php
error_log("this is an error");
echo "hello";
?>
I would receive a basic internal server error message:
Internal Server Error The server encountered an internal error or
misconfiguration and was unable to complete your request.
Please contact the server administrator to inform of the time the
error occurred and of anything you might have done that may have
caused the error.
More information about this error may be available in the server error
log.
Web Server at xxxxxxxx.com
So I looked up how to set up the error_log properly, thinking that it was somehow not set up correctly. I found this article.
Since I am on windows I edited the .user.ini file in my httpdocs root folder and added the error_log line:
httpdocs/.user.ini
[PHP]
error_log=G:\PleskVhosts\xxxxxxxxxx.com\httpdocs\php_error.log
display_errors=off
log_errors=on
open_basedir="G:/PleskVhosts//xxxxxxxxx.com\;C:\Windows\Temp\"
safe_mode=off
sendmail_from=xxxxxxxxx#xxxxxxxxx.shr.prod.phx3.secureserver.net
SMTP=relay-hosting.secureserver.net
This article helped me get the absolute path
I restarted the IIS application pool and created an empty php_error.log file in my httpdocs folder, however it still never wrote anything to the log file, and continued to just give the Internal Server Error. I also tried removing all the other lines in the .user.ini file besides the error_log line, restarted, and still nothing. I also tried stopping the application pool and starting it up again, still nothing.
I double checked the phpinfo and the log_errors field was set to on, and the correct directory was set for error_log. So it is seeing the .user.ini file.
I tried calling their support but they couldn't help me.
They linked me to this article about IIS error handling. I created a web.config file and put it in the httpdocs folder as it says in that article. Now I get something different. Now the output of my page is the error that I was passing to error_log. So in other words, when I visit test.php the output on the screen says:
this is an error
Notice how the php script dies after the error? Not only should the error not be put on screen (it should be put in the php_error.log file, which is still not being written to at this point), but the php script shouldn't die afterwards unless it runs into a fatal error. I should see the "hello" from the echo and I don't.
What do I have to do to get this working properly?
My hosting plan has IIS 8 and PHP 5.4 installed.
PS. Their support basically said they cant help me any further because changing configuration files is "coding" and they dont offer coding support.
PHP needed file read write permisions
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.
Hi I have got project where I have to do some changes, but then I do some changes in php files I can't see any changes in web browser, only then I deleted files, when I see error in windows, but if I comment all lines from same file, and want see changes, when I refreshed the page where will be page like before, what means I see page like normally, and if I download the file and open it I see commented lines.
So I am using YII framework, I understand that I should turn on debugging on, so in [project-name]/index.php file in the top I pasted code.
defined('YII_DEBUG') or define('YII_DEBUG',true);
But it didin't work for me, still can't see any changes.
I also try ctrl+f5 on page refresh.
Maybe I should look in to Apache configuration?
If some one know please help.
I believe that defined('YII_DEBUG') or define('YII_DEBUG',true); causes a debug dump to be sent to the screen when an exception is thrown. Without that code there will be a single line exception error.
This might be something easy, but it drives me crazy right now.
Joomla 1.5.26 -> site was running until this morning. Now I get an Internal Server Error 500 for the frontpage(html source shows nothing), backend(admin panel) works just fine.
A single editor has worked on some articles, nothing suspicious to me there.
What I have tried so far:
Unpublished all recently created articles
Unpublished modules with dynamic content (calendar, news feeds, recent photos)
reset .htaccess to the original state
reset permissions (all directories 775, all files 644)
enabled all PHP error reporting in configuration.php ( ini_set( 'display_errors', true ); error_reporting( E_ALL ); ) - no error, just a few warinings "PHP Deprecated: Function split()", but I can even get rid of those warings by unpublishing one plugin, after which page is still blank
backend still works
index.php exists and contains the original code, template exists and is assigned
database works, no waiting processes
deleted cache in browser as well as the Joomla cache in the backend
As I have only FTP access to the server, I cannot access any apache logfiles, except the PHP error log. What other options are there to track down such an issue? My hosting company tells me the webserver is working fine, they also told me that they have restarted the server with no changes in site behaviour.
This usually happens when your host upgrades PHP and/or MySQL on the server hosting your website.
Check this post: http://www.itoctopus.com/are-you-suddenly-seeing-an-error-on-every-page-of-your-joomla-website . Your problem is most likely 2.2 (point #2, subpoint #2).
I'm pretty sure that the Apache error logs will reveal something.
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.