码迷,mamicode.com
首页 > 其他好文 > 详细

larave5安装过程分享-MAX OSX版本

时间:2015-04-21 20:54:14      阅读:472      评论:0      收藏:0      [点我收藏+]

标签:laravel4   openssl   php   laralvel5   osx   

MAC上的平台是XAMPP,自带的版本低。

我用的是XAMPP MAC版本


一 本地php环境配置


$which php  
$php-v | php
xampp php  PASH=" /applications/xampp/bin/:$PASH"
sudo nano vi
~/.bash_profile
export PATH="/Applications/XAMPP/bin:$PATH"
ctrl O 保存
ctrl X 退出


注:

httpd.conf.

applications/xampp/etc/httpd.conf.



二  Laravel5 安装


php 配置修改完以后


1 安装composer的几种方案

   ——官方的方案:

curl -sS https://getcomposer.org/installer | php -- --install-dir=bin
--filename

——我的方案 :下载composer.phar 最新版本


然后 

$ mv composer.phar /usr/local/bin/composer


 运行


——其他方案

在Mac OS X下也可以使用homebrew安装:

brew tap josegonzalez/homebrew-php  

brew install josegonzalez/php/composer  

不过通常情况下只需将composer.phar的位置加入到PATH环境变量就可以,不一定要全局安装。


声明依赖

在项目目录下创建一个composer.json文件,指明依赖,比如,你的项目依赖 monolog:


{

    "require": {

        "monolog/monolog": "1.2.*"

    }

}


三   安装laravel5中遇到的问题

$composer global require "laravel/installer=~1.1"


Changed current directory to /Users/macbookair/.composer
./composer.json has been created
Loading composer repositories with package information
The "https://packagist.org/packages.json" file could not be downloaded: SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
Failed to enable crypto
failed to open stream: operation failed
https://packagist.org could not be fully loaded, package information was loaded from the local cache and may be out of date
Updating dependencies (including require-dev)


                                                                               
  [Composer\Downloader\TransportException]                                     
  The "https://packagist.org/p/provider-2013$6dee6058f309a166f377fd4201f4798c  
  1bf2b7cf4e62fb55338947cff075e264.json" file could not be downloaded: SSL op  
  eration failed with code 1. OpenSSL Error messages:                          
  error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify   
  failed                                                                       
  Failed to enable crypto                                                      
  failed to open stream: operation failed            
                         
                                                                              


??????

三问题的分析和调试

PHP 5.6 的最新功能


$ php -r "print_r(openssl_get_cert_locations());"


显示的内容如下


Array
(
    [default_cert_file] => /Applications/XAMPP/xamppfiles/share/openssl/cert.pem
    [default_cert_file_env] => SSL_CERT_FILE
    [default_cert_dir] => /Applications/XAMPP/xamppfiles/share/openssl/certs
    [default_cert_dir_env] => SSL_CERT_DIR
    [default_private_dir] => /Applications/XAMPP/xamppfiles/share/openssl/private
    [default_default_cert_area] => /Applications/XAMPP/xamppfiles/share/openssl
    [ini_cafile] => 
    [ini_capath] => 
)


红色部分表示没有文件


修正方法:通过brew从新装一下openssl


 $brew install openssl


YJ-MACBOOK:~ macbookair$ brew install openss
Error: No available formula for openss 
Searching formulae...
openssl
Searching taps...
^[[A^[[A^[[A^[[A^[[A^[homebrew/versions/openssl098 homebrew/dupes/openssh
homebrew/versions/openssl101
YJ-MACBOOK:~ macbookair$ brew install openssl
==> Installing openssl dependency: makedepend
==> Downloading https://homebrew.bintray.com/bottles/makedepend-1.0.5.lion.bottl
######################################################################## 100.0%
==> Pouring makedepend-1.0.5.lion.bottle.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink bin/makedepend
/usr/local/bin is not writable.


You can try again using:
  brew link makedepend
==> Summary
�?  /usr/local/Cellar/makedepend/1.0.5: 7 files,  96K
==> Installing openssl
==> Downloading https://www.openssl.org/source/openssl-1.0.2a.tar.gz


curl: (28) SSL connection timeout
Trying a mirror...
==> Downloading https://raw.githubusercontent.com/DomT4/LibreMirror/master/OpenS


curl: (7) couldn‘t connect to host
Error: Failed to download resource "openssl"
Download failed: https://raw.githubusercontent.com/DomT4/LibreMirror/master/OpenSSL/openssl-1.0.2a.tar.gz
  



sh-3.2# chmod 777 bin ——修改bin为可写

sh-3.2# brew link makedepend
Linking /usr/local/Cellar/makedepend/1.0.5... 2 symlinks created
sh-3.2# brew install openssl ——  安装成功
==> Downloading https://www.openssl.org/source/openssl-1.0.2a.tar.gz
######################################################################## 100.0%
==> perl ./Configure --prefix=/usr/local/Cellar/openssl/1.0.2a-1 --openssldir=/u
==> make depend
==> make
==> make test
==> make install MANDIR=/usr/local/Cellar/openssl/1.0.2a-1/share/man MANSUFFIX=s
==> Caveats
A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
  /usr/local/etc/openssl/certs
…………………………………………
….

最后在php.ini 中加入

openssl.cafile=/usr/local/etc/openssl/cert.pem

sh-3.2# composer global require "laravel/installer=~1.1"   
Changed current directory to /var/root/.composer
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)

…………………….

OK  




larave5安装过程分享-MAX OSX版本

标签:laravel4   openssl   php   laralvel5   osx   

原文地址:http://blog.csdn.net/weimine/article/details/45173575

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!