文件丢失
文件丢失
ecshop 的 includes/lib_common.php 之 load_config 函数对应读取文件没做合适的检验,导致如果文件为空,那么会使ecshop 完全瘫痪
function load_config() { $arr = array(); $data = read_static_cache('shop_config'); if ($data === false || empty($data['lang'])) // 原来 为 if ($data === false)
问题都是一个,结论总是奇形怪状.
状况: ecshop 验证码不显示
1) 原因1: 有客户试图用前台英文后台中文模式工作,他就仿照一些方法,覆盖了语言文件
导致一些CFG 后台设置的变量无法读取,
解决方法,修改 captcha.php 文件,不包含 init.php, 然后手动传入宽高变量
首先定义 ROOT_PATH
define(‘ROOT_PATH’, “绝对路径”);
然后
$img = new captcha(ROOT_PATH . ‘data/captcha/’, $_CFG[‘captcha_width’], $_CFG[‘captcha_height’]);
变为
$img = new captcha(ROOT_PATH . ‘data/captcha/’, 100, 20);
2) 原因2,修改了某些utf-8文件,结果保存成 utf-8+ 也就是传说中的 utf-8 with bom
解决方法,找到对应文件,应 editplus 重新保存成 utf-8 无bom
有颜色部分是需要根据情况修改的
1.安装包
yum -y install ppp
yum -y install pptp
2.配置文件
vi /etc/ppp/chap-secrets
——————————————
# Secrets for authentication using CHAP
# client server secret IP addresses
username myvpn “password” *
——————————————
vi /etc/ppp/peers/myvpn
——————————————
# written by pptpsetup
pty “pptp vpnserverip –nolaunchpppd”
lock
#noauth
nobsdcomp
nodeflate
name username
remotename myvpn
ipparam myvpn
require-mppe-128
refuse-pap
refuse-chap
refuse-eap
refuse-mschap
——————————————
3.复制命令
cp /usr/share/doc/ppp-2.4.4/scripts/pon /usr/sbin/
cp /usr/share/doc/ppp-2.4.4/scripts/poff /usr/sbin/
chmod +x /usr/sbin/pon /usr/sbin/poff
4.拨vpn
pon myvpn
5)ifconfig 看ppp0
pptp 如果 yum 安装不了,可以到 rpmfind.net 去查
http://rpm.pbone.net/index.php3?stat=3&limit=1&srodzaj=1&dl=40&search=pptp&field[]=1&field[]=2
6.断开连接
poff myvpn
这篇博客将陆续写有关unicode , php 和 unicode , 其他语言的unicode 实现的问题
看到太多的各类系统整合ucenter出现的各种各样的问题,比如无法同步登入,同步退出,注册用户时候出现问题
研读过ucenter 的原理后,再结合测试 ucenter + modoer + discuz X 1.5 + ecshop 2.7.2 实现了完美的同步登入和退出
发现一个简单的方法就是,把ucenter 的data/cache/apps.php 文件复制到各个系统的 uc_client/data/cache/apps.php
就可以解决大半的同步问题
检查过上面问题后,再检查各个系统的关于ucenter 的配置处,确保key和uc里面的一致,然后清空各系统缓存,测试
另外还要看 这一篇
/ecshop-api-uc.html
With IPN the code will run regardless of whether or not the buyer reaches your final checkout page or not. Again, it is server-to-server communication and is entirely separate from the user’s interaction with your application.
翻译来的意思就是
ipn 代码不管客户端(浏览器) 购买者是否到达最终的反馈页面,IPN是服务器到服务器端的通信,IPN完全独立于用户浏览器和网站应用程序之间的交互(指购买者浏览器和商品网站)
如下文章可以解释的很清晰 IPN 和 PDT 的区别了
一句话解释就是 PDT 是依靠客户浏览器返回到商品网站来确认付款成功,而IPN则可独立于浏览器和服务器之间,IPN 是端到端(Paypal 到 网站) 的沟通,他可防止所谓的掉单现象的发生,对于一些需要自动化的任务有较好的效果,(比如游戏币的自动发卡,自动充值)。
详细的上下文如下https://www.x.com/docs/DOC-2502
中文说明在
http://paypal.ebay.cn/integrationcenter/list__resource_2.html
I’d like to backup just a little bit now and discuss some of the differences between Instant Payment Notification (IPN) and Payment Data Transfer (PDT). They are very similar in the way they work so if you’re already familiar with PDT you may feel right at home with IPN. There is really one major difference that is very important to understand.
PDT was designed with one simple goal in mind: provide transaction data to checkout systems using Payments Standard so that it can be displayed on the merchant’s “thank you” or “completed” page. When utilizing PDT you have the option of data being returned as form data (POST) or as URL parameters (GET). You can then build your thank you page in a dynamic fashion so that users can print the page as a receipt, simply save it for their records, etc. It is a very useful tool when this is necessary, however, you cannot rely on PDT for automating tasks because there is no guarantee that the user will ever make it to your “thank you” page when working with PayPal Standard Payments. Even with Auto-Return enabled in your PayPal profile the user could close the browser before being redirected and the code on your thank you page will never run.
With IPN the code will run regardless of whether or not the buyer reaches your final checkout page or not. Again, it is server-to-server communication and is entirely separate from the user’s interaction with your application. Once that transaction is complete the data will be sent to your IPN listener and will be handled accordingly. This is why it is highly recommended you utilize Instant Payment Notification instead of Payment Data Transfer when automating tasks on the back-end.
phpmyfaq 2.5.2 的 inc/Link.php 文件里面的
function toString($forceNoModrewriteSupport = false)
函数是处理phpmyfaq 静态化的根本函数
昨日一个客户的IBM x3650 m2 7947 上安装 Centos 4.8 发现无法使用网络 ifconfig 显示 lo ,无eth0 和 eth1 ,
此机器板载 Broadcom (R) NetXtreme II (TM) 网卡2块,
解决方法如下:
到 www.ibm.com 英文网站下Support & downloads 根据型号下载 for redhat 4 的驱动和固件升级程序
Broadcom NetXtreme and NetXtreme II Firmware Update Utility v2.1.1b for Linux 04 Dec 2009 v2.1.1b
Broadcom (bnx2) NetXtreme II driver v1.9.20b for Red Hat Enterprise Linux 4 (32-bit and 64-bit) 02 Sep 2009 vbnx2-1.9.20b
首先安装固件升级程序 方法是
chmod +x brcm_fw_nic_2.1.1b_linux_32-64.bin
./brcm_fw_nic_2.1.1b_linux_32-64.bin -s
然后根据情况去安装 driver ,有可能无需安装,因为 centos 4.8 似乎也有类似驱动
原因: 微软补丁 KB967723 造成
打开注册表编辑器regedit
TcpTimedWaitDelay 设置:
找到 HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\ Services\TCPIP\Parameters 注册表子键
并创建名为 TcpTimedWaitDelay 的新 REG_DWORD 值
设置此值为十进制 30, 十六进制为 0×0000001e
该值等待时间将是 30 秒。
本项的默认值:0xF0(16进制), 等待时间设置为 240 秒
MaxUserPort 设置(增加最大值端口连接):
找到 HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\ Services\TCPIP\Parameters 注册表子键
并创建名为 MaxUserPort 的新 REG_DWORD 值
设置此值为十进制 65534
本项的默认值:5000(十进制)
关闭注册表编辑器, 重启windows系统。
一句话说就是
妈的,默认没开启 eAccelerator_get 和 eAccelerator_put
这个链接 http://eaccelerator.net/ticket/37 是说明
这里人解释的更清晰了
http://www.vbseo.com/blogs/danny-bembibre/enable-caching-functions-get-put-eaccelerator-45/
翻译成中国话就是
”
现在默认禁用了 eAccelerator_get 和 eAccelerator_put
想启用就加
–with-eaccelerator-shared-memory
共勉吧 php兄弟们
例子来源于我在给一个朋友配置服务器时候 一个电影程序 skyuc 的缓存需要配置 datastore_eaccelerator
而此程序检测 eAccelerator_get 函数是否存在以判断 eaccelerator 是否安装,
在phpinfo 里面即使看到了 eaccelerator ,仍然导致程序失败,调试后发现此原因.
另外发现 0.9.6 的eaccelerator 似乎即使加了这个也不好使,只能降级用 0.9.5 版本的eaccelerator
正常安装 php 加下面一步
cscript %SYSTEMDRIVE%\inetpub\adminscripts\adsutil.vbs SET W3SVC/AppPools/Enable32bitAppOnWin64
可以在javascript 里面动态加载jquery 等 js
需要注意的是 在运行jquery 函数的时候需要延时下
function loadjscssfile(filename, filetype) { if (filetype=="js"){ //判断文件类型 var fileref=document.createElement("script")//创建标签 fileref.setAttribute("type","text/javascript")//定义属性type的值为text/javascript fileref.setAttribute("src", filename)//文件的地址 }else if (filetype=="css"){ //判断文件类型 var fileref=document.createElement("link") fileref.setAttribute("rel", "stylesheet") fileref.setAttribute("type", "text/css") fileref.setAttribute("href", filename) } if (typeof fileref!="undefined") document.getElementsByTagName("head")[0].appendChild(fileref) } loadjscssfile("http://code.jquery.com/jquery-latest.js","js"); setTimeout(function(){ $(document).ready(function(){ /////////////////// 这里好好发挥 }) },3000);
一个discuz 运行于mysql 4 上面 现在需要把数据库升级到 mysql 5
经验证以下方式可行,且无错
1) 用mysql5的bin\mysqldump 把 mysql4的数据导出,
2) 用mysql5的bin\mysql 以latin1 导入,注意, create database 要用latin1
d:\mysql5\bin\mysql -P3307 -uroot -p -e “drop database DBNAME;”
d:\mysql5\bin\mysql -P3307 -uroot -p -e “create database `DBNAME` DEFAULT CHARACTER SET latin1 collate latin1_general_ci;”
d:\mysql5\bin\mysql -P3307 -uroot -p -D DBNAME -f –default-character-set=latin1 < d:\phpsir\jokcnbbs.sql
d:\mysql5\bin\mysql -P3307 -uroot -p -D DBNAME -f –default-character-set=latin1 < d:\phpsir\jokcnbbs-data.sql
############################################## #version="20100718" #author="phpsir" #author_email="[email protected]" #QQ 733905 ############################################## maxnum=100 runmin_max=120 #runmin_max is run iptables -F timeout banip_data_file="/root/banip_data.txt" ipopenfile="/root/openip.txt" ipfile="/tmp/80link.txt" nsfile="/tmp/netstat80.txt" myip=`/sbin/ifconfig eth0 | grep inet | awk '{print $2}' | sed 's/addr://' | grep .` if [ ! -f $ipopenfile ] then echo "init $ipopenfile" touch $ipopenfile fi if [ -f $banip_data_file ] then source $banip_data_file echo "last runtime=$runtime" else echo "init $banip_data_file" echo 'runtime='`date "+%s"` > $banip_data_file source $banip_data_file runmin_max=-1 fi echo "start shell" `date "+%Y-%m-%d %H:%M:%S"` runmin=$((`date "+%s"`-$runtime)) if [ $runmin -gt $runmin_max ] then echo $runmin "is bigger than " $runmin_max echo "clear ips" /sbin/iptables -F echo 'runtime='`date "+%s"` > $banip_data_file else echo $runmin "is lowwer than " $runmin_max fi netstat -an | grep "$myip:80" > $nsfile echo "Total Links = " `cat $nsfile | wc -l ` echo "Total Links ESTABLISHED = " `cat $nsfile | grep ESTABLISHED | wc -l ` echo "Total Links SYNC = " `cat $nsfile | grep SYN | wc -l ` cat $nsfile | sed "s/::ffff://g" | awk '{print $5}' | awk -F: '{print $1}' | sort|uniq -c|sort -rn | head -n 10 > $ipfile cat $ipfile | while read oneline do ip=`echo $oneline | cut -d " " -f 2` num=`echo $oneline | cut -d " " -f 1` str="$ip has linked $num " banme="yes" for allowip in `cat $ipopenfile` do echo $ip | grep $allowip > /dev/null if [ $? -eq 0 ] then banme="no" echo $allowip "banme = " $banme /sbin/iptables -D INPUT -p tcp -s $ip -d $myip --dport 80 -j REJECT > /dev/null 2>&1 continue fi done if [ $banme = "yes" ] then if [ $num -gt "$maxnum" ] then /sbin/iptables -L -n | grep "$ip" >/dev/null status=`echo $?` if [ $status -eq 1 ] then echo "deny $ip ,because $str " /sbin/iptables -A INPUT -p tcp -s $ip -d $myip --dport 80 -j REJECT echo "BAN " $ip " OK " #/sbin/iptables -L -n | grep "$ip" else echo > /dev/null #echo "$str alread reject" fi else echo > /dev/null #echo "$str $ip ok ,less $maxnum " fi fi done echo "stop shell" `date "+%Y-%m-%d %H:%M:%S"`
“lighttpd -D -f lighttpd.conf 这个作为 daemontools的 run 配置文件”
参考文档:
http://redmine.lighttpd.net/projects/lighttpd/wiki/LighttpdUnderSupervise
脚本如下:
mkdir -p /srv/lighttpd/log/main/
vi /srv/lighttpd/run
#! /bin/sh
exec 2>&1
exec lighttpd -D -f $PATHTO/lighttpd.conf
vi /srv/lighttpd/log/run
#! /bin/sh
umask 0027
exec setuidgid nobody multilog ./main
chown nobody /srv/lighttpd/log/main
最后
ln -s /srv/lighttpd /service/
等待5秒左右就可以看到 lighttpd 启动了
以下均为Linux 平台配置
1. 首先假设你已经可以使 nginx + php 在 fastcgi 模式下运行 (如果不会,请参考nginx 资料)
2. 安装djb daemontools
脚本如下
mkdir -p /package
chmod 1755 /package/
cd /package/
wget http://cr.yp.to/daemontools/daemontools-0.76.tar.gz
tar xzf daemontools-0.76.tar.gz
wget http://www.qmail.org/moni.csi.hu/pub/glibc-2.3.1/daemontools-0.76.errno.patch
cd admin/daemontools-0.76
patch -p1 < ../../daemontools-0.76.errno.patch
rm ../../daemontools-0.76.errno.patch ../../daemontools-0.76.tar.gz
./package/install
3. 配置 nginx在 daemontools下运行
脚本如下
修改nginx.conf 加入 daemon off; (在 worker_processes 前面!!)
mkdir -p /srv/nginx
vi /srv/nginx/run 内容为
#!/bin/sh
exec /usr/local/nginx/sbin/nginx
4. php fastcgi 在 daemontools 下运行 (最关键的 -n )
#! /bin/sh
exec /usr/local/lighttpd/bin/spawn-fcgi -n -a 127.0.0.1 -p 9999 -C 30 -u nobody -g nobody -f /usr/local/php/bin/php-cgi
5. 配置svscan 监控
ln -s /srv/nginx /service
ln -s /srv/phpfcgi /service
手动停止 你的 nginx 和 php-cgi 进程看看,是不是 php-cgi 和 nginx 自动启动了。呵呵
6. 学习如何手动停止 nginx 和 php-cgi
svc -d /service/nginx 停止 nginx
svc -u /service/nginx 启动 nginx
svc -d /service/phpfcgi 停止phpfcgi
svc -u /service/phpfcgi 启动phpfcgi
That’s all !
补充,php 可以打 fpm补丁后不用此方法
经常看到有初入PHP道朋友对于php程序出现问题素手无策的情况
这是稍微有经验的phper 都会采用如下方式来解决问题
1. 看错误输出, 从输出项 反查源码,在源码处上下文加入调试代码,代码可以是最简单的
$debuglineno = __LINE__;
die($debuglineno);
2. 根据错误输出 Google 之 或者 百度一下
错误的做法:
1. 直接问你的上级,或者同事
2. 直接!上论坛求助 而不是首先经过自己排查
3. 不去分析问题,而是发牢骚
DEDE织梦5.5 版本出现 DedeTag Engine Create File False 的问题
我们从源码出发查看问题
以下是 Linux下面的命令
find . -exec grep -Hn “DedeTag Engine Create File False” {} \;
显示结果
./uploads/include/dedetag.class.php:566: $fp = @fopen($filename,”w”) or die(“DedeTag Engine Create File False”);
既然只有一处 那么我们在此行上面加调试语句
var_dump($filename);
$fp_debug = @fopen($filename,”w”) ;
这样就会出现 $filename 的信息,我们可以查看对应文件的权限 ,就比较好处理了
剩下的只是在windows 或者 linux 上面设定了,不表
Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!
本站博客第一篇。
每年1月1日到这里打卡