• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • We are looking for U.S.-based freelancer or agency working with SEO or WordPress for a quick 30-min interviews to gather feedback on XOVI, a successful German SEO tool we’re looking to launch in the U.S.
    If you qualify and participate, you’ll receive a $30 Amazon gift card as a thank-you. Please apply here. Thanks for helping shape a better SEO product for agencies!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

Question Turn off PHP warnings from Command Line?

Paul Larson

Basic Pleskian
Server operating system version
CentOS Linux release 7.9.2009
Plesk version and microupdate number
Obsidian 18.0.46
This is probably a Centos Question, but I've noticed more verbose warning output since upgrading a site to PHP 8.1, e.g.

Code:
-bash-4.2$ php myscript.php
The following error occurred:
E_DEPRECATED: explode(): Passing null to parameter #2 ($string) of type string is deprecated

Centos Version:

Code:
-bash-4.2$ cat /etc/*rel*
CentOS Linux release 7.9.2009 (Core)
Derived from Red Hat Enterprise Linux 7.9 (Source)

Code:
-bash-4.2$ php -v
PHP 8.1.14 (cli) (built: Jan  9 2023 10:16:54) (NTS)

I get the same output when I use an absolute path:

Code:
-bash-4.2$ /opt/plesk/php/8.1/bin/php myscript.php
The following error occurred:
E_DEPRECATED: explode(): Passing null to parameter #2 ($string) of type string is deprecated
 
It's not a OS related issue, nor is it an Plesk related issue. It is merely a PHP issue.

It also the correct behavior for PHP 8.1 as passing null to non-nullable parameters of built-in functions will result in a deprecation notice. Even tough it is just a notification and not an actual error, the obvious solution would be to fix the issue in your code. Making it future proof for PHP version where passing null to non-nullable parameters are actually deprecated and will cause an error.

If that's not what your after then you can suppress deprecation notices by removing E_DEPRECATED from the error_reporting value on the PHP settings page of your domain in Plesk (or in the PHP settings tab of your service plan if want to get rid of the deprecation notices for all of your domains). Or instead add the error_reporting() function to your script.

There is no way to only suppress the deprecation notices on command line only. It's all or nothing.
 
Last edited:
Back
Top