Time of Update: 2017-01-13
這幾天web經常出現Nginx 502的問題,先開始也像很多人一樣認為是Nginx的問題,從網上查了查原來是php-fpm在作怪。 web使用的是nginx+php的架構,網站上線還沒多久,所以最佳化方面基本只是做了些初始的配置。 查看php-fpm.log發現有警告,這些警告和網站的掛了個時間基本吻合。我就從這裡開始入手。 先開始也是找了些文檔,但是第二天還是出現問題。後來查看設定檔並翻譯了下(百度),英文底子不好。pm模組類似apache的模組,是分靜態和動態。
Time of Update: 2017-01-13
如果上傳目錄被植入 PHP 檔案,即可遠程執行。為了安全起見,我們一般會對上傳目錄禁止運行 PHP 指令碼。在 Apache 下面我們可以通過一下方法來禁止運行 PHP 指令碼:<Directory /wp-content/uploads> php_flag engine off </Directory> Nginx 方法如下:location /wp-content/uploads/ { location ~ .
Time of Update: 2017-01-13
說明:php安裝目錄:/usr/local/php5php.ini設定檔路徑:/usr/local/php5/etc/php.iniNginx安裝目錄:/usr/local/nginxNginx網站根目錄:/usr/local/nginx/html1、安裝編譯工具yum install wget make gcc gcc-c++ gtk+-devel zlib-devel openssl openssl-devel pcre-devel kernel keyutils patch
Time of Update: 2017-01-13
因為業務需要,要做音樂的一個上傳,而Nginx本身對上傳有限制,應該是不超過2mb,所以要重新設定下。第一,配置nginx。找到nginx.conf設定檔,修改http裡的php模組,完整代碼如下:# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 #location ~ .php$ { root
Time of Update: 2017-01-13
1.需要安裝gd庫yum -y install gd重啟動fpm2.nginx 預設圖片上傳最大限制比較小。修改PHP.ini中post_max_size upload_max_filesize max_execution_time max_input_time 開啟php.ini檔案,修改完畢後重啟伺服器。測試下上傳檔案。。。。(嘻嘻,是不是傳上了很大的檔案?) 1、檔案上傳時存放檔案的臨時目錄。必須是 PHP 進程所有者使用者可寫的目錄。如果未指定則 PHP
Time of Update: 2017-01-13
在wordpress一類部落格程式的模板裡面看到很多奇怪的PHP文法,比如: 代碼如下複製代碼 <?php if(empty($GET_['a'])): ?><font color=”red”>空的</font><?php endif; ?>
Time of Update: 2017-01-13
1。網站地圖 代碼如下複製代碼 {king:portal.sitemap outHTML='ul' innerHTML='li' /} outHTML為外層的html 標籤innerHTML為內層的html 標籤 2.帳戶圖片 代碼如下複製代碼 {king:user.state id="usercmt"} <dl><dt><span
Time of Update: 2017-01-13
描述: 目標存在全域變數覆蓋漏洞。1.受影響版本DEDECMS 5.7、5.6、5.5。2.漏洞檔案/include/common.inc.php3.DEDECMS的全域變數初始化存在漏洞,可以任意覆蓋任意全域變數。危害:1.駭客可以通過此漏洞來重定義資料庫連接。2.通過此漏洞進行各種越權操作構造漏洞直接寫入webshell後門。臨時解決方案:在 /include/common.inc.php 中找到註冊變數的代碼 代碼如下複製代碼 foreach(Array('
Time of Update: 2017-01-13
最簡單的輸入如 代碼如下複製代碼 {dede:php} $numA = 1; $numB = 2; echo $numA + $numB;{/dede:php} 從上面語句可以看出dede:php標籤可以名符其實的讓在php中一樣的用法,上面語句在php寫法如下 代碼如下複製代碼 <?$numA=1;$numB=2;echo $numA+$numB;?> 是不是看上去很像啊,再看一個再有if else 條件判斷的
Time of Update: 2017-01-13
$res=mysql教程_query("select k1,k2 from ".table('keywords')." ") ;$str="<?php rn ";while($rs=mysql_fetch_array($res)){ $str
Time of Update: 2017-01-13
代碼如下複製代碼 <!doctype html public "-//w3c//dtd xhtml 1.0 strict//en" "http://www.111cn.net/tr/xhtml1/dtd/xhtml1-strict.dtd"><html><head><meta http-equiv="content-type" content="text/html;
Time of Update: 2017-01-13
html代碼 代碼如下複製代碼 <input type= "file " id= "userfile " name= "userfile "> <input type= "submit " name= "upload
Time of Update: 2017-01-13
先看這個緩衝類<?php 代碼如下複製代碼 class cache{/*class name: cachedescription: control to cache data,$cache_out_time is a array to save cache date time out.version: 1.0author: 老農 cjjerlast modify:2006-2-26author url: http://www.111cn.net*/private
Time of Update: 2017-01-13
db2word.php 代碼如下複製代碼 <?php //將資料庫教程以數組形式寫到檔案中 require("conn.php"); $res=mysql教程_query("select k1,k2 from ".table('keywords')." ") ; $str="<?php "; while($rs=mysql_fetch_array($res)) { $str
Time of Update: 2017-01-13
<meta http-equiv="content-type" content="text/html; charset=gb2312"><?phpfunction tree($directory) { $mydir=dir($directory); echo "<ul> "; while($file=$mydir->read()){ if((is_dir("$directory/$file&
Time of Update: 2017-01-13
1、使用mbstring擴充庫的mb_substr截取就不會出現亂碼了。2、自己書寫截取函數,但效率不如用mbstring擴充庫來得高。3、如果僅是為了輸出截取的串,可用如下方式實現:substr($str, 0, 30).chr(0)。 * 可以避免亂碼的截取漢字 * 參數 $str 為字串,$start 為開始字元,$len 結束字元 * 返回截取後的字元 */ function msubstr($str, $start, $len)
Time of Update: 2017-01-13
由一條別人adodb的bug引發的思考 echo 09," => (09) <br>";echo 9," => (9) <br>"; 你可以試一下.輸出結果是: 0 => (09) 9 => (9) 而不是 09 => (09) 9 =>
Time of Update: 2017-01-13
這本來是session的基本用法,但在php中就不靈了。不過我們可以把session變數註冊成"跨視窗的全域變數"。但這有一個條件,就是要向需要使用該session變數的視窗發送變數名為session_name(),值為session_id()的變數,用表單或者在url後面用?帶上都可以.並且在使用session變數的頁面的一開始處調用session_start()。例子如下:login.php檔案:<html><head><meta
Time of Update: 2017-01-13
PHP中自增自減運算 問題:若$i=2,求運算式($i++)*($i++)*($i++)的值,並求$i的值 答案:($i++)*($i++)*($i++)結果為24,$i為5 分析:先看計算順序,發現有括弧則先算括弧裡面的,先取$i的值2為($i++)的值,然後$i自加為3; [此時($i++)左=2,$i=3]
Time of Update: 2017-01-13
檔案下載網址Apache 2.2.4 -- www.apache.comPHP 5.2.0 -- www.php.net MySQL 5.0.27 -- www.mysql.com Zend Optimizer 3.2.0 -- www.zend.com phpMyAdmin 2.9.2 -- www.phpmyadmin.net Apache 2.2.4 的安裝1.網站下載 apache_2.2.4-win32-x86-no_ssl.msi 並執行。 2..按3