thinkphp 3.1 select 内存溢出

网站项目想做个队列, 能一直运行. 数据库操作已经写好了想直接套用think php的直接用.

然后发现一个坑, 只要执行model的find 内存就尼玛一直长.

然后追查:
是运行到解析join的时候出现的
在ThinkPHP/Lib/Core/Db.class.php 589行
protected function parseJoin($join) {
$joinStr = ”;
if(!empty($join)) {
if(is_array($join)) {
foreach ($join as $key=>$_join){
if(false !== stripos($_join,’JOIN’))
$joinStr .= ‘ ‘.$_join;
else
$joinStr .= ‘ LEFT JOIN ‘ .$_join;
}
}else{
$joinStr .= ‘ LEFT JOIN ‘ .$join;
}
}
//将__TABLE_NAME__这样的字符串替换成正规的表名,并且带上前缀和后缀
$joinStr = preg_replace(“/__([A-Z_-]+)__/esU”,C(“DB_PREFIX”).”.strtolower(‘$1’)”,$joinStr);
return $joinStr;
}

主要这句:
$joinStr = preg_replace(“/__([A-Z_-]+)__/esU”,C(“DB_PREFIX”).”.strtolower(‘$1’)”,$joinStr);
$joinStr=”;的时候内存就一直长啊!!

因为项目很少用join,这个服务也用不到join,在方法顶部增加:
if(empty($join)){
return ”;
}

然后终于妥当了.

yum centos6.5 安装 php7 php56

安装源,这个是 centos6的

yum install http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm 这个插件少memcache之类的木有

验证下:yum search php7 就会出来了

yum install -y php70

然后提示:

Error: php70w-common conflicts with php-common-5.3.3-46.el6_7.1.x86_64

之前有 –> Processing Conflict: php70w-common-7.0.3-1.w6.x86_64 conflicts php-common < 5.5.0

应该卸载原来的php5.3

yum remove php*

 

然后安装需要的库

yum list php7* 可以列出所有可用的

yum install php70-php.x86_64 php70-php-gd.x86_64  php70-php-mbstring.x86_64  php70-php-mysqlnd.x86_64  php70-php-pdo.x86_64  php70-php-pdo-dblib.x86_64   php70-php-pecl-imagick.x86_64 php70-php-pecl-imagick-devel.x86_64 php70-php-pecl-memcache.x86_64 php70-php-pecl-memcached.x86_64  php70-php-pecl-xdebug.x86_64  php70-php-devel.x86_64  php70-php-fpm.x86_64

 

 

——-

thinkphp3.1老程序不支持,

改php5.6

yum install php56-php.x86_64 php56-php-gd.x86_64  php56-php-mbstring.x86_64  php56-php-mysqlnd.x86_64  php56-php-pdo.x86_64  php56-php-pdo-dblib.x86_64   php56-php-pecl-imagick.x86_64 php56-php-pecl-imagick- devel.x86_64 php56-php-pecl-memcache.x86_64 php56-php-pecl-memcached.x86_64  php56-php-pecl-xdebug.x86_64  php56-php-devel.x86_64  php56-php-fpm.x86_64 php56-php-mysqlnd.x86_64 php56-php-5.6.19-1.el6.remi.x86_64 php56 php56-php-mbstring.x86_64

这个一定要装 php56-php-5.6.19-1.el6.remi.x86_64 如果不装不会生成libphp.so apache下会无法使用,nginx到无所谓
php56-php-mbstring.x86_64 这个包oss会用到,否则aliyun会异常

修改上传尺寸
/opt/remi/php56/root/etc/php.ini
upload_max_filesize =
post_max_size =

phpunit xml配置例子

phpstorm里配置比较方便,可以算是已经集成了
mac版本有点怪,xdebug配置好就无法使用phpunit ,windows版本正常

phpunit如果想测试目录所有php文件的话,需要增加个xml配置:比如叫phpunit.xml

 <phpunit backupGlobals="true"
         bootstrap="tests/bootstrap.php"
         backupStaticAttributes="false"
         cacheTokens="false"
         colors="true"
         convertErrorsToExceptions="true"
         convertNoticesToExceptions="true"
         convertWarningsToExceptions="true"
         forceCoversAnnotation="false"
         mapTestClassNameToCoveredClassName="false"
         printerClass="PHPUnit_TextUI_ResultPrinter"
         processIsolation="false"
         stopOnError="false"
         stopOnFailure="false"
         stopOnIncomplete="false"
         stopOnSkipped="false"
         testSuiteLoaderClass="PHPUnit_Runner_StandardTestSuiteLoader"
         strict="false"
         verbose="true">
    <testsuites>
        <testsuite name="foo Tests">
            <directory>./</directory>
        </testsuite>
    </testsuites>
    <filter>
        <whitelist addUncoveredFilesFromWhitelist="true">
            <directory suffix=".php">./src</directory>
        </whitelist>
    </filter>
    <logging>
        <log type="coverage-clover" target="./clover.xml"/>
    </logging>
</phpunit>

SDL LNK2019 无法解析的外部符号 _SDL_main,该符号在函数 _main_utf8 中被引用

LNK2019 无法解析的外部符号 _SDL_main,该符号在函数 _main_utf8 中被引用


#include "stdafx.h"
#include "SDL.h"

int main()
{
return 0;
}

其实就是main格式问题..
这个也是错误的:
int main(int argc, char *argv)
这种是正确的!!
int main(int argc, char *argv[])

MegaCli 磁盘Rebuild,Firmware state: Unconfigured(good), Spun Up

开始是这样的: 机房发邮件说硬盘橙色灯了, 然后我就找公司小朋友去看了,然后其实没有警告灯,但小朋友不太懂,还是把好的硬盘给拔出来了.
悲剧发生了,硬盘橙色警告, 系统橙色叹号也亮了.
查硬盘状态
Firmware state: Unconfigured(good), Spun Up
重建警告状态不对. 其实是流程没整对

网上搜了下处理方式主要如下:
https://community.mcafee.com/thread/60189?tstart=0

setp1:查状态:
# check out the slot ena enclosureDevice

/opt/MegaRAID/CmdTool2/CmdTool2 -pdlist -a0 | egrep “(Slot|Firmware state|Encl)”

EnclosureDevice ID: 0
SlotNumber: 0
Firmwarestate: Online, Spun Up
EnclosureDevice ID: 0
SlotNumber: 1
Firmwarestate: Online, Spun Up
EnclosureDevice ID: 0
SlotNumber: 2
Firmwarestate: Online, Spun Up
EnclosureDevice ID: 0
SlotNumber: 3
Firmwarestate: Online, Spun Up
EnclosureDevice ID: 0
SlotNumber: 4
Firmwarestate: Online, Spun Up
Enclosure Device ID: 0
Slot Number: 5
Firmware state: Unconfigured(good), Spun Up

发现目标了

setp2:
查这个丢失磁盘的信息
/opt/MegaRAID/CmdTool2/CmdTool2 -PDGetMissing -a0
Adapter 0 – Missing Physical drives
No. Array Row Size Expected
0 0 1 285148 MB

这里No=0, array=0 row=1

setp3:
重建
# Bring device back in array

#/opt/MegaRAID/CmdTool2/CmdTool2-PdReplaceMissing -PhysDrv[ –row -a
/opt/MegaRAID/CmdTool2/CmdTool2 -PdReplaceMissing -PhysDrv[0:5] –array0 -row1 -a0
Adapter: 0:Missing PD at Array 0, Row 1 is replaced.

这里用到了setp2的信息

# now rebuild the array

/opt/MegaRAID/CmdTool2/CmdTool2 -PDRbld -Start -PhysDrv[0:5] -a0
Started rebuild progress on device(Encl-0 Slot-5)

然后再查下状态,开始重建了!!泪奔

nginx 虚拟目录 php环境

虚拟目录这样就行了,顺利地话.
location /dd/ {
root /chroot/dd;
rewrite /huodong/(.*) /$1 break;
index index.html index.htm index.php;
}

location ~ /dd.+.php$ {
root /chroot/dd;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
rewrite /dd/(.*\.php?) /$1 break;
}

php出现异常
FastCGI sent in stderr: “Primary script unknown” while reading response header from upstream
原因可能是顺序问题
location ~ \.php$ {
….
}
有这样的配置放新加php配置的后面。否则无法生效。php会报404。

Spring Security 异常 Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named ‘myUserDetailService’ is defined

Spring Security 新版本已经不再建议使用 password-encoder了


  
          
        	
        	
        
      

跟着网上的例子写


  
          
		 
      

提示:
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named ‘myUserDetailService’ is defined

注解了但还是找不到,如果写成 的形式,里面的dao也无法自动注入.

发现最后居然是因为:aspectj版本低啊! 原来写的1.5.4,写最新的就解决了….



    org.aspectj
    aspectjweaver
    1.8.3


    org.aspectj
    aspectjrt
    1.8.3