ERROR! The server quit without updating PID file
可能原因是PID檔案寫入失敗
解決方式是

jeffath 發表在 痞客邦 留言(0) 人氣()


當多個server block時,server name匹配順序為:

  • 完全符合的server_name,意味裡面沒有萬用字元*

  • 以星號起始的server_name

  • 以星號結尾的server_name

  • 第一個符合正則表達式的server_name(第一個是由在nginx.conf中的順序決定)


  • 萬用字元:

  • 萬用字元只能在起始或結束,只能有一個,例如*.dom.tw或www.dom.*。

  • www.*.dom.tw、w*.dom.tw都是錯的

  • 如果要做到上面的,應該用正則表達式搞定,分別是~^www\..+\.dom\.tw$及~^w.*\.dom\.tw$

  • *可以匹配多個節,*.example.org ”不僅匹配www.example.org,也匹配www.sub.example.org

  • .example.org 的特殊萬用字元,它可以既匹配確切的名字example.org,又可以匹配一般的萬用字元名字 *.example.org


  • 正則表達式

  • 由~開始,類似js中的\\

  • 最好是記得用^開頭&結尾,不然邏輯有問題(這點我也還沒搞懂為什麼必要)

  • 有{}的正則前後要加上"",不然會報錯。例如  server_name "~^(?<name>\w\d { 1,3 } +)\.example\.net$";

  • jeffath 發表在 痞客邦 留言(0) 人氣()

    sudo su -
    yum update
    yum install nginx php-fpm php-xml php-pdo php-odbc \
    php-soap php-common php-cli php-mbstring php-bcmath php-ldap \

    jeffath 發表在 痞客邦 留言(0) 人氣()

    RewriteEngine On
    #強制轉到/api下 拿掉的話就轉到該相對目錄
    #RewriteBase /api
    RewriteCond %{REQUEST_FILENAME} !-f

    jeffath 發表在 痞客邦 留言(0) 人氣()

    https://www.slideshare.net/billkarwin/models-for-hierarchical-data

    jeffath 發表在 痞客邦 留言(0) 人氣()

    Apache Custom Log Formats



    Format String
    Description


    %%
    百分比符號


    %a
    遠端 IP 位址


    %A
    本機 IP 位址


    %B
    伺服器處理請求的最後狀態、以及在伺服器的回應中所傳送的網頁內容的位元組數


    %b
    伺服器處理請求的最後狀態、以及在伺服器的回應中所傳送的網頁內容的位元組數
    跟%B不同的是以CLF 格式顯示。例如用-來代替0


    %{Foobar}C
    傳送到伺服器的 Foobar cookie 的內容


    %D
    request 傳送到伺服器的時間 (microseconds)


    %{FOOBAR}e
    伺服器環境變數 FOOBAR 的內容


    %f
    檔名


    %h
    用戶端的主機名稱或IP位址


    %H
    request 的通訊協定


    %{Foobar}i
    The contents of Foobar: header line(s) in the request sent to the server. Changes made by other modules (e.g.mod_headers) affect this


    %{Referer}i
    連結至所請求之文件的網頁的URL


    %{User-agent}i
    提出請求的瀏覽器或其他用戶端軟體的名稱與版本


    %k
    在一個 connection requests handled 中 keepalive 的數量


    %l
    用戶端上的使用者名稱(如RFC1413所定義,並且以IdentityCheck On指令啟用此功能)


    %m
    The request method.


    %{Foobar}n
    The contents of note Foobar from another module.


    %{Foobar}o
    The contents of Foobar: header line(s) in the reply.


    %p
    伺服器回應一個 request 的 canonical port number


    %{format}p
    The canonical port of the server serving the request or the server's actual port or the client's actual port.
    Valid formats are canonical, local, or remote.


    %P
    回應 request 時的 PID


    %{format}P
    The process ID or thread id of the child that serviced the request. Valid formats are pid, tid, and hextid. hextid requires APR 1.2.0 or higher.


    %q
    The query string (prepended with a ? if a query string exists, otherwise an empty string).


    %r
    First line of request.


    %s
    狀態. 若是由內部轉址來的 request,則將顯示原始 request 的狀態


    %t
    伺服器收到 request 的時間 (standard english format)


    %{format}t
    同上,但以自訂的格式來顯示時間


    %T
    伺服器回應 request 的時間 (in seconds)


    %u
    驗證用戶端所用的使用者名稱(如果伺服器有啟用弱存取控制)


    %U
    The URL path requested (not including any query string)


    %v
    伺服器回應 request 時的 canonical ServerName


    %V
    The server name according to the UseCanonicalName setting.


    %X
    Connection status when response is completed :
     X:connection aborted before the response completed.
     +:connection may be kept alive after the response is sent.
     -:connection will be closed after the response is sent.
    This directive was %c in late versions of Apache 1.3, but this conflicted with the historical ssl %{var}c syntax.


    %I
    Bytes received, including request and headers, cannot be zero. You need to enable mod_logio to use this.


    %O
    Bytes sent, including headers, cannot be zero. You need to enable mod_logio to use this.


    jeffath 發表在 痞客邦 留言(0) 人氣()

    SELECT * FROM (SELECT country, sum(id) as cnt FROM mygroup GROUP BY country WITH rollup) t ORDER BY cnt;
    參考網址: https://www.sqlusa.com/bestpractices2005/subtotaltotalgrandtotal/

    jeffath 發表在 痞客邦 留言(0) 人氣()

    https://www.greaterscope.net/documentation/php_database_abstraction_class_comparison.html
    節錄如下
     
    Comparison of PHP Database Abstraction Classes

    jeffath 發表在 痞客邦 留言(0) 人氣()


    function Read_Excel_File2($file_name,&$result){
        require_once 'include/PHPExcel/Classes/PHPExcel/IOFactory.php';
        $result=null;
        $objReader = PHPExcel_IOFactory::createReader('Excel5');
    //    $objReader->setReadDataOnly(true);
        try{
            $objPHPExcel = $objReader->load($file_name);
        }catch(Exception $e){}
        if(!isset($objPHPExcel)) return "无法解析文件";
        $allobjWorksheets = $objPHPExcel->getAllSheets();
        foreach($allobjWorksheets as $objWorksheet){
            $sheetname=$objWorksheet->getTitle();
            $highestRow = $objWorksheet->getHighestRow(); // e.g. 10
    $highestColumn = $objWorksheet->getHighestColumn();
    $highestColumnIndex = PHPExcel_Cell::columnIndexFromString($highestColumn);
            for ($row = 1; $row <= $highestRow; ++$row) {
                for ($col = 0; $col <= $highestColumnIndex; ++$col) {
                    $cell =$objWorksheet->getCellByColumnAndRow($col, $row);
                    $value=$cell->getValue();
                    if($cell->getDataType()==PHPExcel_Cell_DataType::TYPE_NUMERIC){
                        $cellstyleformat=$cell->getParent()->getStyle( $cell->getCoordinate() )->getNumberFormat();
                        $formatcode=$cellstyleformat->getFormatCode();
                        if (preg_match('/^(\[\$[A-Z]*-[0-9A-F]*\])*[hmsdy]/i', $formatcode)) {
                           $value=gmdate("Y-m-d", PHPExcel_Shared_Date::ExcelToPHP($value));
                        }else{
                            $value=PHPExcel_Style_NumberFormat::toFormattedString($value,$formatcode);
                        }
    //                    echo $value,$formatcode,'<br>';
                        
                    }
                    $result[$sheetname][$row-1][$col]=$value;
                }
            }
        }
        return 0;
    }

    jeffath 發表在 痞客邦 留言(0) 人氣()

    今天在使用PHPExcel撰寫匯出EXCEL表格的功能時,之前一向用的好好的,但這次卻莫名其妙停住了。
    看了一下Apache error log 顯示PHP Fatal error:  Allowed memory size of 67108864 bytes exhausted 
    暫時將記憶體使用限制調整為 1024M也不行
    ini_set( 'memory_limit', '1024M' );

    jeffath 發表在 痞客邦 留言(1) 人氣()

    1
    Blog Stats
    ⚠️

    成人內容提醒

    本部落格內容僅限年滿十八歲者瀏覽。
    若您未滿十八歲,請立即離開。

    已滿十八歲者,亦請勿將內容提供給未成年人士。