`
sillycat
  • 浏览: 2551244 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

Laravel PHP Framework(1)Introduction and Installation

 
阅读更多
Laravel PHP Framework(1)Introduction and Installation

Check PHP is on my Local Machine

> php --version
PHP 7.1.16 (cli) (built: Mar 31 2018 02:59:59) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies

I am following the document to do with Laravel 5.6
PHP >= 7.1.3
OpenSSL PHP Extension
PDO PHP Extension
Mbstring PHP Extension
Tokenizer PHP Extension
XML PHP Extension
Ctype PHP Extension
JSON PHP Extension

> composer --version
Composer version 1.6.5 2018-05-04 11:44:59

Download the installer
> composer global require "laravel/installer"

Make sure it is in the PATH
export PATH=/Users/hluo/.composer/vendor/bin:$PATH

Check the version
> laravel -V
Laravel Installer 2.0.1

List all the command
> laravel list
Laravel Installer 2.0.1
Usage:
  command [options] [arguments]

Create a sample project to demo
> laravel new blogdemo

It will create a project with all dependencies in blogdemo directory.
You can find all PHP package from here
https://packagist.org/

Make sublime open current folder
> sudo ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl /usr/local/bin/subl
> subl .

It is pretty easy, that is cool.

> php artisan -V
Laravel Framework 5.6.29

Set Up MySQL 5.7 On MAC
https://dev.mysql.com/downloads/mysql/5.7.html#downloads
Temp password for root t?%VFE>kH4(M

Once we download the mysql server, we can download the MySQL Workbench and MySQL Shell.
In the Workbench, we can start one MySQL instance and reset the root password as we needed.
Then I can use the username and password to login in that console.
> mysql -h localhost -u carl -p

Create the database we need
> create database sillycat;

Grant the permission
> GRANT ALL ON sillycat.* TO sillycat@localhost IDENTIFIED BY '12345678';

Then we can logon on that database easily
> mysql -u sillycat -h localhost -p12345678

Import the data into that database
> mysql -u sillycat -h localhost -p12345678 sillycat </Users/hluo/work/sillycat/docs/sillycat.sql

I got the latest nodeJS environment
> node --version && npm --version
v8.11.3
5.6.0

When I do
> composer install

I got the error message about PHP environment
Problem 1
    - Installation request for fgrosse/phpasn1 2.0.1 -> satisfiable by fgrosse/phpasn1[2.0.1].
    - fgrosse/phpasn1 2.0.1 requires ext-gmp * -> the requested PHP extension gmp is missing from your system.
Problem 2
    - Installation request for laravel/horizon v1.2.3 -> satisfiable by laravel/horizon[v1.2.3].
    - laravel/horizon v1.2.3 requires ext-pcntl * -> the requested PHP extension pcntl is missing from your system.

Upgrade my PHP
https://php-osx.liip.ch/
> curl -s http://php-osx.liip.ch/install.sh | bash -s 7.2
Add this to the PATH
export PATH=/usr/local/php5/bin:$PATH
> php --version
PHP 7.2.9 (cli) (built: Aug 21 2018 07:42:00) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.9, Copyright (c) 1999-2018, by Zend Technologies
    with Xdebug v2.6.1, Copyright (c) 2002-2018, by Derick Rethans

When I go to the directory, I saw the file  /usr/local/php5/lib/php/extensions/no-debug-non-zts-20170718/gmp.so
Find the ini file
> php --ini
Configuration File (php.ini) Path: /usr/local/php5/lib
Loaded Configuration File:         /usr/local/php5/lib/php.ini

> sudo vi /usr/local/php5/lib/php.ini
extension=gmp

Problem solved.

Set Up Redis on Local Machine
> wget http://download.redis.io/releases/redis-4.0.11.tar.gz
Unzip the file and go to that directory
> make
> make PREFIX=/Users/hluo/tool/redis-4.0.11 install
> sudo ln -s /Users/hluo/tool/redis-4.0.11 /opt/redis-4.0.11

> redis-cli --version
redis-cli 4.0.11

We can change the redis.conf file to enable all the IP and port
bind 0.0.0.0

Command to run the server
> redis-server
Or
> redis-server ./redis.conf

Verify it is running
> redis-cli -h localhost -p 6379 ping
PONG


References:
https://laravel.com/
https://stackoverflow.com/questions/26402472/open-a-folder-in-sublime-text-3-using-command-line
https://packagist.org/
https://laracasts.com/series/laravel-from-scratch-2017/episodes/2?autoplay=true


分享到:
评论

相关推荐

    Laravel开发-laravel_framework

    在 `laravel_framework-master` 文件中,我们可以找到一个 Laravel 项目的源码,这包括了项目的配置、模型、控制器、视图、路由、中间件等组成部分。通过学习和研究这个项目,你可以更深入地理解 Laravel 框架的实践...

    Laravel开发-framework

    1. **优雅的语法**:Laravel 采用艺术级的语法设计,如路由定义、控制器定义、模板引擎 Blade 等,使得代码更易读、易写,提高了开发者的编码体验。 2. **Eloquent ORM**:Laravel 提供了 Eloquent 对象关系映射...

    Laravel Application Development Blueprints

    Laravel is a clean and classy framework for PHP web development. It helps you to create wonderful applications using simple, expressive syntax. Development should be a creative and enjoyable ...

    只读 Illuminate Redis 组件的子树拆分(参见 laravel,framework).zip

    [只读] Illuminate Redis 组件的子树拆分(参见 laravel/framework)MIT 许可证 (MIT)版权所有 (c) Taylor Otwell特此授予获得此软件和相关文档文件(“软件”)副本的任何人免费许可,以无限制方式处理软件,包括但...

    Laravel Up and Running A Framework for Building Modern PHP Apps 无水印pdf

    Laravel Up and Running A Framework for Building Modern PHP Apps 英文无水印pdf pdf所有页面使用FoxitReader和PDF-XChangeViewer测试都可以打开 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本...

    Laravel 7.0 中文文档.pdf

    1. **Blade 模板**:Blade 是 Laravel 的模版引擎,支持 PHP 代码直接嵌入,提供了简洁的语法。 2. **本地化**:Laravel 支持多语言,可以轻松实现应用的国际化。 3. **前端脚手架**:Laravel Mix 提供了 Webpack ...

    learning-laravel-framework-spring-2020-2021-sec-b-源码.rar

    本资源"learning-laravel-framework-spring-2020-2021-sec-b-源码.zip"是针对2020年至2021年春季期间,Laravel框架学习课程的第二部分源码,旨在帮助开发者深入理解并熟练掌握Laravel的高级特性。 1. **路由系统**...

    laravel up and running a framework for building modern php apps

    《Laravel: Up and Running A Framework for Building Modern PHP Apps》是由Matthew E. Stauffer所著的书籍,讲述了Laravel框架的使用方法和相关概念。Laravel是一个高级的PHP框架,它提供了构建现代Web应用程序所...

    Laravel Up & Running 2nd Edition.epub

    Matt Stauffer—a leading teacher and developer in the Laravel community—delivers a high-level overview and concrete examples to help experienced PHP web developers get started with Laravel right away...

    Laravel PHP Framework软件包,仅需几个步骤即可向您的应用程序添加完整的实时聊天系统。-PHP开发

    Chatify Laravel软件包这是一个Laravel软件包,用于通过一个命令行向您的应用程序添加完整的实时聊天系统。 要求PHP&gt; = 5.3.2。 Laravel&gt; = 5.4 Pusher Api帐户。 Chatify Laravel软件包这是一个Laravel软件包,可...

    Laravel开发-cqrs-es-framework-laravel

    综上所述,"Laravel开发-cqrs-es-framework-laravel" 提供了一个框架,使开发者能够在Laravel环境中利用CQRS和ES原则构建更高效、可扩展和可维护的应用程序。通过适配器,这个框架能够无缝地融入Laravel的生态系统,...

    Dayle Rees - Laravel - Code Smart - 2016

    The 'Code' books have thousands of readers and are considered by many to be the most effective method of learning the Laravel framework. As always, my books serve as both an introduction for ...

Global site tag (gtag.js) - Google Analytics