0

I'm working on server with

ubuntu 14.04 
php 5.3.10.
apache 2.2.22

these are php.ini error settings:

display_errors = off
error_reporting = E_ALL & ~E_DEPRECATED

the apache version of php.ini differs from cli version about some functions disabled:

pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,

here's my code:

<?
ini_set('display_errors', '1');
ini_set('display_startup_errors', '1');
ini_set('error_log','/tmp/php_errors_'.$_SERVER['SERVER_NAME'].'.log');
abstract class master 
{
    abstract public function metodo ();
}

class slave extends master
{
    function __contruct()
    {
        echo "HI!";
    }
}

$b = new slave();

from CLI I'll get this error ():

PHP Fatal error:  Class slave contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (master::metodo) in /home/lbarby/prova.php on line 13

but running the same script from apache I obtain blank page! What's the matter? Any advice?

UPDATE To be clear: my problem is that I don't understand why PHP under apache doesn't show any error while it does from CLI (as expected!).


SOLVED I've found a solution: instead of use literal value you must use numeric ones (see predefined constant on php.net).

3
  • try changing the constructor from function __contruct() to public function __contruct() Commented Oct 29, 2014 at 13:05
  • 1
    why not just implement the required abstract method metodoin the slave class? Commented Oct 29, 2014 at 13:07
  • thank you but my problem is that running on apache I'll get blank screen so forget about code, it's just for testing! Commented Oct 29, 2014 at 13:50

1 Answer 1

1

Turn display_errors to on. If it is set to off it will show nothing.

Sign up to request clarification or add additional context in comments.

5 Comments

have you seen this row? ini_set('display_errors', '1');
Of course. Directly from PHP's manual: "Although display_errors may be set at runtime (with ini_set()), it won't have any effect if the script has fatal errors. This is because the desired runtime action does not get executed."
unfortunately it doesn't solve the problem. I've turned on display_errors and display_startup_errors too but nothing change.
Just to check, but did you change it in the php.ini associated to the apache server, right ?
Yep! To be sure I've checked using phpinfo.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.