Laravel Execute migrate command prompt: No Such solution _php instance of file or directory

Source: Internet
Author: User
Tags smarty template

This article describes the Laravel execution migrate command prompt: No Such a workaround for file or directory. Share to everyone for your reference, specific as follows:

Today using the Laravel command-line tool to manipulate the database migration operations times wrong, prompted MySQL 2002 error, as shown in figure:

View database configuration Yes, the site can also open the front desk, the explanation can connect, that is what reason?

In Laravel5, there are two ways to solve this problem:

1. Add a Database configuration entry

' MySQL ' => ['
  driver '  => ' mysql ',
  ' host '   => env (' db_host ', ' localhost '),
  ' database ' = > env (' db_database ', ' Forge '),
  ' username ' => env (' db_username ', ' Forge '),
  ' password ' => env (' Db_ PASSWORD ', '),
  ' charset '  => ' UTF8 ',
  ' collation  ' => ' utf8_general_ci ', ' unix_socket ' => '/applications/mamp/tmp/mysql/mysql.sock ',
  ' prefix '  => ' laravel_ ',
  ' strict '  => False,
],

One of the added here is Unix_socket, the MAMP environment on the MAC, the path is/applications/mamp/tmp/mysql/mysql.sock, the way to view your path is to enter the following command in MySQL to see:

Show variables like '%sock% ';

As shown in the following illustration:

2. Modify. ENV Configuration

This method can only be temporarily modified, so that migrate can be executed, and then must be changed back.

Db_host=localhost
db_connection=mysql
db_database=laravel
db_username=root
Db_password=tanteng
db_port=8889

The temporary modification is to change the db_host there to localhost:8889, that is, add the port number, and then use the Laravel5 Artisan command to perform the migrate operation, but the operation is changed back to the previous wording, Otherwise the site front page will not open the database, prompt error: sqlstate[hy000] [Unknown] MySQL server Host ' localhost:8889 ' (0)

Well, this solves the problem of using the Laravel5 migrate error.

Turn from: Small Talk blog Http://www.tantengvip.com/2015/12/laravel-migrate-mysql-2000/

More interested in laravel related content readers can view the site topics: "Laravel Framework Introduction and Advanced Course", "PHP Excellent Development Framework Summary", "Smarty Template Primer Tutorial", "PHP date and Time usage summary", "PHP object-oriented Program Design Introductory Course ", PHP string (String) Usage summary," PHP+MYSQL Database operation Introduction Tutorial "and" PHP common database Operation Skills Summary "

I hope this article will help you with the PHP program design based on Laravel framework.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.