MANUAL DE PHP

(y algo mas)windsurf pozo izquierdo
Google
search for in the  
ELMARRAJO.COM mysql bulma desarrollo web linux fedora html ayuda

windsurf mercedes camper

getmypid

(PHP 3, PHP 4, PHP 5)

getmypid -- Obtiene el ID del proceso PHP

Descripción

int getmypid ( void )

Devuelve el ID del proceso PHP actual, o FALSE si ocurre un error.

Aviso

Los IDs de proceso no son únicos, por lo tanto son una fuente débil de entropía. Es recomendable no depender en ids de proceso en contextos sujetos a consideraciones de seguridad.

Vea también getmygid(), getmyuid(), get_current_user(), getmyinode(), y getlastmod().



add a note add a note User Contributed Notes
getmypid
kroczu at interia dot pl
19-Dec-2005 04:59
<?
/*

mixed getpidinfo(mixed pid [, string system_ps_command_options])

this function gets PID-info from system ps command and return it in useful assoc-array,
or return false and trigger warning if PID doesn't exists

$pidifo=getpidinfo(12345);

print_r($pidifo);

Array
(
   [USER] => user
   [PID] => 12345
   [%CPU] => 0.0
   [%MEM] => 0.0
   [VSZ] => 1720
   [RSS] => 8
   [TT] => ??
   [STAT] => Is
   [STARTED] => 6:00PM
   [TIME] => 0:00.01
   [COMMAND] => php someproces.php > logfile
)

*/

//////////////////////////////////////////////

function getpidinfo($pid, $ps_opt="aux"){

  
$ps=shell_exec("ps ".$ps_opt."p ".$pid);
  
$ps=explode("\n", $ps);
  
   if(
count($ps)<2){
    
trigger_error("PID ".$pid." doesn't exists", E_USER_WARNING);
     return
false;
   }

   foreach(
$ps as $key=>$val){
    
$ps[$key]=explode(" ", ereg_replace(" +", " ", trim($ps[$key])));
   }

   foreach(
$ps[0] as $key=>$val){
    
$pidinfo[$val] = $ps[1][$key];
     unset(
$ps[1][$key]);
   }
  
   if(
is_array($ps[1])){
    
$pidinfo[$val].=" ".implode(" ", $ps[1]);
   }
   return
$pidinfo;
}

?>
Pure-PHP
21-Mar-2005 02:26
You can use this function also to avoid more than one instance of your app.

You can also use this class.
http://www.pure-php.de/node/20

Usage:

<?php

inlude
("ProcessHandler.class.php");

if(
ProcessHandler::isActive()){
   die(
"Already running!\n";);
}else{
  
ProcessHandler::activate();
  
//run my app
}

?>
brooke at jump dot net
24-Oct-2003 05:49
One good use for this is deciding on a concurrency-safe temporary file or directory name. You can be assured that no two processes on the same server have the same PID, so this is enough to avoid collisions. For example:

$tmpfile = "/tmp/foo_".getmypid();
// Use $tmpfile...
// Use $tmpfile...
// Use $tmpfile...
unlink ($tmpfile);

If you are sharing /tmp over the network (which is odd....) then you can, of course, mix in the PHP server's IP address.
barry at staes dot nl
29-Jul-2003 12:26
Why dont use use uniqid() to get a unique serial nr for security purposes?
Or md5(uniqid()), for extra fun.
Check http://www.php.net/uniqid for more about this..
Webmaster at PopCart dot com
26-Mar-2003 04:29
$_SERVER['REMOTE_ADDR'] is a bad thing to use these days.
Since AOL, and MSN Browsers change the IP address at the
most uncomfortable times, such as going from unsecure to
secure mode, you cannot rely on it staying the same anymore.
Using this Octal-Quad for hanging on to a user, such as in
shopping carts will ALWAYS FAIL with AOL browsers.  FYI.
10-Sep-2002 02:46
Something you can use to combine several weak entropy sources, into a better init value for srand() and mt_srand():

mt_srand(time()
   ^ (int)microtime()
   ^ ip2long($_SERVER['REMOTE_ADDR'])
   ^ (int)$_SERVER['REMOTE_PORT']
   ^ @getmypid()
   ^ @disk_free_space('/tmp')
   );

Note that getmypid() may return 0 on some shared PHP installations that have excluded it for "safe"...

The safe mode also exclude the disk_free_space(directory) function call in some cases, for security reason. This explains the use of the @ operator to ignore warnings... the directory should be a highly active directory, which is accessible and typically used for temporary contents generated by PHP.

The above code combines all these sources using XOR binary operations, to avoid 32-bit overflows.
carl at NOSPAM dot thep dot lu dot se
05-Aug-2001 04:07
As it is very unlikely today that there will be two PHP processes with
the same process ID within the same microsecond, this function can
be used for something like srand((int)microtime() ^ getmypid() ^ time())
to have a decent chance of avioding a collision.
<p>
Just relying on the time in microseconds is a rather Bad Thing to do, since
a contect switch might very well take a lot less than that, so there's a decent
chance of two simultaneous request to get the same ID.
<P>
If you're running your php script upon an HTTP request, you might even want to toss in the IP addy of the remote host in your seed for a bit of extra entropy. You can't be too paranoid when it comes to 'random' numbers.
<p>(Side note: I tried using hardware to generate random numbers, but
with my setup it took just about forever to gather enough entropy.
All hail ran3()! )

