您好,欢迎访问一九零五行业门户网

php基本配置

找到php配置文件,查看配置文件路径命令:/usr/local/php/bin/php -i |head
1. 配置disable_function
disable_functions = eval,assert,popen,passthru,escapeshellarg,escapeshellcmd,passthru,exec,system,chroot,scandir,chgrp,chown,escapeshellcmd,escapeshellarg,shell_exec,proc_get_status,ini_alter,ini_restore,dl,pfsockopen,openlog,syslog,readlink,symlink,leak,popepassthru,stream_socket_server,popen,proc_open,proc_close
使用命令可以查看禁止的函数:/usr/local/php/bin/php -i |grep disable_f
出现一个警告,这里我们配置一下时区即可:date.timezone='asia/chongqing'
2. 配置error_log
打开php.ini,找到如下选项进行配置
display_errors=off
log_errors=on
error_log=/path/to/logfile
error_reporting = e_all & ~e_notice
错误级别参考
; e_all             所有错误和警告(除e_strict外)
; e_error           致命的错误。脚本的执行被暂停。
; e_recoverable_error    大多数的致命错误。
; e_warning         非致命的运行时错误,只是警告,脚本的执行不会停止。
; e_parse            编译时解析错误,解析错误应该只由分析器生成。
; e_notice          脚本运行时产生的提醒(往往是我们写的脚本里面的一些bug,比如某个变量没有定义),这个错误不会导致任务中断。
; e_strict          脚本运行时产生的提醒信息,会包含一些php抛出的让我们要如何修改的建议信息。
; e_core_error      在php启动后发生的致命性错误
; e_core_warning    在php启动后发生的非致命性错误,也就是警告信息
; e_compile_error    php编译时产生的致命性错误
; e_compile_warning  php编译时产生的警告信息
; e_user_error       用户生成的错误
; e_user_warning    用户生成的警告
; e_user_notice      用户生成的提醒
3. 配置open_basedir
全局配置:php.ini: open_basedir = /dir1/:/dir2
针对虚拟机配置:httpd-vhost.conf: php_admin_value open_basedir /dir1/:/dir2/
4. 安装php的扩展模块(memcache)
memcache在php中编译
#  wget http://www.lishiming.net/data/attachment/forum/memcache-2.2.3.tgz
# tar zxvf memcache-2.2.3.tgz
# cd memcache-2.2.3
# /usr/local/php/bin/phpize
# ./configure --with-php-config=/usr/local/php/bin/php-config
# make
# make install
# cp modules/memcache.so /usr/local/php/ext/   //把memcache.so 拷贝至php的extension_dir下,#查看php extension_dir的方法是  /usr/local/php/bin/php -i |grep extension_dir 
修改扩展路径,在php.ini中修改:
extension_dir = /usr/local/php/ext
然后在php.ini 中添加
extension = memcache.so
保存后可以利用 /usr/local/php/bin/php -m  检测和查看具体的参数
memcached 的编译安装
wget http://syslab.comsenz.com/downloads/linux/memcached-1.4.5.tar.gz
tar zxvf memcached-1.2.8.tar.gz
cd  memcached-1.2.8
./configure --prefix=/usr/local/memcached
make && make install
启动:
/usr/local/memcached/bin/memcached -m 2048 -p 11211 -l 127.0.0.1 -d -u www
-m  后边指定memecached使用多少内存,单位是m
-p  指定memcached 启动端口
-l  指定绑定的ip
-u  指定以某个账户的身份启动
。。。
其它类似信息

推荐信息