Have you checked the max_allowed_packet?
SQLSTATE[HY000] [2006] MySQL server has gone away (Connection: mysql, SQL: delete from cache)
Hello there,
I followed all the steps to deploy laravel project to siteground. Everything seems to be working fine until Create a deployment script step.
I'm using php 8.2 hence changing php81 to php82 other then that everything is same. When I run ./build.sh I get following error
// rest worked fine
Run composer audit for a full list of advisories.
'Live' -> '1735333763'
'1735333763/storage' -> '/home/u2515-gmvd9q5gkmdh/www/mysite.de/master/storage'
'1735333763/public/storage' -> '/home/u2515-gmvd9q5gkmdh/www/mysite.de/master/storage/app/public'
In Connection.php line 825:
SQLSTATE[HY000] [2006] MySQL server has gone away (Connection: mysql, SQL: delete from `cache`)
In Connector.php line 66:
SQLSTATE[HY000] [2006] MySQL server has gone away
In Connector.php line 66:
Packets out of order. Expected 0 received 45. Packet size=3158578
In AbstractRouteCollection.php line 247:
Unable to prepare route [userlocations/{user}] for serialization. Another route has already been assigned name [getLocations].
INFO Configuration cached successfully.
Deployed. Migrations required?
I've already created a DB and passed the correct DB name, username and password in .env file.
I googled the issue and recommended answer was to increase the max_allowed_packet in my.cnf file. I was able to ssh in my project directory. I found my.conf and tried to increase add this line max_allowed_packet=64M but it is read only.
baseos | mysite.de | [email protected]:~$ cd /etc
baseos | mysite.de | [email protected]:/etc$ ls
DIR_COLORS csh.login freetds.conf inputrc logrotate.conf networks pool.conf selinux terminfo
DIR_COLORS.lightbgcolor customer gai.conf issue logrotate.d npmrc popt.d services tmpfiles.d
GREP_COLORS dbus-1 gcrypt issue.d lynx-site.cfg nsswitch.conf printcap sgml tpm2-tss
ImageMagick-6 dconf git issue.net lynx.cfg nsswitch.conf.bkp profile shadow trusted-key.key
ImageMagick-7 debuginfod gitconfig kernel lynx.lss odbc.ini profile.d shadow- udev
Trolltech.conf default glvnd keys machine-id odbcinst.ini protocols shells unbound
X11 depmod.d gnupg krb5.conf magic openldap rarfiles.lst skel uwsgi.d
adjtime dnf groff krb5.conf.d mail.rc opt rc.d ssh uwsgi.ini
aliases dracut.conf group ld.so.cache mailcap os-release reader.conf.d ssl vimrc
alternatives dracut.conf.d group- ld.so.conf mc pam.d redhat-release statetab.d virc
apikeys environment grub.d ld.so.conf.d mime.types paperspecs redis subgid wgetrc
authselect ethertypes gshadow lftp.conf modprobe.d passwd resolv.conf subuid xattr.conf
bash_completion.d exports gshadow- libaudit.conf modules-load.d passwd- resolv.conf.bkp subversion xdg
bashrc fedora-release gss libibverbs.d motd perp rpc swid xml
bindresvport.blacklist filesystems host.conf libnl motd.d php_versions.list rpm sysconfig yum.repos.d
binfmt.d flexiblas64rc host.conf.bkp libreport mtab pkcs11 rsyncd.conf sysctl.conf
credstore flexiblas64rc.d hosts libssh my.cnf pkgconfig rwtab.d sysctl.d
credstore.encrypted flexiblasrc hosts.bkp local my.cnf.d pki sasl2 system-release
crypto-policies flexiblasrc.d httpd locales.conf nanorc pm screenrc system-release-cpe
csh.cshrc fonts inittab login.defs netconfig polkit-1 security systemd
baseos | mysite.de | [email protected]:/etc$ cat my.cnf
#
# This group is read both both by the client and the server
# use it for options that affect everything
#
[client-server]
#
# include all files from the config directory
#
!includedir /etc/my.cnf.d
baseos | mysite.de | [email protected]:/etc$ ls -l my.cnf
-rw-r--r-- 1 root root 202 Nov 28 2023 my.cnf
baseos | mysite.de | [email protected]:/etc$ chmod u+w my.cnf
chmod: changing permissions of 'my.cnf': Read-only file system
I also ran set global max_allowed_packet=64*1024*1024;
What else coule be the reason of MySQL server error? In site ground my project directory structure looks like below
My build.sh this created by @snapey
Complete guide
https://laravelsharedhosting.novate.co.uk/
Please or to participate in this conversation.