We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

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: https://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



85.5k

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()


58.1k
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()


85.5k

is error reporting on ? maybe some folder permissions ?

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



58.1k

Yes, debug enabled.

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



58.1k

Yes, error reporting on

is error reporting on ? maybe some folder permissions ?



85.5k

check nxings logs perhaps ?

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



58.1k

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)?



58.1k

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

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

check nxings logs perhaps ?



85.5k

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



58.1k

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



58.1k

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



58.1k

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).



58.1k

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



58.1k
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?



58.1k

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.



58.1k

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?

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.

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?



58.1k
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 :)



58.1k

Here the log:

End of script output before headers: index.php, referer: https://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.



58.1k

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.phalcon.io/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.



58.1k

Exactly as you say! +1

https://forum.phalcon.io/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.

Any Solution without installing phalcon from the source? I have the same problem. I also made the installation from easyapache 4, according to the phpinfo () phalcon is correctly installed.