Atiti. Php Laravel 5.1 环境搭建以及 error 排除
Atiti. Php Laravel 5.1 环境搭建以及 error 排除
1.1. Httpd。Conf增加以下配置,添加php支持1
2.1. laravel 5.1 unexpected T_STRING Illuminate Contracts—Http Kernel lass2
2.4. Fatal error: Call to undefined function Illuminate\Foundation\Bootstrap\mb_internal_encoding4
2.5. apache documentroot指向htcdoc之外提示403错误的解决方法5
3.1.1. rediswindows官方下载|Redis for Windows下载 2.6.13 稳定版 - ...8
1. php_5.6.11_apache2.4
1.1. Httpd。Conf增加以下配置,添加php支持
LoadModule php5_module "c:/wamp/php_5.6.11_XiaZaiBa/php5apache2_4.dll"
AddType application/x-httpd-php .php
PHPIniDir "C:\wamp\php_5.6.11_XiaZaiBa"
1.2. 修改apache位置与项目位置以及权限
Define SRVROOT "/Apache24"
DocumentRoot "${SRVROOT}/htdocs/eform/public"
<Directory "${SRVROOT}/htdocs/eform/public">
AllowOverride all
Require all granted
</Directory>
还要修改Apache24\conf\extra\httpd-vhosts.conf
<VirtualHost _default_:80>
#DocumentRoot "${SRVROOT}/htdocs"
DocumentRoot "d:/www"
#ServerName www.example.com:80
</VirtualHost>
作者:: ★(attilax)>>> 绰号:老哇的爪子 ( 全名::Attilax Akbar Al Rapanui 阿提拉克斯 阿克巴 阿尔 拉帕努伊 ) 汉字名:艾龙, EMAIL:1466519819@qq.com
转载请注明来源: http://www.cnblogs.com/attilax/
1.3. 修改php。Ini。增加mbstring,openssl,mysql,rewriting的支持
extension_dir = "C:\wamp\php_5.6.11_XiaZaiBa\ext"
- PHP >= 5.5.9 - OpenSSL PHP 扩展 - PDO PHP 扩展 - Mbstring PHP 扩展 - Tokenizer PHP 扩展
2. 错误排除
2.1. laravel 5.1 unexpected T_STRING Illuminate Contracts—Http Kernel lass
Parse error: syntax error, unexpected T_STRING in C:\wamp\www\eform\public\index.php on line 50
$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);//This is line 50
the ::class is only supported since PHP 5.5
Also you must have mistakingly installed laravel 5.1+ because that's the only version to require php 5.5+
Laravel 5.1 requires PHP 5.5.9
解决。下载 php_5.6.11_XiaZaiBa
里面需要php5apache2_4.dl,需要apache2.4
在运行Apache24/bin目录下运行httpd.exe -t时,如果出现如下错误提示信息:
2.2. httpd.exe: Syntax error on line 531 of C:/Apache24/conf/httpd.conf: Cannot load c:/php56/php5apache2_4.dll into server: \xd5\xd2\xb2\xbb\xb5\xbd\xd6\xb8\xb6\xa8\xb5\xc4\xc4\xa3\xbf\xe9\xa1\xa3
是由于php5apache2_4.dll动态链接库文件的版本与当前的php版本或Apache版本不匹配。32位64位。
通过loadpe查看 php5apache2_4.dll信息,是32位的,下载32为的apathc2.4
2.3. started.httpd:Syntax error on line 60 of D:/apache2/conf/httpd.conf:Cannot load D:/apache2/modules/mod_actions.so into server:\xd5\xd2\xb2\xbb\xb5\xbd\xd6\xb8\xb6\xa8\xb5\xc4\xa3\xbf\xe9\xa1\xa3
errors reported here must be corrected before service can be
原因:
我也遇到了这个问题,确实是由于配置ServerRoot不当导致的,仔细看了一下conf文件里面有一个说明ServerRoot: The top of the directory tree under which the server‘s等等,应该是Apache文件夹只能放在磁盘根目录下,不能放在文件夹中,不然会造成非目录错误或楼主的问题。
Define SRVROOT "/Apache24"
ServerRoot "${SRVROOT}"
将${SRVROOT} 改成你的apache安装目录
比如 我的安装目录是 在F盘中 所以改后是这样的
Define SRVROOT "/Apache24"
ServerRoot "F:/Apache24"
2.4. Fatal error: Call to undefined function Illuminate\Foundation\Bootstrap\mb_internal_encoding
10down vote |
had the same problem, solution is to enable the mbstring php extension:https://laracasts.com/discuss/channels/general-discussion/call-to-undefined-function In my case (AMPPS), I had to disable and reenable it + apache restart. |
Configuration File (php.ini) Path |
C:\Windows |
PHPIniDir "D:\wamp\bin\php\php5.4.3"
Configuration File (php.ini) Path |
C:\Windows |
Loaded Configuration File |
C:\wamp\php_5.6.11_XiaZaiBa\php.ini |
extension_dir = "ext" cantloasd ,use “./ext” hesh cant ..
extension_dir = "C:\wamp\php_5.6.11_XiaZaiBa\ext" zash ok le ..
首先用phpinfo测试页面看一下有没有装载mbstring,
mbstring
Multibyte Support |
enabled |
Multibyte string engine |
libmbfl |
HTTP input encoding translation |
disabled |
libmbfl version |
1.3.2 |
2.5. apache documentroot指向htcdoc之外提示403错误的解决方法
后来发现,原来又是Apache没配置 好,是apache的mod_authz_host模块在起控制作用。
1.如果不启用vhosts
只需修改 httpd.conf
默认Directory节如下,注意红色部分,表示目录/usr/local/apache/htdocs允许所有 主机访问
一、访问控制
在Apache2.2版本中,访问控制是基于客户端的主机名、IP地址以及客户端请求中的其他特征,使用Order(排序), Allow(允许), Deny(拒绝),Satisfy(满足)指令来实现。
在Apache2.4版本中,使用mod_authz_host这个新的模块,来实现访问控制,其他授权检查也以同样的方式来完成。旧的访问控制语句应当被新的授权认证机制所取代,即便Apache已经提供了mod_access_compat这一新模块来兼容旧语句。
这里有一些实例,用新方法取代旧语句实现相同的访问控制
:常见访问控制指令
复制代码代码如下:
Require all granted #允许所有
Require all denied #拒绝所有
Require env env-var [env-var] ... #允许,匹配环境变量中任意一个
Require method http-method [http-method] ... #允许,特定的HTTP方法
Require expr expression #允许,表达式为true
Require user userid [ userid ] ... #允许,特定用户
Require group group-name [group-name] ... #允许,特定用户组
Require valid-user # #允许,有效用户
Require ip 10 172.20 192.168.2 #允许 特定IP
在国外的网站上搜了好长时间终于找到问题了。
还要修改Apache24\conf\extra\httpd-vhosts.conf
<VirtualHost _default_:80>
#DocumentRoot "${SRVROOT}/htdocs"
DocumentRoot "d:/www"
#ServerName www.example.com:80
</VirtualHost>
希望对后来者有帮助
2.6. 开启框架调试模式
Config、app.php
'debug' => true,
//env('APP_DEBUG', false),
3. 配置Redis
前面我们已经提到Redis可以用作主数据库,所以Laravel中Redis的配置信息位于config/database.php 中:
'redis' => [ 'cluster' => false, 'default' => [ 'host' => '127.0.0.1', 'port' => 6379, 'database' => 0, ],
],
另外Redis如果是作为缓存工具,还需要在 config/cache.php 配置 redis 选项:
'redis' => [
'driver' => 'redis',
'connection' => 'default',
],
这里的 connection 对应 config/database 中 redis 的默认主机 default 配置。
完成上述配置之后我们就可以在应用代码中使用Redis进行数据存取了。
3.0.1. rediswindows官方下载|Redis for Windows下载 2.6.13 稳定版 - ...
下载地址 大小: 1.13 MB 更新时间: 2013-06-13
redis是一个key-value存储系统.和Memcached类似,它支持存储的value类型相对更多,包括string(字符串)、list(链表)、set(集合)、zset(sorted set --有序集合)...
www.newasp.net/soft/67... - 百度快照
3.1. 数据库配置
PHP数组,该配置文件提供了各种数据库可能用到的配置。connections 里包含了数据库配置。修改'default' => 'mysql',参数可以选择需要使用的数据库。
1. 'mysql' => [
2. 'driver' => 'mysql',
3. 'host' => env('DB_HOST', 'localhost'),
4. 'database' => env('DB_DATABASE', 'forge'),
5. 'username' => env('DB_USERNAME', 'forge'),
6. 'password' => env('DB_PASSWORD', ''),
7. 'charset' => 'utf8',
8. 'collation' => 'utf8_unicode_ci',
9. 'prefix' => '',
10. 'strict' => false,
11. ],
上面是默认的MySQL配置项,'host' => env('DB_HOST', 'localhost'),中env()方法就是读取.env文件中的配置项,它的第二个参数是默认值。当然也可以通过'password' => 'password',直接配置,但是如果我们把项目存放到GitHub上时,这么做显然是不安全的。可以通过读取.env配置文件中的配置,然后把.env配置文件设置为不提交来解决,这也是通过.env配置文件来配置的一个好处。
打开项目根目录下的.gitignore文件,可以看到.env默认是不会被提交的。
参考
[Laravel 5 教程学习笔记] 六、环境与配置 _ Specs' Blog-就爱PHP.html
4. --fihi是、
Atiti. Php Laravel 5.1 环境搭建以及 error 排除的更多相关文章
- PHP Laravel 5.4 环境搭建
1.php运行环境搭建 在win10系统上进行搭建的,使用的是wamp环境 wampserver3_x86_apache2.4.17_mysql5.7.9_php5.6.15.exe,安装包中集成了 ...
- 关于 ReactNative 环境搭建之 error: invalid developer directory '/Library/Developer/CommandLineTools' - RN
简要说明,此次尝试安装 ReactNative 时当前 MacPro 版本为 10.13.6.Xcode 版本为 Version 9.4.1 (9F2000),按照官方的完整原生环境搭建流程一步步执行 ...
- Laravel系列之环境搭建 — VirtualBox+Vagrant+Homestead
一.为啥需要搭建环境 为了解决环境不统一问题,所以要搭建这么个玩意儿 二.步骤 Laravel对环境有所要求(不使用Homestead情况下),具体参考官网 使用Homestead步骤 1. Hom ...
- PHP Laravel系列之环境搭建( VirtualBox+Vagrant+Homestead+系列网址)
搭建环境从来都是阻挡一门新技能的最致命的硬伤,为了这个环境,我又是花费了半天的时间,各种问题层出不穷,下面基于网上的一些教程(我看到的都多少有些问题) 开始的时候是在实验楼这个平台上开始学习的,不过 ...
- selenium环境搭建:Error: could not find java.dll 报错问题
搭建java环境,参照其他的安装步骤,搭建即可. 问题:出现如下报错信息. Error: could not find java.dll Error: Could not find Java SE R ...
- php开发环境搭建——laravel框架,apache服务器,git版本控制
本文主要阐述做项目前的开发环境安装——后端为php,前端采用grunt进行自动化构建.具体介绍了windows平台下采用apache运行php的环境搭建,以及git工具安装.写得有点粗糙,但过程完整, ...
- Laravel 开发环境搭建 - Windows
Laravel 开发环境搭建 - Windows : https://laravel-china.org/docs/laravel-development-environment/5.5/dev ...
- 基于Centos搭建Laravel 环境搭建
系统要求:CentOS 7.2 64 位操作系统 安装 Laravel Laravel 简介 Laravel 是一套简洁.优雅的 PHP Web 开发框架.它可以让你从面条一样杂乱的代码中解脱出来:它 ...
- 【nginx,apache】thinkphp ,laravel,yii2开发运行环境搭建
缘由 经常会有人问xx框架怎么配置运行环境,这里我就给贴出吉祥三宝(Yii2,Laravel5,Thinkphp5 )的Nginx和Apache的配置,供大家参考 Nginx Yii2 server ...
随机推荐
- Migrating Oracle on UNIX to SQL Server on Windows
Appendices Published: April 27, 2005 On This Page Appendix A: SQL Server for Oracle Professionals Ap ...
- CSS3技巧:fit-content水平居中
当我们让一个模块水平居中首先想到的肯定是margin:0 auto;有木有?那么今天给大家介绍一个fit-content属性,不知道有没有同学用过,如果用过那么你可以略过这篇文章,没用过的同学就继续了 ...
- ecplise配置maven项目
1.新增环境变量 M2_HOME C:\Users\Administrator\Desktop\Java\maven\apache-maven-3.3.1 2.配置PATH路径 ;%M2_HOME ...
- cas如何去掉HTTPS认证?
说明:默认情况下HTTP也是可以访问CAS SERVER的,但认证,登陆,退出等操作均没有任何的效果.所以必须作出下面的修改 1.进入WEB-INF\spring-configuration目录 打 ...
- war后缀的文件
其实war文件就是Java中web应用程序的打包.借用一个老兄的话,"当你一个web应用程序很多的时候,如果你想把它部署到别的机器上,来回拷这些文件是件挺郁闷的事情,如果要是一个文件就好了. ...
- python利用os和getopt实现删除指定文件
工作中经常遇到要删除某些目录下的特定文件 例如删除xxx目录下的所有test开头文件或者.pyc结尾的文件 如果手动删除的话,很麻烦,写个程序自动删除 只需要运行的时候输入路径和文件名即可,不输入文件 ...
- [Python爬虫] 之十四:Selenium +phantomjs抓取媒介360数据
具体代码如下: # coding=utf-8import osimport refrom selenium import webdriverimport selenium.webdriver.supp ...
- Razor语法(四)
1. @代表开始一个Razor代码块,Razor会自动匹配代码中的花括号,比如@if(p.Active){<li>@p.Name</li>} 2. @{code}标识一个Raz ...
- JDK自带内存及线程分析工具
转载:http://blog.csdn.net/kimylrong/article/details/50970493 查询.监控.分析Java应用程序的时候,我们关注的点主要集中在资源利用,比如CPU ...
- Kolla 4.0.0环境下VIP无法迁移问题排查
VRRP无法切换VIP的问题分析: Keepalived的配置文件:/etc/kolla/keepalived/keepalived.conf当中,nopreempt选项是影响切换的因素之一,另一个因 ...