Atiti. Php Laravel 5.1 环境搭建以及 error 排除php
1.1. Httpd。Conf增长如下配置,添加php支持1mysql
1.2. 修改apache位置与项目位置以及权限1laravel
2. 错误排除2redis
2.1. laravel 5.1 unexpected T_STRING Illuminate Contracts—Http Kernel lass2sql
2.4. Fatal error: Call to undefined function Illuminate\Foundation\Bootstrap\mb_internal_encoding4apache
2.5. apache documentroot指向htcdoc以外提示403错误的解决方法5
3.1.1. rediswindows官方下载|Redis for Windows下载 2.6.13 稳定版 - ...8
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"
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/
- PHP >= 5.5.9 - OpenSSL PHP 扩展 - PDO PHP 扩展 - Mbstring PHP 扩展 - Tokenizer PHP 扩展
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时,若是出现以下错误提示信息:
是因为php5apache2_4.dll动态连接库文件的版本与当前的php版本或Apache版本不匹配。32位64位。
经过loadpe查看 php5apache2_4.dll信息,是32位的,下载32为的apathc2.4
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"
|
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 |
后来发现,原来又是Apache没配置 好,是apache的mod_authz_host模块在起控制做用。
1.若是不启用vhosts
只需修改 httpd.conf
默认Directory节以下,注意红色部分,表示目录/usr/local/apache/htdocs容许全部 主机访问
1、访问控制
在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>
但愿对后来者有帮助
Config、app.php
'debug' => true,
//env('APP_DEBUG', false),
前面咱们已经提到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进行数据存取了。
下载地址 大小: 1.13 MB 更新时间: 2013-06-13
redis是一个key-value存储系统.和Memcached相似,它支持存储的value类型相对更多,包括string(字符串)、list(链表)、set(集合)、zset(sorted set --有序集合)...
www.newasp.net/soft/67... - 百度快照
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 教程学习笔记] 6、环境与配置 _ Specs' Blog-就爱PHP.html