0628~0632 php.ini php模块 my.cnf mysqlROOT密码 mysql登录0628 php.ini配置详解注释符号 ;禁用函数,305行 disable_function = eval,assert,popen,passthru,escapeshellarg,escapeshellcmd,exec system,chroot,scandir,chgrp,chown,shell_exec,proc_get_status,ini_alter,ini_restore,dl,pfsockopen,openlog,syslog,readlink,symlink,leak,popepassthru,stream_socket_server,popen,proc_open,proc_close469:display_error = off 在网页上显示php错误,应关掉490:log_errors = on 记录php错误日志 打开575:error_log = /path/to/log 日志路径mkdir /path/to/log 并修改权限让apache也能读写452:error_reporting = E_ALL & E_NOTICE 设置日志299:open_basedir = /data/www:/tmp 限定php可以解析的基本目录也可在apache虚拟主机里加一行:php_admin_value open_basedir "/data/www:/tmp" 单独为每一网站做限制。0629 php扩展模块如何安装php -m 看不出静态和动态重新编译PHP或动态加载模块,在源码包的ext目录,也可以自行下载。进入到对应模块源码的目录,检查安装autoconf包,执行 php/bin/phpize 生成configure,然后执行它。./configure --with-php-config=/usr/local/php/bin/php-config 如果有报错太多需要安装相应开发库。make && make install 会将模块放进php.ini指定的 extention_dir 中。默认不会改在 php.ini 中第886行,加入 extension=相应模块名.so0630 mysql配置详解/etc/my.cnfkey_buffer_size 索引缓存,越大越快,但要适当,1G内存分256M,查看 mysql 调优max_allowd_packet 导入 sql 包table_open_cache 打开表缓存sort_buffer_size 排序缓冲 1M read_buffer_size read_rnd_buffer_sizemyisam_sort_buffer_size 一种引擎,还有一种innoDBthread_cache_size 缓存可重用线程数 CPU核数query_cache_size 查询缓存thread_concurrency 最大并发线程数。核数*2interactive_timeout 连接超时wait_timeout 等待时间,依赖interactive_timeoutlong_query_time 慢查询log_slow_queries 慢查日志log-bin 二进制日志,主从有关0631 mysql root密码重置mysqladmin -uroot -ppasswd(如果没有不写此项) password 'your_passwd' 创建或更改密码。如果忘记密码,需要在/etc/my.cnf中加入一条 skip-grant ,重启mysql.即可直接进入mysql,不用指定用户和密码。接着在mysql执行命令:update user sed password=password('your_passwd') where user='root'; 即可更改密码。可以查看一下,select * from user where user='root'\G;退出mysql,把my.cnf中skip-grant去掉。0632 mysql 远程登录mysql -u<user> -h<IP> -P<port> -p<passwd> 授权过以后才能登录授权:进入mysql,执行命令:grant all on *.* '<user>'@'<client_ip>' identified by '<passwd>'; 看到Query OK 就成功了可以用 select * from user where host='<client_ip>'\G;查看效果select user(); 查看当前使用的用户。本地登录,如果有多个mysql 可以-S指定 sock
编辑回复