Citas célebres

En los comienzos de un amor, los amantes hablan de porvenir; en su declive, hablan del pasado.

André Maurois
Escritor francés
(1885-1970)
Citas en tu mail
©Contenidos Gratis

Ilusiones Opticas
ilusion_optica_059.jpg
Contenidos Web

Chiste de... Varios
Póquer destapado

Después de una mano de póquer pregunta uno al perdedor:

- ¿Por qué subió usted la apuesta? Está bien claro que el otro tenía cuatro ases. En cambio, ¿usted que tenía?

- Dos reinas...y seis whiskys.
Chistes en tu mail
©ContenidosGratis

Humor Gráfico
humor_grafico_007.jpg
Contenidos Web

Inicio | Acción | Estrategia | Palabras | Puzzles | Solitarios | Foro Trucos
Cake ManiaCake Mania
Jugadores: 6835
Categoría del juego: Acción
Objetivo del juego: Ayuda a Jill a recuperar la pastelería de su abuela llevando su propia pastelería; consigue clientes y gana dinero.
Rainbow WebRainbow Web
Jugadores: 2199
Categoría del juego: Puzzles
Objetivo del juego: Rompe un pegajoso hechizo y salva un reino de fantasía en Rainbow Web. Tendrás toneladas de diversión mientras juegas a este mágico desafío para la mente.
Mahjongg FortunaMahjongg Fortuna
Jugadores: 12462
Categoría del juego: Solitarios
Objetivo del juego: Velocidad y habilidad mental son las armas más importantes en esta versión de un antiguo juego asiático. Despeja el tablero lo antes posible haciendo clic en las fichas iguales y gánate la fama eterna de la puntuación más alta.
Chainz 2Chainz 2
Jugadores: 6955
Categoría del juego: Puzzles
Objetivo del juego: Entra en el mundo de las combinaciones con Chainz 2: Relinked, emocionante secuela del exitazo del año pasado, Chainz. Gira eslabones y crea combinaciones de 3 ó más.
DeliciousDelicious
Jugadores: 4405
Categoría del juego: Acción
Objetivo del juego: ¿Eres un as de la multitarea? ¿Quieres que tus clientes estén contentos? ¡Pues Delicious es tu juego! Sacia el apetito de los clientes y tenlos contentos; ¡no te arriesgues!
BookwormBookworm
Jugadores: 4568
Categoría del juego: Palabras
Objetivo del juego: Junta las letras para formar palabras. ¡Las palabras más largas valen más puntos!
ZumaZuma
Jugadores: 4976
Categoría del juego: Acción
Objetivo del juego: Controla el ídolo de la rana de piedra de los antiguos Zuma en este intrigante enigma de acción. ¡Dispara bolas para formar conjuntos de tres, pero si dejas que lleguen a la calavera dorada morirás!
Jewel of AtlantisJewel of Atlantis
Jugadores: 3798
Categoría del juego: Puzzles
Objetivo del juego: Descubre la ciudad hundida de la Atlántida y busca valiosos tesoros. Viaja más allá de las profundidades del mar y vive trepidantes aventuras en Jewel of Atlantis.
Jewel QuestJewel Quest
Jugadores: 3727
Categoría del juego: Puzzles
Objetivo del juego: Convierte la arena de la antigua selva en oro tan rápido como puedas juntando grupos de 3 elementos. ¡Los grupos más grandes valen más puntos!
Bejeweled 2Bejeweled 2
Jugadores: 3659
Categoría del juego: Puzzles
Objetivo del juego: Con cuatro modos de juego únicos y fascinantes, nuevas piezas de juego explosivas e imponentes fondos planetarios, Bejeweled 2 es mucho más adictivo que nunca.
Contenidos gratis en tu webSiguiente >>

Fotos divertidas
fotos_increibles_0415.jpg
Contenidos Web
microrobots avion deportes riesgo recetas cocina canaria juegos online gratis moto motociclismo horoscopos naranjas valencianas surf canarias montañismo ciudades turismo postales gratis library Horoscopos Diarios Windsurf Canarias
fregadero microondas placa electrica bañopreparar camper pantalla plananevera compresor electricacamper fiat ducato camper baño quimicomampara enrollable bañocamper aire climatizadofurgoneta surf windsurffurgoneta surf windsurftelevisor furgonetas camperfurgonetas camper cama

Sudoku del día
Nivel de dificultad: Fácil



Cómo jugar:
El juego consiste en colocar los números del 1 al nueve de tal forma que no se repita el mismo número en la columna, fila y caja (bloques 3x3 enmarcados).

©Contenidos Gratis | Sudoku en tu mail

Warning: array_rand(): First argument has to be an array in /var/www/html/contenidos/efemerides.php on line 14
Sucedió el...

31 de agosto de

Efemérides en tu mail
©Contenidos Gratis
windsurf canarias youtube porno canarias baleares valencia madrid fallera mayor campus party alcacer feria valencia fernando alonso loterias dinero inversiones violencia de genero makro empresas cartera soledad tolerancia metro valencia gobierno de españa violencia de genero UIMP navidad