I recently changed to a MacBook and now use the MAMP-stack for development locally.
In my earlier development environment I always could see informative error-reports when I tried to access a PHP file through a web-browser and an error occurred. With the default installation of MAMP it seems that this feature is disabled, whenever I hit an error I can't see the cause of it, I can't even see a single line informing me that an error occurred.
Not until I start to debug the code in a debugger I can see where the error occurred.
Any idea how error reporting can be turned on?
I tried:
error_reporting(E_ALL);
No effect at all though.
reporting level to E_ALL and display errors on Include the following code at the top of every php file on in an include or require such as your config.php
error_reporting(E_ALL);
ini_set('display_errors', 'on');
Try ini_set('display_errors', 'on');
You'll also want to check a phpinfo(), to see if the ini_sets are doing anything.
Or change "display_errors = Off" to "display_errors = On" in /Applications/MAMP/bin/php/php5.4.4/conf/php.ini
Navigate to MAMP settings (eg localhost:8889/MAMP)
Click PHP Tab
Find Log errors: setting
Tick to screen
Click Save
Related
In my settings.php file (located in /sites/default/), I have:
ini_set('error_reporting', E_ALL);
ini_set('display_errors', 'stdout');
However, they are not showing on the screen.
For example, I had a problem where I was missing $ when referencing a variable and it would've been nice to have this displayed.
This has to be in the settings.php file because I have a test site and a live site and only the test site should display the PHP errors, so putting this in a php.ini file at the server level is not an option)
Go to Error reporting page (/admin/settings/error-reporting) and check that error reporting parameter. Is it set just to log errors or to log and display on screen?
If that doesn't help then run phpinfo() (http://php.net/manual/en/function.phpinfo.php) function and see is error display allowed. If it's not check the location of used php.ini file (again be looking at phpinfo() output), edit it to allow error displaying (restart web server) and error should appear.
I am getting internal server error when calling php script via ajax. I set ini_set("display_errors", 1); error_reporting(E_ALL); but still no details .. what else should I do
inside your php.ini the
display_errors = On
The php.ini file is where base settings for all php on your server, however these can easilybe overridden and alterd any place in the PHP code and affect everything following that change. This happens a in frameworks. A good check is to add the display_errors to you php.ini. If you don't see an error, but one is being logged, insert this at the top of the file causing the error:
ini_set('display_errors', 1);
error_reporting(E_ALL);
If this works then something earlier in your code is disabling error display.
I have MAMP, and I don't know how to display errors on it,
when I have error on my php code it shows only blank pages,
i have searched on Google, and I saw that I have to change it to display_errors = on on all of the folders and versions...
and include this on my page:
error_reporting(E_ALL);
ini_set('display_errors', 'on');
Stop your server.
Go to
Applications/Mamp/bin/php/phpVERSION/conf/php.ini
Set
error_reporting=E_ALL
display_errors=On
Start your server.
If this doesn't help - please post your phpInfo page.
This is how I got mine to display error:
Open MAMP
Click on Server tab
Click on PHP
Under Write, check All errors and warnings and Notices
Under To, check Display and Log
I am using MAMP with php version 7.0.6.
What I did was go to MAMP\conf\phpVERSION and open up the php.ini file there and change the display_errors value there to display_errors = On.
Once changed, restart your MAMP.
I have recently changed hosts, on my old host if i had an error in my syntax the error would be displayed (showing me where the error was)
On my new host i do not see this, i just see
The website encountered an error while retrieving http://www.XXX.co.uk/delete_product.php?q=66550. It may be down for maintenance or configured incorrectly.
Is there any way i can show the error instead of this?
Turn on error reporting.
Include these lines are the top of your script:
ini_set('display_errors',1);
error_reporting(E_ALL);
If you have access to edit the php.ini file, you can edit it and include the following option:
error_reporting = E_ALL
These settings will help you troubleshoot code faster and makes it easy to identify errors. However, it is not appropriate for a production-level use. You should use the first method and then you can remove the lines once you've fixed the issues. On local development environments, it's okay to edit php.ini file and add the directive as mentioned above.
On production systems, do not use ini_set('display_errors', 1); as it can show information you might want to keep hidden. Use the server's logs instead. By default apache for example logs these errors in error_log.
And, anything that is open to the general internet public is considered "production" in my opinion. Development means it is a server sitting in your own local network.
Turning on error reporting would work, but perhaps it would be better to look into the server logs.
So mamp pro is all set up using PHP 5.3.6 / cache is XCache, error handling set to Display Startup errors - write to All errors and warnings - to set to Display and Log both checked.
restart the server, intentionally wrote some code that should bring up an error..
<?php
echo stupid;
?>
Yes this is all thats in the code.
I get nothing! No errors, only in the log.
I don't want to have my console open the entire time watching for errors, I want them printed on the screen.
The only way I can get this to work is by doing an INCLUDE on this code at the top of EVERY SINGLE PHP file.
error_reporting(E_ALL);
init-- yad yada ('display_errors', 'on');
From what I'm reading elsewhere, it seems like this is a big problem..
So how can I set up my mamp pro PHP.INI file to work properly and print directly to my browser?
I changed it in MAMP/bin/php/php5.3.6/conf/php.ini
You can change display_errors and display_startup_errors