首页 > 代码库 > Lavarel下ngix和apache下运行
Lavarel下ngix和apache下运行
[php] view plain copy
- 1.进入终端后查看php版本
- php -v
- 输出可能如下:
- PHP 5.4.35 (cli) (built: Nov 14 2014 07:04:10) Copyright (c) 1997-2014 The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2015, by Zend Technologies
[php] view plain copy
- 2.执行下面的命令升级软件仓库
- rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm
- rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
[php] view plain copy
- 3.执行下面的命令删除php
- yum remove php-common
- 然后像安装那样问你是否继续的,输入yes即可
[php] view plain copy
- 4.安装php 5.6版本(php56w-devel这个不是必需的)
- yum install -y php56w php56w-opcache php56w-xml php56w-mcrypt php56w-gd php56w-devel php56w-mysql php56w-intl php56w-mbstring
[php] view plain copy
- 5.重启httpd
- service httpd restart
- 查看最新的版本
- php -v
- 现在应该是5.6了!
CentOS 7安装Laravel:
添加两个仓库:
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
安装PHP:
yum install php56w php56w-mysql php56w-mcrypt php56w-dom php56w-mbstring
安装apache和Mariadb:
yum install httpd mariadb mariadb-server
启动Mariadb服务:
systemctl start mariadb
systemctl enable mariadb
启动httpd服务:
systemctl start httpd
systemctl enable httpd
Mariadb数据库root密码默认为空,运行MySQL初始化脚本:
mysql_secure_installation
安装composer:
curl -sS https://getcomposer.org/installer | php
chmod +x composer.phar
mv composer.phar /usr/local/bin/composer
从Github clone Laravel源码:
cd /var/www
git clone https://github.com/laravel/laravel
安装Laravel:
cd laravel
composer install
设置文件权限:
chown -R apache:apache /var/www/laravel
chmod -R 755 /var/www/laravel
创建.env配置文件:
mv .env.example .env
生成App key:
php artisan key:generate
编辑config/app.php,把上面生成的key写入:
配置Apache,创建Virtual Host:
vim /etc/httpd/conf.d/laravel.conf
写入:
<VirtualHost *:80>
DocumentRoot /var/www/laravel/public
ServerName your_domain.com
<Directory /var/www/laravel/>
AllowOverride All
</Directory>
</VirtualHost>
重启Apache服务:
systemctl restart httpd
Lavarel下ngix和apache下运行
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。