Cakephp redirect not working on server

On my PC with a WAMP server and php 5.3.9 everything works fine.

When I upload it to the server with php 5.2.1.7, all redirects stop working - when the → redirect (..) script is executed it stops working - it acts as if it were die; instead of redirection, and there is nothing printing and redirection do not work.

These are the redirects I use:

 $this->redirect( array('controller' => 'users', 'action' => 'login') ); $this->redirect( $this->referer() ) 

Both (virtually everything ...) stopped working after uploading to the server ...

------ edit

I managed to show E_ALL errors and, for example, if I write $omg->lol() before the redirect, then the error is reported as

Note (8): Undefined variable: omg [APP / Controller / LanguagesController.php, line 31] Fatal error: call of lol () member function for non-object in ...

But still there is no error message to redirect ...

+4
source share
2 answers

I managed to fix it! The problem was that several php files had several tabs or spaces before the <?php tags, and after the ?> Tags - when I deleted them, everything worked fine - damn PHP is a real bitch !!!

+3
source

The only thing that creates problems is that opening php in some project file is seduced by some space, a few words or a period.

0
source

Source: https://habr.com/ru/post/1411956/


All Articles