简体   繁体   中英

Linking Laravel project with MAMP database

I am following a tutorial on creating a social network with Laravel v5.2. However the person in the tutorial uses Vagrant/Homestead but for the life of me I could not get that working so I resorted to MAMP to view my site locally. But now I have hit another roadblock.

I am trying to configure the ".env" file to connect to my MAMP database so that the migrations that have been written can be executed by I don't know how to go about this?

This is my ".env" file.

APP_ENV=local
APP_DEBUG=true
APP_KEY=base64:7dP18Ga9X3wiFP6wQgUy6UsMu+RrgrU2QpkT4gyDUpI=
APP_URL=http://localhost

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=uniteDB
DB_USERNAME=root
DB_PASSWORD=root

CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null

"UniteDB" is the database I created in the MAMP PHPMy Admin but that did not work and I don't know where to go from here. If I try run "PHP artisan migrate" on the command line within my project file it returns

"[Symfony\\Component\\Debug\\Exception\\FatalThrowableError] Parse error: syntax error, unexpected end of file, expecting function (T_FUNCTION)"

Any help would be greatly appreciated! I am new to PHP/Laravel so I have no clue on how to get this to work.

Thanks.

It is just a syntactical error. Most decent IDEs will highlight or underline the error in your project files. It is likely that the issue is in some of your migration files (based on the $table variable) but it could also be in any place that contains code being executed when migrating (eg: the Schema class).

It sounds like you have a missing semicolon in your migration file. show me your migration file if you cannot solve the problem

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM