500 - Internal Server Error (End of script output before headers)

Hi,

My phalcon application was works great in my server. But when i moved to client server, i got "Internal Server Error" strangely. I tried to setup same config on both server with cPanel, Apache with modules, PHP with extensions, MySQL etc.. But i'm still getting "Internal Server Error".

Apache error log is here:

> End of script output before headers: index.php, referer: http://domain.com

I couldnt find the error. How can i fix this?

By the way, it get the output when i print sample variable on index.php

Thanks



66.6k

pure guess: your phalcon extension isn't loaded correctly / working

>pure guess: your phalcon extension isn't loaded correctly / working

In that case PHP would raise fatal error:

> PHP Fatal error: Uncaught Error: Class 'Phalcon\Mvc\Micro' not found in...

So it's some other mis-config.

@OP: provide full app/web server config, OS, PHP version etc.

  • OS
  • Web server / SAPI used
  • PHP version
  • phpinfo()
edited Aug '17
  • CENTOS 6.9 kvm
  • PHP Version 7.0.22
  • CGI/FastCGI
  • Apache 2.4
  • Phalcon 3.2.2

Do you need any information?

>>pure guess: your phalcon extension isn't loaded correctly / working > >In that case PHP would raise fatal error: > >> PHP Fatal error: Uncaught Error: Class 'Phalcon\Mvc\Micro' not found in... > >So it's some other mis-config. > @OP: provide full app/web server config, OS, PHP version etc. > >* OS >* Web server / SAPI used >* PHP version >* phpinfo()



66.6k

is error reporting on ? maybe some folder permissions ?

Did you try to enable phalcon debugger? More on: https://docs.phalconphp.com/en/3.2/debug

Yes, debug enabled.

>Did you try to enable phalcon debugger? More on: https://docs.phalconphp.com/en/3.2/debug

Yes, error reporting on

>is error reporting on ? maybe some folder permissions ?



66.6k

check nxings logs perhaps ?

@afbora: if I remember well, you are developing on Windows (app server)?

Yes i developing windows server (wampserver) but;

  1. Built the project on windows server (works)
  2. Moved the my linux server (works)
  3. Moved the client linux server (failed)

@afbora: if I remember well, you are developing on Windows (app server)?

My server not nginx, i found the errors only apache error.log file like that:

> End of script output before headers: index.php, referer: http://domain.com

>check nxings logs perhaps ?



66.6k

can you find me on Discord, my nickname there is Izo

I have not mic and my english so worse :)) We can correspond. What is you tag number?

>can you find me on Discord, my nickname there is Izo

edited Aug '17

Server using 2.6.x kernel? OMG, that's 10+ yrs old.

I'm guessing permissions are wrong - i.e. web server user is unable to write into cache directory etc.

OR it might be that you're loading Phalcon before other required extensions such as PDO.

You don't even supply ordering for extension: /opt/cpanel/ea-php70/root/etc/php.d/phalcon.ini

rename it to something like:

/opt/cpanel/ea-php70/root/etc/php.d/90-phalcon.ini

I renamed as 40-phalcon.ini and restart the apache but still getting same error.

>Server using 2.6.x kernel? OMG, that's 10+ yrs old. > >I'm guessing permissions are wrong - i.e. web server user is unable to write into cache directory etc. > >OR it might be that you're loading Phalcon before other required extensions such as PDO. > >You don't even supply ordering for extension: >/opt/cpanel/ea-php70/root/etc/php.d/phalcon.ini > >rename it to something like: > >/opt/cpanel/ea-php70/root/etc/php.d/90-phalcon.ini > >

I realized that:

Debug the following line on index.php file:

echo $application->handle()->getContent();

I dumped the $application in index.php and printed output.

I dumped the $application->handle() but not output (Internal Server Error).

