PHP Error handling: die() Vs trigger_error() Vs throw Exception

The first one should never be used in production code, since it’s transporting information irrelevant to end-users (a user can’t do anything about “Cannot connect to database”). You throw Exceptions if you know that at a certain critical code point, your application can fail and you want your code to recover across multiple call-levels. trigger_error() … Read more

Custom error pages for 404, 500 but where is the default 500 error message coming from?

Our exception_handler gem can be used for Ruby on Rails custom error pages. How It Works All Ruby on Rails exceptions are handled with config.exceptions_app. This is assigned in the config/application.rb or config/environments/*.rb files – it needs to be a callback: config.exceptions_app sets the exceptions application invoked by the ShowException middleware when an exception happens. … Read more

Analytics Google API Error 403: “User does not have any Google Analytics Account”

I had this problem too. I fixed it by adding the email address for my service account to the Google Analytics profile I wanted it to access. I got the email address (something like [email protected]) for the service account by looking under the “API Access” tab in the Google APIs console. Then, I followed Google’s … Read more

Unable to read file contents to string – Result does not implement any method in scope named `read_to_string`

Let’s look at your error message: error[E0599]: no method named `read_to_string` found for type `std::result::Result<std::fs::File, std::io::Error>` in the current scope –> src/ | 11 | file.read_to_string(&mut s); | ^^^^^^^^^^^^^^ method not found in `std::result::Result<std::fs::File, std::io::Error>` The error message is pretty much what it says on the tin – the type Result does not have the … Read more

Where does PHP store the error log? (PHP 5, Apache, FastCGI, and cPanel)

PHP stores error logs in /var/log/apache2 if PHP is an apache2 module. Shared hosts are often storing log files in your root directory /log subfolder. But…if you have access to a php.ini file you can do this: error_log = /var/log/php-scripts.log According to rinogo‘s comment: If you’re using cPanel, the master log file you’re probably looking … Read more