一直以来,PHP都是用的默认配置,接触到的业务对网站并没有什么特殊要求,本人比较懒,一般都是用一键环境,都是已经优化好了。很少去改动配置文件,但之后自己搭建平台时就遇到了很多问题,某些插件没有啊,缓存设置不当啊,等等,所以也打算积累一些PHP相关的知识。

几个有用的PHP.ini配置项-路径和目录(网上看到的,还未进行测试)

路径和目录
1、include_path = string
作用域:PHP_INI_ALL
默认值:NULL
此参数指定的路径是include()、require()和fopen_with_path()等函数使用的基本路径。若存在多个目录,用分号分隔。

2、doc_root = string
作用域:PHP_INI_SYSTEM
默认值:NULL
此参数确定提供所有PHP脚本的默认位置。非空时才生效。

3、user_dir = string
作用域:PHP_INI_SYSTEM
默认值:NULL
指定在使用/~usesrname约定打开文件时PHP所使用的绝对目录。例如:当user_dir设置为/home/users时,如果一个用户试图打开文件~/gilmore/book.txt,PHP就会知道绝对路径/home/users/gilmore/book.txt。

4、extension_dir = string
作用域:PHP_INI_SYSTEM
默认值:./(在windows上,默认为ext)
告诉PHP可加载扩展模块的位置。

5、enable_dl = On | Off
作用域:PHP_INI_SYSTEM
默认值:Off
允许用户在运行时加载PHP扩展,即在脚本运行期间加载。


CI框架报错

# 报错
A Database Error Occurred
Unable to connect to your database server using the provided settings.
Filename: core/Loader.php
Line Number: 346

修改:/application/config/database.php

$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
改为:
$db['default']['pconnect'] = FALSE;
$db['default']['db_debug'] = FALSE;

一般 db_debug 这个置false就可以了。

thinkphp框架

Warning: require(): open_basedir restriction in effect. File(/www/wwwroot/Smovie/thinkphp/start.php) is not within the allowed path(s): (/www/wwwroot/Smovie/public/:/tmp/:/proc/) in /www/wwwroot/Smovie/public/index.php on line 28

Warning: require(/www/wwwroot/Smovie/thinkphp/start.php): failed to open stream: Operation not permitted in /www/wwwroot/Smovie/public/index.php on line 28

Fatal error: require(): Failed opening required '/www/wwwroot/Smovie/public/../thinkphp/start.php' (include_path='.:/www/server/php/72/lib/php') in /www/wwwroot/Smovie/public/index.php on line 28
文章作者: Leo
版权声明: 本站所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 LeoLan的小站
环境搭建 php
喜欢就支持一下吧