Asked  7 Months ago    Answers:  5   Viewed   34 times

I have a development version of PHP on Apache. I moved it to production and got this weird notices in my website. I don't have it on development version. How to enable these notices on my development version of website to fix them?

 Answers

98

Change your php.ini file, the line that says error_reporting, to E_ALL.

I.e:

error_reporting = E_ALL
Wednesday, March 31, 2021
 
jenny
answered 7 Months ago
79

Simple Answer: You can't. See the manual:

The following error types cannot be handled with a user defined function: E_ERROR, E_PARSE, E_CORE_ERROR, E_CORE_WARNING, E_COMPILE_ERROR, E_COMPILE_WARNING, and most of E_STRICT raised in the file where set_error_handler() is called.

For every other error, you can use set_error_handler()

EDIT:

Since it seems, that there are some discussions on this topic, with regards to using register_shutdown_function, we should take a look at the definition of handling: To me, handling an error means catching the error and reacting in a way that is "nice" for the user and the underlying data (databases, files, web services, etc.).

Using register_shutdown_function you cannot handle an error from within the code where it was called, meaning the code would still stop working at the point where the error occurs. You can, however, present the user with an error message instead of a white page, but you cannot, for example, roll back anything that your code did prior to failing.

Wednesday, March 31, 2021
 
mario
answered 7 Months ago
59

Errors and Exceptions both extend Throwable however Errors are not extended from Exception.

Therefore, your ExceptionHandler must accept an object of Type Throwable in order to accept Errors.

Simplest fix is this, though you may want to rename $exception to make it clear.

namespace MyClass;

class Throwable
{
    public function exceptionHandler(Throwable $exception)
    {
        //logic here
    }
}

Note: The new Error class should not be confussed with an ErrorException which has classicly been used as a device for turning PHP 5 errors into Exception objects with symantic meaning.

http://php.net/manual/en/class.error.php

Wednesday, March 31, 2021
 
godot
answered 7 Months ago
17

It is a good practice to separate:

  • source code management (including the act of committing, which, in your case, should not happen at every little change)
  • release management (packaging and deployment)

I can even skip sending it to the remote git server, I just want to sync files between my local machine and the development server.

That is a release management process, like having a cron job doing regular rsync. But it has nothing to do with your SCM (here: Git), which won't have a native solution for that.

Saturday, June 19, 2021
 
antoniputra
answered 4 Months ago
11

To debug tests the following argument should be used: --debug-jvm

For example: gradle test --debug-jvm
Gradle will suspend execution right before running tests and wait for debugger connection on port 5005.

For executing only specific tests see https://docs.gradle.org/current/userguide/java_testing.html#simple_name_pattern

Sunday, August 8, 2021
 
rojo
answered 2 Months ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :