手机浏览 RSS 2.0 订阅 膘叔的简单人生 , 腾讯云RDS购买 | 超便宜的Vultr , 注册 | 登陆
浏览模式: 标准 | 列表2017年08月7日的文章

用nginx proxy模式后,提交POST出错

用了nginx(proxy)+apache后,提交数据偶尔会出现:upstream sent too big header while reading response header from upstream,这个其实比较好解决

修改proxy_params文件在里面加入:
XML/HTML代码
  1. proxy_buffer_size   128k;  
  2. proxy_buffers   4 256k;  
  3. proxy_busy_buffers_size   256k;  
修改完后nginx -s reload一下就直接搞定了。
如果发现还是搞不定,加大后面的数字吧
 
在stackoverflow上,有人还是提出了,如果你是长链接的话,设置proxy_buffering off吧。参考:https://stackoverflow.com/questions/23844761/upstream-sent-too-big-header-while-reading-response-header-from-upstream
 
 

Tags: nginx, proxy, upstream

mysql 函数与 pdo函数的对比及使用

mysql在升到php7后,原有的mysql_*函数都没有了,如果要迁移,可以参考 这一篇:https://stackoverflow.com/questions/36073703/mysql-to-pdo-comparison-table

介绍的比较详细,比如mysql常用的几个函数的转换写法,这里都有了:
随便截一点内容,详细的还是去网站看:
 

MySQL_ Original Driver to PDO Comparative Table

Introduction:

This table is not intended to be a tutorial or a guide to PDO, but to provide a correspondence between MySQL_ and PDO. So, some important PDO commands are missing, if they don't have a MySQL_ correspondence.

Among these omitted commands, there is a major PDO feature, the prepared statements. I strongly recommend to use it, also if only cited in this guide.

This is a very extended answer. I'm sorry for the low quality of spelling (I'm not english) and for the typos. I will try to correct and improve it in the next few days. Any suggestion or contribution is welcome.

Naming Conventions:

To avoid misunderstanding, in this answer I use:

In PDO, we have two major object types, the PDOObject (the connection between PHP and a database server) and the PDOStatement (a prepared statement and, after the statement is executed, an associated result set). In this answer, variable names are:

  • $dbh, refer to PDOobject;
  • $stmt, refer to PDOStatement.
 
 

PHP7+OPCACHE,有没有感觉网站象秒开?

如题。感觉棒棒的!

 
看了一下。数据库压力也不大。当然本身也不大。我还是使用了 nginx+apache的方式。为什么这么做?
一个是sablog原来的rewrite规则 有点麻烦,不想改来改去的
第二个是哪天我真要做负载均衡了,这样也容易(先装个逼,其实没吊用)

也许你们看不出,但本博客确实升到了PHP7了

如题,由于切换服务器从linode到香港,顺手将PHP升到了7。

由于之前在做好了准备工作,【[2017-01-04] - sablog for PHP7】所以迁移还是相对比较简单。
不过还是漏了一点点东西,比如
1、sablog里的split函数,看了一下他的内容,不复杂,就直接改成Explode了,没有用preg_split
2、漏网一个eregi函数,在database.php中,用preg_match('//i'),来代替了(这是官方手册上说的:http://php.net/manual/en/function.eregi.php,因为从PHP7开始就被Remove掉了,没办法)
3、一个漏网之鱼:mysql_get_server_info,其实db函数中已经有这个db::versions()方法了,但。。。他还是在代码里写了,所以调用了一下$DB->version();
 
目前几乎没有看到什么大问题,在include/common.php中用error_reporting(7),阻挡了大部分的warning。先混过去。如果再遇到问题就改一下