adr1enbe4udou1n / laravel-boilerplate

Laravel 5.7 Boilerplate based on Bootstrap 4 and Vue Tabler for Backend.
https://laravel-boilerplate.okami101.io
MIT License
260 stars 107 forks source link

Gateway Timeout on Production #75

Closed webdesign7 closed 6 years ago

webdesign7 commented 6 years ago

Hello,

Not sure what the issue is but I deployed website to a production and I am getting

Gateway Timeout
The gateway did not receive a timely response from the upstream server or application.

when I go into blog post detail page

All other pages are working like contact , blog list , about but when I go into view a post then it takes a while to load and then I got gateway timeout ?

Any ideas ?

Thanks Sergiu C.

webdesign7 commented 6 years ago

After some debugging I discovered I am getting this as well

(3/3) QueryException SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '>'$."en"' = ? limit 1' at line 1 (SQL: select * from product_categories where slug->'$."en"' = cold-water-prawns limit 1)

webdesign7 commented 6 years ago

I think I figured out .. is because of lower version of mysql / phpmyadmin on the server I deployed. I think it doesn't support json queries ?

adr1enbe4udou1n commented 6 years ago

Hello,

Yeah spatie/laravel-translatable which is used in this boilerplate require at least Mysql 5.7

webdesign7 commented 6 years ago

Bad.. :( .. server admins don't want to update this as its a shared server .. any solution? clean dirty doesn't matter ??

shirshak55 commented 6 years ago

@webdesign7 hmm bro I guess its better to use laravel in dedicated server so that you are not entitled to various risk.

webdesign7 commented 6 years ago

I wish but the client can't afford it ...

webdesign7 commented 6 years ago

This is a show stopper for me now ...

webdesign7 commented 6 years ago

keep talking to myself :)) What if instead of this:

if ($post = $this->query()->where("slug->{$locale}", $slug)->first()) {
         return $post;
}

I do this:

        if ($post = $this->query()->where("slug",'LIKE', '%' . $slug . '%')->first()) {
            return $post;
        }
shirshak55 commented 6 years ago

@webdesign7 Bro the field in database is in JSON. So I guess you should try to switch to postgresql or sqlite maybe? Postgresql supports Json . Try sqlite it may work.

Bro i guess there are lot of shared hosting at cheap price you can try another . Thanks

adr1enbe4udou1n commented 6 years ago

If you really need translation and force to use low MySQL, maybe your best chance is to switch to https://github.com/dimsav/laravel-translatable which i used before. But plan 1-2 days of work ^^

Luckily this commit will help you a lot in that task. So it's definitly doable. Good luck ;)

webdesign7 commented 6 years ago

Thanks @adr1enbe4udou1n appreciate that .. If I would use SQLite , would it work ? would relations work ?

Regards

webdesign7 commented 6 years ago

@bloggervista I tried postgress and still no luck :(( getting same things timeout gateway

adr1enbe4udou1n commented 6 years ago

Sorry but SQLite will not work either :(

But strange that postgres (which supports json) dont work :@, if it's really the case what a shame...

@bloggervista i'm asking now myself if i should rollback to dimsav/laravel-translatable, sure its a boring way to do translations but it's battle tested for all environnements...

adr1enbe4udou1n commented 6 years ago

Laravel docs states that where clause support MySQL 5.7 and PostgreSQL

webdesign7 commented 6 years ago

Hmm, weird then... I tried with PostgreSQL 8.4.20 .. Any specific version i need to use ? What I noticed is that there is no json field type ..

adr1enbe4udou1n commented 6 years ago

You need at least PostgreSQL 9.2 which adds JSON type support

shirshak55 commented 6 years ago

And we cannot do anything about JSON support because many package like laravel taggable, mediable etc uses JSON field type. Meaning we would need to change many things.

This boilerplate will be released to even upcoming 5.7 and i guess it requires PHP 7.1 minimum . So i guess shared hosting may not support it .

shirshak55 commented 6 years ago

I am using postgres and it is working better than Mysql.

@adr1enbe4udou1n hmm if this was case for dedicated hosting we should have considered it. But in shared hosting security is too problematic as we cannot point apache or nginx to public folder. There is no support for git etc... I worked on shared hosting and it was nightmare some shared hosting even don't have various extension enabled that laravel requires.