/laravel-vagrant_trial

laravel trial with original vagrant with ansible environment

Primary LanguagePHP

Description

Laravel with vagrant without homestead, valet, Laradock... Trouble shooting during start up Try to use some function

composer

https://getcomposer.org/download/ php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" php -r "if (hash_file('sha384', 'composer-setup.php') === 'e0012edf3e80b6978849f5eff0d4b4e4c79ff1609dd1e613307e16318854d24ae64f26d17af3ef0bf7cfb710ca74755a') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" php composer-setup.php php -r "unlink('composer-setup.php');" sudo mv composer.phar /usr/local/bin/composer

php - required package

sudo yum install --enablerepo=remi,remi-php73 php-pecl-zip state=latest It was already added in the recipe file. Ref-> https://qiita.com/don-bu-rakko/items/e0006a59d3714cecfbde

Laravel

Ref-> https://laravel.com/docs/7.x composer global require laravel/installer

composer global about /home/vagrant/.config/composer/vendor/bin/laravel

sudo vi ~/.bashrc and fix it as below PATH=$PATH:$HOME/.local/bin:$HOME/bin:/home/vagrant/.config/composer/vendor/bin/

top page: http://192.168.33.11/laraproject/public/

Trouble shooting

Apche log /var/log/httpd/error_log -> permission denied Vagrantfile 775 -> 777 config.vm.synced_folder "./", "/var/www/html", :mount_options => ["dmode=777", "fmode=777"]

config.vm.provision :shell, run: "always", :inline => <<-EOT
    sudo service httpd restart
EOT
  • Routing does not work It does not work when new route is created. Fix httpd.conf to add AllowOverride All /etc/httpd/conf/httpd.conf ref -> https://qiita.com/msht0511/items/b32122413745d0a3d50a

  • Show error when executing migrate SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes (SQL: alter table users add unique users_email_unique(email)) Solved by this links A temporary solution would be going to your config/database.php and change the charset and collation from utf8mb4 to utf8

'charset' => 'utf8', 'collation' => 'utf8_unicode_ci',

This happens because utf8mb4 uses 4 bytes per character, and the email column has a 255 character length which is greater than the limit 767 bytes. 255 x 4bytes = 1020b.

To fix this the email column length should be at most 191. 191 x 4 bytes = 764b. laravel/framework#24711