when i hit index page instead of error messages I'm just getting a blank page. Is there any way to show PHP error messages instead? It's very hard to debug when I get no feedback. My environment is linux. PHP
Asked
Active
Viewed 103 times
0
-
More details needed. – Masiorama May 06 '15 at 08:33
-
2possible duplicate of [How do I get PHP Errors to display?](http://stackoverflow.com/questions/1053424/how-do-i-get-php-errors-to-display) – Pete May 06 '15 at 08:34
-
try adding `ini_set("display_errors", 1);` to your code – Alex May 06 '15 at 08:36
-
i am having all html pages on server. but for enquiry form i have added PHPmailer to index page. and changed the extension to php. – Mohit B. May 06 '15 at 08:43
2 Answers
5
there are more than one way to show errors in php scripts in linux..
first, in your index.php file, insert this codes:
error_reporting(E_ALL);
ini_set('display_errors', 1);
this enables displaying errors and warning from your browser..
or second, open php.ini
file located at /etc/php5/apache2/php.ini
and edit the line
display_errors = Off
to
display_errors = On
and restart apache2
sudo /etc/init.d/apache2 restart
NOTE: the first method only enables error message on the current file while the second method globally enables error messages to all php scripts..
-
try using the linux's terminal and just type `sudo nano /etc/php5/apache2/ini.php` or just locate it using `locate ini.php` – catzilla May 06 '15 at 09:09
-
Configuration File (php.ini) Path /usr/local/lib Loaded Configuration File /home/cc97320023/public_html/php.ini – Mohit B. May 06 '15 at 09:15
-
-
then I suggest modifying that php.ini file on where you found it... usr folder is located at the bottom of the file system... try using `cd /usr` and you can access that folder – catzilla May 06 '15 at 09:17
0
You have your answer in this post
Basically you have to add this 2 lines at the beginning of the file
error_reporting(-1);
ini_set('display_errors', 'On');

Community
- 1
- 1

SpongePablo
- 870
- 10
- 24
-
Warning: require(PHPMailer\class.phpmailer.php): failed to open stream: No such file or directory in /home/cc97320023/public_html/index.php on line 5 Fatal error: require(): Failed opening required 'PHPMailer\class.phpmailer.php' (include_path='.:/usr/local/lib/php') in /home/cc97320023/public_html/index.php on line 5 – Mohit B. May 06 '15 at 08:49
-
-
when i use wampserver it works all fine on local server but not online – Mohit B. May 06 '15 at 08:51
-
The reason why its not working on your online server could be the php.ini, another place where you can activate/deactivate those warnings. – SpongePablo May 06 '15 at 08:54
-
About the PHP Mailer... it says that is lookin in the folder include_path='.:/usr/local/lib/php', that is automatically included, there is where PHP Mailer should be, but as I can't see your application I don't know if it is already there. – SpongePablo May 06 '15 at 08:54
-
-
As @catzilla told you a couple answers up, change display_errors and set it to ON and then restart apache sudo service apache2 restart – SpongePablo May 06 '15 at 08:57
-