Skip to content

Instantly share code, notes, and snippets.

<?php
// crontab ile bu dosyayı 1 2 dakikada bir çalıştırarak eğer sunucu 502 gateway hatası vermişse o anki bazı çıktıları kaydedip
// php-cgi'ye reset atacağız.
// test edilecek site
$adres="http://www.tesedileceksite.com/";
$kaynak=file_get_contents($adres);
$desen="@502@";
$komutlar=array(
#/bin/sh
killall -9 php-cgi
/etc/init.d/php-fcgi start
@s4l1h
s4l1h / php-fcgi.sh
Created March 11, 2012 11:54
FAST CGI
#!/bin/bash
#BIND=127.0.0.1:9000
BIND=/tmp/php.socket
USER=www-data
ulimit -v 512000
PHP_FCGI_CHILDREN=15
PHP_FCGI_MAX_REQUESTS=50000
PHP_CGI=/usr/bin/php-cgi
PHP_CGI_NAME=`basename $PHP_CGI`
@s4l1h
s4l1h / php-cgi-ram.sh
Created March 13, 2012 11:10
php-cgi'nin ne kadar ram kullandığı gösterir.
#/bin/sh
total=0; for i in `ps -C php-cgi -o rss=`; do total=$(($total+$i)); done; echo "php-cgi memory usage: $total kb";
@s4l1h
s4l1h / nginx-ram.sh
Created March 13, 2012 11:12
Nginx'in ne kadar ram kullandığı gösterir.
#/bin/sh
total=0; for i in `ps -C nginx -o rss=`; do total=$(($total+$i)); done; echo "Nginx memory usage: $total kb";
@s4l1h
s4l1h / WkPdf.class.php
Created March 22, 2012 14:57
PHP wkhtmltopdf class
<?php
/**
* Örnek Kullanım
*
$detay="<h1>Test</h1>";
$dosya="test.pdf";
$wkPdf= new WkPdf();
$wkPdf->setWkPath('/usr/bin/wkhtmltopdf');
$wkPdf->setHtml($detay);
<html>
<head>
<script src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
<script>
$(document).ready(function() {
function temizle(veri) {
var temiz = veri.replace(/[^a-zA-ZığüşöçİĞÜŞÖÇîêûÎÊÛ1234567890"' ]+/g, " ");
temiz = temiz.replace(/^\s+|\s+$/g, "");
@s4l1h
s4l1h / php-fcgi.sh
Created April 28, 2012 13:45
php-fcgi
#!/bin/bash
BIND=/tmp/php.socket
USER=www-data
PHP_FCGI_CHILDREN=30
PHP_FCGI_MAX_REQUESTS=100000
PHP_CGI=/usr/bin/php-cgi
PHP_CGI_NAME=`basename $PHP_CGI`
#echo $PHP_CGI_NAME
PHP_CGI_ARGS="- USER=$USER PATH=/usr/bin PHP_FCGI_CHILDREN=$PHP_FCGI_CHILDREN PHP_FCGI_MAX_REQUESTS=$PHP_FCGI_MAX_REQUESTS $PHP_CGI -b $BIND"
@s4l1h
s4l1h / php.ini
Created April 28, 2012 13:51
/etc/php5/cgi/php.ini
[PHP]
;;;;;;;;;;;;;;;;;;;
; About php.ini ;
;;;;;;;;;;;;;;;;;;;
; PHP's initialization file, generally called php.ini, is responsible for
; configuring many of the aspects of PHP's behavior.
; PHP attempts to find and load this configuration from a number of locations.
; The following is a summary of its search order:
@s4l1h
s4l1h / php.ini
Created April 28, 2012 13:54
/etc/php5/cli/php.ini
[PHP]
;;;;;;;;;;;;;;;;;;;
; About php.ini ;
;;;;;;;;;;;;;;;;;;;
; PHP's initialization file, generally called php.ini, is responsible for
; configuring many of the aspects of PHP's behavior.
; PHP attempts to find and load this configuration from a number of locations.
; The following is a summary of its search order: