I am using WAMP (Apache 2.2.17, PHP 5.4.3) & WordPress 3.4.2.
Everything was fine until I started to add and activate plugins now I get different sort of errors on the front-end/Admin e.g.
"Notice: Undefined index: plugin_version in
C:\repo\wpdev\wp-content\plugins\wp-rss-multi-importer\inc\upgrade.php
on line 11"
And
"Warning: Illegal string offset 'feedslug' in
C:\repo\wpdev\wp-content\plugins\wp-rss-multi-importer\inc\rss_feed.php
on line 21."
IF I deactivate the plugins everything seems to be fine. I have installed WAMP & WP 2X. The plugins work fine on MediaTemple. The error messages vary depending on the plugins. Search Google and came up empty.
These are Notices and Warnings, which optionally show up depending on your PHP error reporting settings. Find your php.ini and set the following:
error_reporting = E_ALL & ~E_NOTICE
Note, you can find your php.ini location using the phpinfo(); function.
According to the author of the plugin you are using, while waiting for an update you can get rid of that error by commenting out these lines in inc/rss_feed.php, e.g.
//if (!empty($feed_options)){
//add_feed($feed_options['feedslug'], 'rssmi_feed');
//}
Related
We recently upgraded from PHP 5 to 7.4, and out Pear MBD2 package is spamming our Apache2 log with a bunch of ridiculous notices.
PHP Notice: A non well formed numeric value encountered in /usr/share/php/MDB2/Driver/mysqli.php on line 1154, referer:
Our web apps are working fine, and I know its not best practice at all, but how do we shut this notice up?
Is there any way to configure or upgrade Pear/MDB2 to stop?
Pear and MDB2 was installed via docker image, so I'll have to dig for the exact line where its throwing this.
Any help or wisdom would be appreciated.
This is the line it's throwing an issue over:
$statement_name = sprintf($this->options['statement_format'], $this->phptype, $prep_statement_counter++ . sha1(microtime() + mt_rand()));
To get rid of the notices, disable logging of E_NOTICE messages.
At the beginning of your code, add
error_reporting(error_reporting() & ~E_NOTICE);
.. or disable it in the php.ini configuration file by adjusting the error_reporting setting.
I am using PHP (7.3.7) Non-ThreadSafe on IIS (windows) as FastCGI.
PHP installation is fresh and just php.ini-development renamed to php.ini thus error_reporting is set to E_ALL
running following script
<?php
echo "some text\n" ;
echo $aaaaaaa;
echo "another text\n" ;
?>
will generate output
PHP Notice: Undefined variable: aaaaaaa in ****\article.php on line 3
Note that first and 3rd lines are missing from output.
Using same installation of php, on apache (2.4.39) and nginx (1.17.2) (also on windows system) shows following output
some text
PHP Notice: Undefined variable: aaaaaaa in ****\article.php on line 3
another text
Is there an specific configuration that I need to change so PHP show same output as apache, nginx in IIS too?
or in other words, how can I configure my setup to show warning and notices and also the output of script.
I tried same script with PHP (7.1.30, 7.2.11, 5.2.10.10) and same issue still persists on IIS but not on apache or nginx.
Edit
I know that if I set error_reporting is set to E_ALL, all errors, warning and notices are shown and when I change it to E_ALL & ~E_NOTICE & ~E_WARNING & ~E_STRICT & ~E_DEPRECATED notices and warnings are disabled and won't show.
I also know that $aaaaaaa is not defined and it being there is for illustration of the issue.
Edit 2
It seems this has to do with configuration of fast-cgi on IIS. On same machine with same php installation and configuration using apache and nginx I can see exactly what Phil and sancoLgates shown in their links. I am editing my question to reflect the issue
In your code variable $aaaaaaa is not defined so define it first.
To check error add this code
<?php
error_reporting(E_ALL);
ini_set("display_errors", 1);
// and then add your code below
?>
I am trying to get PHP errors to display on the screen using IIS vrs 8.5 and PHP vrs 5.2.17, but I continue to get the IIS 500 error http page, or a blank screen. I have already found numerous SO posts that have supposed fixes, but nothing on them has fixed my problem yet. Here is what I have tried.
Changed errorMode to Detailed. Still getting the 500 error page instead of the php error.
Removed all of the custom errors in the default IIS config file under the "httpErrors" block. Still getting the IIS custom 500 error page.
Added existingResponse="PassThrough" to my httpErrors block in the default IIS config. Doing this causes me to get a blank page instead of the php error, or the IIS 500 error.
I have verified that none of these settings are being overwritten in the site default system.config files.
Currently I am getting a blank page instead of the IIS 500 error on the screen. I have already verified that display_errors is on, and error_reporting is correct. I also know that the php page runs just fine. I am purposely causing this php error by removing a semi-colon on the page. So I already know everything is working fine. PHP Error logging is also working, but I want the errors to display on the page so I dont have to look at the error log every 5 minutes.
What else could be causing this?
IF you set custom error to Detailed in feature settings of error pages for website and server both
AND if in your php.ini file you set the display_errors = on & error_reporting = E_ALL
THEN there is only one possibility for getting [IIS default 500 error page] is that "Your PHP is not working coz of miss configuration."
The required configurations are:
After setting Handler Mappings to your php-cgi.exe file(which is in you php installation dir) as FastCGI, open the php.ini file and edit following lines OR add if not found in file. (if php.ini is not exists in you PHP installation dir then rename from existing php.ini-development OR php.ini-production)
1) extension_dir = "ext\"
;ext folder will be in PHP installation, if not create and don't forget ending \
2) log_errors = On
3) error_log = "C:\inetpub\temp\php-errors.log"
4) cgi.force_redirect = 0
; may be you need to add this line add it anywhere, for instance-before '; File Uploads ;'
5) cgi.fix_pathinfo = 1
6) fastcgi.impersonate = 1
7) fastcgi.logging = 0
Be careful and there should not `;` before any of these lines.
see documentation - installing/configuring PHP
Even after correct configurations PHP may not work because of system corruption. You can check by double click on php-cgi.exe and php-win.exe it should run without proper error (other then warnings OR ext/fileName... is missing messages - these are OK).
Note: after these many other setting are requires to run all things of php (ex. session), but by these SIMPLE PHP WILL WORK or PHP will properly show the error for what's wrong (NOT 500 page).
Make sure you are editing the right php.ini file. To check which file needs to be edited, go to IIS > Handler Mappings and look for PHP. Then check which directory they are located in.
In my case, I had two directories and was editing the wrong php.ini file, which was the reason why I was unable to get the errors to display.
I was having a similar issue getting a 500 error instead of a PHP error. I fixed the issue by going to PHP Manager within IIS
Under PHP Settings click configure error reporting. This will allow you to choose between Development and Production machine. If you choose Production you will get no detailed PHP errors in the browser, you will only get wrritten to a logfile. Development will allow for both errors to be displayed and written to a logfile.
I hope this helps.
If ou are Getting error 500 when active php to show errors, maybe you need to turn off the tracking error
Follow the step by step to fix.
If you don't have downnload the PHP Manager for IIS, you can find it in Web Platform Installer. Then open it.
After that click on manage all settings
Now Just turn off this setting
under server configuration feature view you see fast-cgi settings,
double click it. you see php-cgi.exe. double click it. set standart error mode to IgnoreAndReturn200.
regards
I was struggling with this issue - I have my PHP Handler Mapping set as follows, confirming I'm using PHP 5.3:
Therefore I then went to the corresponding location to find the correct file, here: C:\Program Files (x86)\PHP\v5.3 and edited php.ini
At first it looked like this:
; error_reporting
; Default Value: E_ALL & ~E_NOTICE
; Development Value: E_ALL | E_STRICT
; Production Value: E_ALL & ~E_DEPRECATED
I changed it to this:
error_reporting(E_ALL);
; Default Value: E_ALL & ~E_NOTICE
; Development Value: E_ALL | E_STRICT
; Production Value: E_ALL & ~E_DEPRECATED
I had to restart the Server in IIS to apply the change (choosing the Server from the list at the top on the left hand side, rather than selecting the Site on the left, lower down):
Now I see the error message - e.g.
Parse error: syntax error, unexpected '=' in C:\data\test.php on line 2
Instead of this type of generic error - e.g. on Chrome:
Plot: First I had a site with GodDaddy, Furstated of their cool CPanel and more cool downtimes I moved on to Digital Ocean VPS.
Problem: But when I transferred files to VPS I get some common/uncommon PHP errors. I seen no errors when using godaddy. A few of them are.
Notice: Undefined variable: q in /srv/users/someuser/apps/video/public/config.php on line 7
and
Notice: curl_setopt(): CURLOPT_SSL_VERIFYHOST no longer accepts the value 1, value 2 will be used instead
I am using PHP 5.4 (on nginx , the LEMP install)for now. Any way to hide these errors as my site is working flawlessly even when these errors appear.
Instead of suppressing notices and error messages, I would consider fixing the problems. Might be more work to do for now, but I think it's worth the effort in order to have a full running and functioning program in the end - and if Digital Ocean updates libraries your code will break.
Notice: Undefined variable: q in /srv/users/someuser/apps/video/public/config.php on line 7
this notice tells you that there is a variable not set and in which file and in which line. So you should just go to this file, have a look on what is happening in line 7 and try to fix it. It looks like $q isn't needed at all, so try to comment the line out or take a deeper look in your file if the variable is needed elsewhere.
Notice: curl_setopt(): CURLOPT_SSL_VERIFYHOST no longer accepts the value 1, value 2 will be used instead
CURLOPT_SSL_VERIFYHOST with value 1 is deprecated and will be removed as of libcurl 7.28.1. It is recommended to use value 2 instead.
Consider having a look in the file you are running curl and change the line from either
CURLOPT_SSL_VERIFYHOST => true or CURLOPT_SSL_VERIFYHOST => 1
to:
CURLOPT_SSL_VERIFYHOST => 2,
Looks like GoDaddy used outdated (older) versions of the different libraries.
The curlopt setting may be a warning right now, but will break your program as soon as Digital Ocean updates their libraries or you update them.
You can change your php.ini file according to the documentation and avoid the error :
error_reporting = E_ALL & ~E_NOTICE
This will remove notices and coding standards warnings.
Add the following on the top of your script
error_reporting(0);
In your php.ini file, there are two variables for you consider. The first one is for the level of errors captured, and the second is whether or not to show them on the screen.
error_reporting = E_ALL & ~E_DEPRECATED
display_errors = Off
Adjusting these will give you the desired output.
When I developed a website on my localserver it was working fine.
Now that I've uploaded it live I'm getting several notices.
Notice: Undefined index: ... on line 14
I've figured out that it happens because I'm using variables which arn't defined, and would like to go through and fix it. But I need a live version working tonight.
Is it possible to suppress the Notices and have the website act as it does on my localhost while its on my live server?
You've got it twice wrong. On your localhost and on your live server!
Localhost
Always show everything on screen, you want to know about notices too before you go live, as you can see now!
Live server
Never show anything on screen, it makes you vulnerable (it's deadly)
Log everything, also notices! So don't do what the other answers tell you!
You can choose which kind of errors will show up on your site on a global scale through php.ini or through .htaccess for specific folders, or per script by using error_reporting().
Read more on that and which options to set for your specific needs at www.php.net/manual/en/function.error-reporting.php
Also read: http://www.php.net/error-reporting
Look in the file php.ini for a line similar to error_reporting = E_STRICT - Edit it to remove the STRICT bit and put in error_reporting = E_ERROR.
I would recommend that in the near future that you fix those errors anyway.