I install the Invo app but same error (https://github.com/phalcon/invo)

Here Phalcon checker file (Phalcon working): https://goo.gl/LpxQ6z

edited Aug '17

I still see old version on your server: /opt/cpanel/ea-php70/root/etc/php.d/phalcon.ini ?

Temporary enable errors in PHP and see what will be printed on screen.

Also, it might be that you have core dump, check dmesg after you hit your homepage, look for SIGBUS or SEGFAULT errors.

So you have double checked file system permissions and you confirm web server user is able to write to cache dir?

>I renamed as 40-phalcon.ini and restart the apache but still getting same error. > >>Server using 2.6.x kernel? OMG, that's 10+ yrs old. >> >>I'm guessing permissions are wrong - i.e. web server user is unable to write into cache directory etc. >> >>OR it might be that you're loading Phalcon before other required extensions such as PDO. >> >>You don't even supply ordering for extension: >>/opt/cpanel/ea-php70/root/etc/php.d/phalcon.ini >> >>rename it to something like: >> >>/opt/cpanel/ea-php70/root/etc/php.d/90-phalcon.ini >> >>

edited Aug '17

I roll back because didnt work.

error reporting already enabled

I checked the permissions, not worked

>I still see old version on your server: >/opt/cpanel/ea-php70/root/etc/php.d/phalcon.ini ? > >Temporary enable errors in PHP and see what will be printed on screen. > >Also, it might be that you have core dump, check dmesg after you hit your homepage, look for SIGBUS or SEGFAULT errors. > >So you have double checked file system permissions and you confirm web server user is able to write to cache dir? > > >>I renamed as 40-phalcon.ini and restart the apache but still getting same error. >> >>>Server using 2.6.x kernel? OMG, that's 10+ yrs old. >>> >>>I'm guessing permissions are wrong - i.e. web server user is unable to write into cache directory etc. >>> >>>OR it might be that you're loading Phalcon before other required extensions such as PDO. >>> >>>You don't even supply ordering for extension: >>>/opt/cpanel/ea-php70/root/etc/php.d/phalcon.ini >>> >>>rename it to something like: >>> >>>/opt/cpanel/ea-php70/root/etc/php.d/90-phalcon.ini >>> >>>

Did you compile Phalcon manually or you have used packagecloud repo?

Installed with cPanel EasyApache 4

>Did you compile Phalcon manually or you have used packagecloud repo?

edited Aug '17

@afbora, could you please add this on top of your index file and post here, what you get?

function onShutdown() {
    $error = error_get_last();
    var_dump($error);
    die;
}
register_shutdown_function("onShutdown");

If it's still 500 page, then there is really something dying, what is no regatding Phalcon. Otherwise - you should see the reason in output.

Still getting "Internal Server Error" error, no another output :(

@afbora, could you please add this on top of your index file and post here, what you get? > >```php >function onShutdown() { > $error = errorgetlast(); > vardump($error); > die; >} >registershutdown_function("onShutdown"); >``` > >If it's still 500 page, then there is really something dying, what is no regatding Phalcon. Otherwise - you should see the reason in output.

edited Aug '17

Well, I'm pretty sure there lies your issue. Solutions like XAMPP, WAMP, cPanel etc. will only cause you trouble.

Remedy: compile Phalcon from source.

>Installed with cPanel EasyApache 4 > >>Did you compile Phalcon manually or you have used packagecloud repo?

edited Aug '17

This is client server but installed the Phalcon with cPanel on my server too but it's working.

>Well, I'm pretty sure there lies your issue. Solutions like XAMPP, WAMP, cPanel etc. will only cause you trouble. > >Remedy: compile Phalcon from source. > > >>Installed with cPanel EasyApache 4 >> >>>Did you compile Phalcon manually or you have used packagecloud repo?

Just check logs :)

Here the log:

> End of script output before headers: index.php, referer: http://domain.com

>Just check logs :)

You need to check other logs, like syslog etc, this is only information from apache/nginx. Check with xdebug/gdb what exactly is happening.

This issue solved.

I installed the phalcon via cPanel EasyApache but not installed correctly.

I installed Phalcon extension via manual method, its working now.

I guess this issue about the server because of i installed the Phalcon to own server via EasyApache and it had worked.

Thanks for helping friends..

edited Sep '17

https://forum.phalconphp.com/discussion/16831/500-internal-server-error-end-of-script-output-before-headers#C50757

> Well, I'm pretty sure there lies your issue. Solutions like XAMPP, WAMP, cPanel etc. will only cause you trouble.

> Remedy: compile Phalcon from source.

Exactly as you say! +1

>https://forum.phalconphp.com/discussion/16831/500-internal-server-error-end-of-script-output-before-headers#C50757 > > >> Well, I'm pretty sure there lies your issue. Solutions like XAMPP, WAMP, cPanel etc. will only cause you trouble. > >> Remedy: compile Phalcon from source.