Error installing laravel 5.6 app on remote hosting

Published 2 months ago by mstdmstd

Hello, I am trying to install my laravel 5.6 app on remote hosting(digital ocean, Ubuntu 16.04.3)

I set DocumentRoot in /etc/apache2/sites-available to /public of my app

I added line in /etc/apache2/apache2.conf

ServerName localhost

and set all :

AllowOverride All

I made

a2enmod rewrite

and

sudo service apache2 restart

and

# sudo apache2ctl configtest
Syntax OK

Running in browser I got message

This page isn’t working
NNN.NN.NN.NNN is currently unable to handle this request.
HTTP ERROR 500

As I see error code my web hosting ok, that is some specific intermal error? But I want to see laravel error?

I run

sudo chmod -R 777 /var/www/html/box-booking/storage

log dir is empty:

and [email protected]:/var/www/html/box-booking/storage/logs# ls -la
total 12
drwxr-xr-x 2 root root 4096 Jul 22 06:13 .
drwxr-xr-x 6 root root 4096 Jul 22 06:13 ..
-rwxr-xr-x 1 root root   14 Jul 22 06:13 .gitignore

In my .env :

APP_NAME=Laravel
APP_ENV=local
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_URL=http://NNN.NN.

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306

In my /config/app.php I changed: 'env' => 'local', 'debug' => true,


But I stiil can not see any error...

Is it some cache of config? How to see the errors?

Thanks!
Sergiu17

Try /var/log/apache/access.log or /var/log/apache2/access.log or /var/log/httpd/access.log. This are apache logs, see what's there!

kordix

I was having similiar issues, beside storage there is bootstrap folder to set chmods

Snapey
Snapey
2 months ago (1,036,815 XP)

your Log folder is owned by root and is not writable by anyone else

in your /var/www/html folder, run

sudo chown -R www-data:www-data box-booking

mstdmstd

Thank you for your hints! I opened /var/log/apache2/error.log file and found error that vendor directory was absent I pulled vendor directory and I got on screen error that some fields in tables were absent.

I created new database with fresh db dump and set name to this db in .env file.

But the browse opened only error:

This page isn’t working
139.59.34.234 is currently unable to handle this request.
HTTP ERROR 500

I opened /var/log/apache2/error.log and see errors like

[Sun Jul 22 11:33:56.898685 2018] [php7:error] [pid 26467] [client 213.109.234.130:34476] PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) in /var/www/html/box-booking/vendor/doctrine/db$
[Sun Jul 22 11:33:56.898875 2018] [php7:error] [pid 26467] [client 213.109.234.130:34476] PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) in /var/www/html/box-booking/vendor/laravel/fra$
[Sun Jul 22 11:33:58.387797 2018] [php7:error] [pid 26469] [client 213.109.234.130:34474] PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) in /var/www/html/box-booking/vendor/doctrine/db$
[Sun Jul 22 11:33:58.388057 2018] [php7:error] [pid 26469] [client 213.109.234.130:34474] PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) in /var/www/html/box-booking/vendor/laravel/fra$

Some my system parameters :

# df -HT 
Filesystem     Type      Size  Used Avail Use% Mounted on
udev           devtmpfs  1.1G     0  1.1G   0% /dev
tmpfs          tmpfs     210M   22M  189M  11% /run
/dev/vda1      ext4       52G  3.9G   48G   8% /
tmpfs          tmpfs     1.1G     0  1.1G   0% /dev/shm
tmpfs          tmpfs     5.3M     0  5.3M   0% /run/lock
tmpfs          tmpfs     1.1G     0  1.1G   0% /sys/fs/cgroup
/dev/vda15     vfat      110M  3.6M  106M   4% /boot/efi
tmpfs          tmpfs     210M     0  210M   0% /run/user/0
PHP Version 7.1.17-1+ubuntu16.04.1+deb.sury.org+1

from php info output:

memory_limit    128M    128M
Zend OPcache
Opcode Caching  Up and Running
Optimization    Enabled
SHM Cache   Enabled
File Cache  Disabled
Startup OK
Shared memory model mmap
Cache hits  13817PHP Version 7.1.17-1+ubuntu16.04.1+deb.sury.org+1

Cache misses    566
Used memory 26793008
Free memory 107388984
Wasted memory   35736
Interned Strings Used memory    1964456
Interned Strings Free memory    6424152



opcache.memory_consumption  128 128
opcache.opt_debug_level 0   0
opcache.optimization_level  0x7FFFBFFF  0x7FFFBFFF
opcache.preferred_memory_model  no value    no value
opcache.protect_memory  0

Why errors and how to fix it ?

mstdmstd

Also a question : have I to add /vendor/ dir into git or is it autogenerated?

Snapey
Snapey
2 months ago (1,036,815 XP)

No you don't add vendor to your git version control.

You add composer.lock and composer.json

When you install, you must run composer install --no-dev. It will look at composer.lock and pull in all the vendor packages that you used in development (except for those you marked as development only in composer.json)

Please sign in or create an account to participate in this conversation.