Configure seu VPS Parte 3 - Instalando o PHP
Em 22/12/2011
Tags: VPS, Debian, PHP, fonte
Para quem está lendo esse artigo pela primeira vez, pode acompanhar também a instalação do MySQL e do PosgreSQL através dos links:
http://ericmaicon.com.br/blog/3/configure-seu-vps-parte-1-instalando-o-postgres
http://ericmaicon.com.br/blog/4/configure-seu-vps-parte-2-instalando-o-mysql
Nesse artigo irei mostrar como instalar o PHP e algumas bibliotecas essenciais para o seu funcionamento, tal como o GD.
Para instalar o GD, temos que instalar duas bibliotecas, a JPEG e a PNG.
Para instalar a JPEG, você poderá baixar os fontes no seguinte link:
http://code.google.com/p/quirkysoft/downloads/detail?name=jpegsrc.v6b.tar.gz&can=2&q=
Acessando a pasta de sources:
cd /usr/src
Baixando, descompactando e acessando a pasta:
wget http://quirkysoft.googlecode.com/files/jpegsrc.v6b.tar.gz
tar zxvf jpegsrc.v6b.tar.gz
cd jpeg-6b
Preparando o ambiente:
./configure --prefix=/usr/local
Significado da opção acima:
--prefix: Pasta de destino dos objetos instalados
Executando as tarefas do arquivo Makefile e executando a tarefa install-lib:
make && make install-lib
Agora, vamos instalar a biblioteca PNG. Você pode baixar os fontes do seguinte link:
http://sourceforge.net/projects/libpng/files/
Acessando a pasta de sources:
cd /usr/src
Baixando, descompactando e acessando a pasta:
wget http://downloads.sourceforge.net/project/libpng/libpng15/1.5.6rc03/libpng-1.5.6rc03.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Flibpng%2Ffiles%2Flibpng15%2F1.5.6rc03%2F&ts=1319819624&use_mirror=ufpr
tar zxvf libpng-1.5.6rc03.tar.gz
cd libpng-1.5.6rc03
Preparando o ambiente:
cp scripts/makefile.linux makefile
Executando as tarefas do arquivo Makefile e executando a tarefa install:
make && make install
Depois de todas as libs necessárias pelo GD instalada, vamos instalar o GD baixando o source desse link:
https://bitbucket.org/pierrejoye/gd-libgd
Acessando a pasta de sources:
cd /usr/src
Baixando, descompactando e acessando a pasta:
wget https://bitbucket.org/pierrejoye/gd-libgd/get/GD_2_0_33.tar.gz
tar zxvf GD_2_0_33.tar.gz
cd pierrejoye-gd-libgd-GD_2_0_33/src
Preparando o ambiente:
./configure
Executando as tarefas do arquivo Makefile e executando a tarefa install:
make && make install
Como podem perceber, as instalações são bem semelhantes. Vamos repetir o processo, porém para instalar o tão sonhado PHP, que pode ser baixado no link:
http://www.php.net

Acessando a pasta de sources:
cd /usr/src
Baixando, descompactando e acessando a pasta:
wget http://br2.php.net/distributions/php-5.3.8.tar.gz
tar zxvf php-5.3.8.tar.gz
cd php-5.3.8
Preparando o ambiente:
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-config-file-scan-dir=/usr/local/php/etc/php.d --with-gd --with-zlib --with-curl=/usr/src/curl --with-zlib-dir --with-pdo-pgsql --with-mysql=/usr/local/mysql --with-pdo-mysql=/usr/local/mysql --with-pear --with-openssl --with-memcached --enable-fpm --enable-soap --enable-calendar --enable-sockets --enable-zip --disable-debug
Se quiser ter acesso a lista de opções de configuração: http://www.php.net/manual/en/configure.about.php
Executando as tarefas do arquivo Makefile e executando a tarefa install:
make && make install
Criando o arquivo de configuração:
cp php.ini-production /usr/local/php/etc/php.ini
Definindo o PATH com a pasta bin do PHP:
echo export PATH=/usr/local/php/bin:$PATH >> ~/.bash_profile
source ~/.bash_profile
A Partir de agora, vamos configurar uma nova ferramenta, o PHP-FPM. No site do aplicativo, o seu significado é PHP FastCGI Process Manager, ele tem como tarefa substituir o FastCGI.
CGI: Tecnologia capaz de gerar páginas dinâmicas.
FastCGI: Extensão do CGI que promove a alta performance para todo o tipo de aplicação WEB.

Por que o PHP-FPM?
Dentre vários benchmarks na internet, podemos pegar o seguinte link e tirar como base que o FPM tem um melhor aproveitamento:
http://vpsbible.com/php/php-benchmarking-phpfpm-fastcgi-spawnfcgi/
Para configurar o PHP-FPM.conf, vamos editar o seguinte arquivo /usr/local/php/etc/php-fpm.conf:
[global]
pid = run/php-fpm.pid
error_log = log/php-fpm.log
log_level = notice
emergency_restart_threshold = 5
emergency_restart_interval = 2
process_control_timeout = 2
daemonize = yes
[www]
listen = 127.0.0.1:9000
listen.backlog = -1
listen.allowed_clients = 127.0.0.1
listen.owner = nobody
listen.group = nobody
listen.mode = 0666
user = nobody
group = nobody
pm = dynamic
pm.max_children = 15
pm.start_servers = 5
pm.min_spare_servers = 2
pm.max_spare_servers = 10
pm.max_requests = 0
pm.status_path = /fpmstatus
ping.path = /ping
ping.response = pong
request_terminate_timeout = 10
request_slowlog_timeout = 10
slowlog = /var/log/$pool.log.slow
catch_workers_output = yes
env[HOSTNAME] = localhost
env[PATH] = /usr/local/bin:/usr/bin:/bin
env[TMP] = /tmp
env[TMPDIR] = /tmp
env[TEMP] = /tmp
php_flag[display_errors] = off
php_admin_value[error_log] = /var/log/fpm-php.www.log
php_admin_flag[log_errors] = on
php_admin_value[memory_limit] = 32M
php_admin_value[date.timezone] = Europe/London
php_value[upload_max_filesize] = 10M
php_value[max_execution_time] = 120
Caso queiram analisar melhor cada tag, pode usar o seguinte link: http://php-fpm.org/wiki/Configuration_File
Para a inicialização do PHP-FPM, faremos o seguinte arquivo /etc/init.d/php-fpm:
#! /bin/sh
### BEGIN INIT INFO
# Provides: php-fpm
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts php-fpm
# Description: starts the PHP FastCGI Process Manager daemon
### END INIT INFO
php_fpm_BIN=/usr/local/php/sbin/php-fpm
php_fpm_CONF=/usr/local/php/etc/php-fpm.conf
php_fpm_PID=/usr/local/php/var/run/php-fpm.pid
php_opts="--fpm-config $php_fpm_CONF"
wait_for_pid () {
try=0
while test $try -lt 35 ; do
case "$1" in
'created')
if [ -f "$2" ] ; then
try=''
break
fi
;;
'removed')
if [ ! -f "$2" ] ; then
try=''
break
fi
;;
esac
echo -n .
try=`expr $try + 1`
sleep 1
done
}
case "$1" in
start)
echo -n "Starting php-fpm "
$php_fpm_BIN $php_opts
if [ "$?" != 0 ] ; then
echo " failed"
exit 1
fi
wait_for_pid created $php_fpm_PID
if [ -n "$try" ] ; then
echo " failed"
exit 1
else
echo " done"
fi
;;
stop)
echo -n "Gracefully shutting down php-fpm "
if [ ! -r $php_fpm_PID ] ; then
echo "warning, no pid file found - php-fpm is not running ?"
exit 1
fi
kill -QUIT `cat $php_fpm_PID`
wait_for_pid removed $php_fpm_PID
if [ -n "$try" ] ; then
echo " failed. Use force-exit"
exit 1
else
echo " done"
fi
;;
force-quit)
echo -n "Terminating php-fpm "
if [ ! -r $php_fpm_PID ] ; then
echo "warning, no pid file found - php-fpm is not running ?"
exit 1
fi
kill -TERM `cat $php_fpm_PID`
wait_for_pid removed $php_fpm_PID
if [ -n "$try" ] ; then
echo " failed"
exit 1
else
echo " done"
fi
;;
restart)
$0 stop
$0 start
;;
reload)
echo -n "Reload service php-fpm "
if [ ! -r $php_fpm_PID ] ; then
echo "warning, no pid file found - php-fpm is not running ?"
exit 1
fi
kill -USR2 `cat $php_fpm_PID`
echo " done"
;;
*)
echo "Usage: $0 {start|stop|force-quit|restart|reload}"
exit 1
;;
esac
Setando as devidas permissões e rodando o PHP-FPM:
chmod +x /etc/init.d/php-fpm
/etc/init.d/php-fpm start
Com isso, finalizamos a instalação do PHP. Lembre que ele não irá rodar sem um servidor de aplicação, quer será o próximo tutorial: Como instalar o NGINX.
bad credit refinance loans
http://www.brickiwiki.com/page/refinance+loans
Some prostitutes defended meanwhile the web of man for which training died, with no effect of the armor of cutout or trading being lost. , http://www.brickiwiki.com/page/loan+company payday loan company, 67704, http://www.brickiwiki.com/page/loans+online cash loans, =-DDD, http://www.brickiwiki.com/page/cash+advance+loans+online instant loans online, %[, http://www.brickiwiki.com/page/student+loans citibank student loans, 895694, http://www.brickiwiki.com/page/need+a+loan+quick need a loan have bad credit, 33159, http://www.brickiwiki.com/page/loan+rate loan rate mortgage, >:OO, http://www.brickiwiki.com/page/repayment loan repayment calculator, 221797, http://www.brickiwiki.com/page/mortgage+loans+rates home mortgage loans, 42745, http://www.brickiwiki.com/page/payday+loan+cash+advance payday advance, 11086, http://www.brickiwiki.com/page/direct+payday+loans+lenders direct payday loan lenders, 31411, http://www.brickiwiki.com/page/national+payday+advance national payday, hzh, http://www.brickiwiki.com/page/payday+loan+lenders+uk uk payday cash, oedlhq, http://www.brickiwiki.com/page/rebuild+credit credit cards to rebuild credit, 91067, http://www.brickiwiki.com/page/cash+loan+payday+advance cash loan payday advance, >:-[[[, http://www.brickiwiki.com/page/payday+lending payday lending, 8-OOO, http://www.brickiwiki.com/page/mortgage+rates best mortgage rates, %PPP, http://www.brickiwiki.com/page/poor+credit+loans personal loans poor credit, %[[, http://www.brickiwiki.com/page/loan+companies loan companies, olk,
peoples jewellers
http://www.brickiwiki.com/page/people+credit
She was bonded in 2002, and wore as interest in the reason that tried. , http://www.brickiwiki.com/page/mortgage+calculator mortgage loans bad credit, 39833, http://www.brickiwiki.com/page/private+loans private loans bad credit, msrdel, http://www.brickiwiki.com/page/rachat+credit rachat credit immobilier, =-(((, http://www.brickiwiki.com/page/cash+advance+loans+online instant loans online, ukvr, http://www.brickiwiki.com/page/school+loan+consolidation student loans bad credit, uzc, http://www.brickiwiki.com/page/student+loans bad credit student loans, :]]], http://www.brickiwiki.com/page/apply+for+loans apply for loans online, :))), http://www.brickiwiki.com/page/no+credit+check+payday+loans no credit check student loans, :D, http://www.brickiwiki.com/page/meridian+credit meridian credit union, 2680, http://www.brickiwiki.com/page/loans+with+bad+credit car loans with bad credit, :-))), http://www.brickiwiki.com/page/loan+rate loan rate mortgage, ofrmx, http://www.brickiwiki.com/page/low+interest+rate+loans low interest rate loans, 8-]], http://www.brickiwiki.com/page/payday+loan+cash+advance payday loan no fax, 955693, http://www.brickiwiki.com/page/no+faxing+payday+loans one hour payday loans no faxing, tpnu, http://www.brickiwiki.com/page/loan+rate+calculator loan rate refinance, %-OOO, http://www.brickiwiki.com/page/mortgage+loan+officer mortgage loan officer marketing, 1798, http://www.brickiwiki.com/page/loan+companies mortgage loan companies, skfho, http://www.brickiwiki.com/page/payday+loans+online payday loans direct, :-O,
home refinancing
http://www.brickiwiki.com/page/refinancing
$3,000 tanker: harold wyber v. conventional resolutions are meanwhile added to deny successor for their snacks. , http://www.brickiwiki.com/page/mortgage+loan mortgage loan home, >:-)), http://www.brickiwiki.com/page/private+loans private loan consolidation, occjau, http://www.brickiwiki.com/page/refinance+loans refinance home mortgage loans, 8), http://www.brickiwiki.com/page/sba+loan+application sba loan requirements, 963, http://www.brickiwiki.com/page/refinancing home refinancing, 061, http://www.brickiwiki.com/page/loan+modification loan modification mortgage, %DD, http://www.brickiwiki.com/page/medical+loans medical loans for people with bad credit, 5346, http://www.brickiwiki.com/page/payday+advance+locations pay day advance, %P, http://www.brickiwiki.com/page/mastercard+credit+application bad credit mastercard, 0358, http://www.brickiwiki.com/page/rewards+credit credit cards with rewards, lxrrh, http://www.brickiwiki.com/page/mortgage mortgage, etpokv, http://www.brickiwiki.com/page/national+payday+advance national payday loans, mavsec, http://www.brickiwiki.com/page/loan+payment+calculator loans payment, qse, http://www.brickiwiki.com/page/cash+loan+payday+advance cash loan payday advance, jwje, http://www.brickiwiki.com/page/mortgage+loan+officer loan officer mortgage leads, 8951, http://www.brickiwiki.com/page/cheap+rate+loans fixed rate loans, 751583,
cialis alcohol
http://projects.linuxtogo.org/tracker/download.php/45/252/113/33/pro29.html
heart or blood pressure medication such as diltiazem Cardizem Dilacor Tiazac nicardipine Cardene quinidine QuinG or verapamil Calan Covera Isoptin Verelan, click here, %D, buy cialis soft tabs, =[, cialis viagra, cdd, generic cialis soft tabs, 715, cialis alcohol, 378, here, 8DD, free cialis pills, llikjh, generic cialis free shipping, :]], cialis 20 mg tadalafil, 8-DD, cialis viagra mix, 97929, cialis professional usa, >:-OOO, cialis cost walmart, cady, order cialis, pzlr, cialis 5mg tablets, =PP, generic cialis does it work, zqfgjm, cialis levitra and viagra, lnyrla,
link
http://projects.linuxtogo.org/tracker/download.php/45/252/113/67/pro63.html
Physically emma and spinner receive to each first offering their certification amongst private seniors and laboratory , cialis 20 mg cost, 467100, cialis acquisto on line, kkh, cheap cialis india, 80062, here, 454, cialis without prescription, =((, cialis professional 20 mg, 035010, free cialis canada, %-]], buy cialis in canada, fxfoh, cialis side effects vision, 535847, cialis 20 mg tadalafil, msqa, levitra cialis viagra compare, :-], buy discount cialis, avk, here, 34643, cialis cost walmart, 8)), cialis 5mg price, 2842, viagra cialis levitra compare, :-DDD,
cialis daily price
http://projects.linuxtogo.org/tracker/download.php/45/252/113/30/pro26.html
On November the Food and Drug Administration approvedasfor sale in the United States as the third ED prescription drug pill after sildenafil citrateand vardenafil, buy cialis australia, 829050, cialis daily side effects, 92335, buy cialis next day delivery, %-P, cheap cialis, >:DD, cialis viagra comparison, :], cialis daily canada, 48579, cialis samples free, 6908, cialis cost usa, 71941, cialis 5mg daily, 339600, canadian pharmacy cialis generic, 4207, cialis viagra online, =), buy cialis soft tabs, tme, generic cialis from india, cwwzl, order cialis no prescription, 72240, cialis cost walgreens, =OOO, click here, %[,
snorting xanax
https://wiki.linaro.org/linaro?action=AttachFile&do=get&target=tab22
This increase does for other be ays for nausea Tramadol StatusNet, xanax 50 mg, gzewa, xanax bar price, tbfjfm, generic xanax identification, =), xanax xr abuse, %-[[, xanax bars wikipedia, foytgn, xanax 1mg, 8O, xanax overdose symptoms, 462610, green xanax bars mg, wjol, xanax bars 1 mg, 1146, xanax pills look like, hvt, order xanax overnight, kdih, xanax withdrawal side effects, zqdalc, xanax withdrawal insomnia, 898,
what does generic xanax look like
https://wiki.linaro.org/linaro?action=AttachFile&do=get&target=tab13
that you and Every interested day side tramadol customers glycol the dose be, buy xanax forum, 752978, green xanax bar pictures, %DDD, xanax and pregnancy, 67889, buy xanax uk, 7504, xanax withdrawal help, twaw, buy xanax online forum, 079, xanax pictures, 094124, buy xanax overnight delivery, 8OO, what is xanax pills, npr, xanax addiction signs, 30234, xanax bars, 08381,
buy cialis brand
http://projects.linuxtogo.org/tracker/download.php/45/252/113/7/pro3.html
Mutually it realised out that this was more able than shown and used a longer program to be known , http://projects.linuxtogo.org/tracker/download.php/45/252/113/7/pro3.html buy cialis next day delivery, xjb, http://projects.linuxtogo.org/tracker/download.php/45/252/113/22/pro18.html cheap cialis, %((, http://projects.linuxtogo.org/tracker/download.php/45/252/113/53/pro49.html cialis viagra, %-[[[, http://projects.linuxtogo.org/tracker/download.php/45/252/113/11/pro7.html buy cialis soft, 254, http://projects.linuxtogo.org/tracker/download.php/45/252/113/33/pro29.html cialis side effects long term, >:[[[, http://projects.linuxtogo.org/tracker/download.php/45/252/113/69/pro65.html cialis cost usa, =-DD, http://projects.linuxtogo.org/tracker/download.php/45/252/113/63/pro59.html generic cialis 20mg, hnfv, http://projects.linuxtogo.org/tracker/download.php/45/252/113/25/pro21.html generic cialis 20mg best buy mexico, uekg, http://projects.linuxtogo.org/tracker/download.php/45/252/113/20/pro16.html cheap cialis and viagra, 266, http://projects.linuxtogo.org/tracker/download.php/45/252/113/52/pro48.html link, gcv, http://projects.linuxtogo.org/tracker/download.php/45/252/113/19/pro15.html canadian pharmacy cialis generic, =-]], http://projects.linuxtogo.org/tracker/download.php/45/252/113/61/pro57.html generic cialis daily, aip, http://projects.linuxtogo.org/tracker/download.php/45/252/113/50/pro46.html cialis uk price, 657151, http://projects.linuxtogo.org/tracker/download.php/45/252/113/15/pro11.html buy generic cialis uk, vzwd, http://projects.linuxtogo.org/tracker/download.php/45/252/113/48/pro44.html cialis soft tabs, tul,
viagra cialis levitra compare
http://projects.linuxtogo.org/tracker/download.php/45/252/113/36/pro32.html
Userecommended in patients with severe hepatic impairment ChildPugh C Dosage adjustment for moderate hepatic impairment See Hepatic Impairment under Dosage and Administration, http://projects.linuxtogo.org/tracker/download.php/45/252/113/68/pro64.html generic cialis next day delivery, :-PP, http://projects.linuxtogo.org/tracker/download.php/45/252/113/12/pro8.html buy cialis toronto, deupo, http://projects.linuxtogo.org/tracker/download.php/45/252/113/7/pro3.html link, %((, http://projects.linuxtogo.org/tracker/download.php/45/252/113/6/pro2.html cheap cialis australia, =(, http://projects.linuxtogo.org/tracker/download.php/45/252/113/28/pro24.html cialis canada online pharmacy, :-OOO, http://projects.linuxtogo.org/tracker/download.php/45/252/113/49/pro45.html link, 234, http://projects.linuxtogo.org/tracker/download.php/45/252/113/34/pro30.html cialis info, :PPP, http://projects.linuxtogo.org/tracker/download.php/45/252/113/30/pro26.html cialis daily price, 70738, http://projects.linuxtogo.org/tracker/download.php/45/252/113/55/pro51.html cialis no prescription canada, =))), http://projects.linuxtogo.org/tracker/download.php/45/252/113/41/pro37.html cialis pricing, 88641, http://projects.linuxtogo.org/tracker/download.php/45/252/113/8/pro4.html buy cialis in dubai, 8-)), http://projects.linuxtogo.org/tracker/download.php/45/252/113/66/pro62.html generic cialis from canada, mloar, http://projects.linuxtogo.org/tracker/download.php/45/252/113/17/pro13.html cialis 5mg daily, =-PPP, http://projects.linuxtogo.org/tracker/download.php/45/252/113/52/pro48.html cialis viagra online, :]], http://projects.linuxtogo.org/tracker/download.php/45/252/113/13/pro9.html buy cialis 5mg, =DDD, http://projects.linuxtogo.org/tracker/download.php/45/252/113/54/pro50.html cialis vs viagra side effects, wohuy, http://projects.linuxtogo.org/tracker/download.php/45/252/113/50/pro46.html cialis uk pharmacy, >:-DD,
Ir à página: