background preloader


Facebook Twitter

Generating a gdb backtrace. Noticing PHP crashes There's no absolute way to know that PHP is crashing, but there may be signs.

In ubuntu make sure you installed php5-dbg – nicolas

Typically, if you access a page that is always supposed to generate output (has a leading HTML block, for example), and suddenly get "Document contains no data" from your browser, it may mean that PHP crashes somewhere along the execution of the script.

Generating a gdb backtrace

Another way to tell that PHP is crashing is by looking at the Apache error logs, and looking for SEGV (Apache 1.2) or Segmentation Fault (Apache 1.3). Nginx. PHP-FPM. PHP Accelerators. This is a list of PHP accelerators.

PHP Accelerators

Alternative PHP Cache (APC)[edit] Alternative PHP Cache is a free, open source (PHP license) framework that caches the output of the PHP bytecode compiler in shared memory, thus reducing parsing and disk I/O overhead for later requests; and a shared memory cache for user data. For an application consisting of a large source code base such as Drupal, a 3x increase in page generation speed is possible as a result.[1] It has been used at Facebook and has a mature codebase thanks to numerous contributors, including Facebook itself.[2] APC was originally scheduled for inclusion into the PHP core no later than PHP 6.[3] While multiple accelerator projects were considered desirable,[4] the focus has since moved to Optimizer Plus[5][6] which is included in the core distribution as of PHP 5.5.

eAccelerator[edit] eAccelerator was born in December 2004 as a fork of the Turck MMCache project. APC. Command line usage. Spawning php-win.exe as a child process to handle scripting in Windows applications has a few quirks (all having to do with pipes between Windows apps and console apps).

Command line usage

To do this in C++: // We will run php.exe as a child process after creating // two pipes and attaching them to stdin and stdout // of the child process // Define sa struct such that child inherits our handles SECURITY_ATTRIBUTES sa = { sizeof(SECURITY_ATTRIBUTES) }; sa.bInheritHandle = TRUE; sa.lpSecurityDescriptor = NULL; // Create the handles for our two pipes (two handles per pipe, one for each end) // We will have one pipe for stdin, and one for stdout, each with a READ and WRITE end HANDLE hStdoutRd, hStdoutWr, hStdinRd, hStdinWr; // Now create the pipes, and make them inheritable CreatePipe (&hStdoutRd, &hStdoutWr, &sa, 0)) SetHandleInformation(hStdoutRd, HANDLE_FLAG_INHERIT, 0); CreatePipe (&hStdinRd, &hStdinWr, &sa, 0) SetHandleInformation(hStdinWr, HANDLE_FLAG_INHERIT, 0); std::string processed(""); char buf[128];

PHP on the Command Line 1/2. We all know PHP is a great language for building Web applications with but we all also know there’s a lot more to running a serious Website than just the user interface.

PHP on the Command Line 1/2

There are back ups to be performed, log files to be analysed, data to be pruned and all those essential but mundane tasks that happen in the background. Typically, such routine administration tasks are prime targets for automation and, if you’ve spent any time with UNIX-based systems, you’ve probably run into the notion of shell scripts and cron. What may or may not surprise you is that PHP does a pretty good job off the Web as well. If, after reading Getting Started with PEAR, you installed the PEAR package manager, you’ve already had a taste of what PHP can do on the command line. In this two-part series, I’ll be looking at PHP’s Command Line Interface (CLI) in detail. PHP on the Command Line 2/2. In Part 1 of this tutorial, we had a look at PHP’s command line SAPI (server API).

PHP on the Command Line 2/2

In this article, we’ll take things a step further, and see how you can hook up a command line PHP script with existing command line tools provided by your operating system. In contrast to the last article, the focus of this article will be Unix-based systems — something which can’t be avoided. To steal a quote from’s CLI for Noobies series: "[Comparing] the command line environment of DOS/Windows with that of Linux, [is] like comparing a wheelbarrow with an 18-wheeler. " I’ll assume that you’re using PHP 4.3.x+ with the CLI SAPI to execute PHP scripts on the command line. Today’s Command Line options: Shell Execution: run external programs from PHPSecurity Issues: terrorists threaten the command line! Shell Execution One of the advantages of working on Unix-based systems is the wealth of command line tools that are available to solve most any common problem you can think of. What’s my Extension? #! $ . #! NGinx sous Ubuntu. NGinx est une des alternative au serveur Web Apache (il est actuellement utilisé par plus de 6% des serveurs Web).

NGinx sous Ubuntu

Il se targue d'être plus rapide, plus léger et facile à configurer. Nous allons vérifier tout cela dans ce billet en détaillant une installation de NGinx 0.8.54 (Stable) sur une machine GNU/Linux (Ubuntu Desktop 10.10) avec en bonus le support FastCGI de PHP et de Perl ! On commence par ajouter le dépôt officiel pour la version stable: Nginx + varnish + memcached. Je viens de passer le cap et de m'abonner à un serveur dédié chez

nginx + varnish + memcached

Mon choix s'est porté vers une Dedibox DC. J'ai longtemps hésité avec une OVH Kimsufi 16G mais le fait que la Dedibox propose en standard deux disques fonctionnant en RAID1 à fait la différence (avec l'âge ou privilégie la sécurité à la performance...). Avant de migrer mon blog sur ce nouveau serveur (il est actuellement hébergé chez un VPS Gandi 4 parts), j'ai profité de disposer d'un serveur tout neuf pour valider une procédure complète d'installation et d'optimisation d'un blog WordPress sur un serveur Debian Squeeze en utilisant le "stack" Web suivant: Varnish + Nginx + MemCached. L'objectif de ce billet est de partager cette procédure avec vous. Nginx+PHP-FPM On Ubuntu 11.10.

Version 1.0 Author: Falko Timme <ft [at] falkotimme [dot] com> Follow me on Twitter Last edited 10/20/2011 Nginx (pronounced "engine x") is a free, open-source, high-performance HTTP server.

Nginx+PHP-FPM On Ubuntu 11.10

Nginx is known for its stability, rich feature set, simple configuration, and low resource consumption. This tutorial shows how you can install Nginx on an Ubuntu 11.10 server with PHP5 support (through PHP-FPM) and MySQL support. I do not issue any guarantee that this will work for you! 1 Preliminary Note In this tutorial I use the hostname with the IP address I'm running all the steps in this tutorial with root privileges, so make sure you're logged in as root: sudo su 2 Installing MySQL 5 In order to install MySQL, we run.