PHP Scripting
Translation of the original in Catalan. Read it in: CatalàCastellano
Pof always told us that you could make scripts in PHP, well then, at last I've found a corner of the internet where it's explained how to install PHP so that it can be used as the interpreter for our scripts. A very useful thing to program for example a script that puts the syslog outputs into a database. The URL in question is: http://www.e-gineer.com/instructions/install-php3x-scripting-on-redhat5x.phtml
In order to install PHP as a script interpreter, that is, to get a PHP binary and not an Apache module when we compile, we have to do:
-
We have to do our usual config with the thousand and one little things we want PHP to have, but without the option: --with-apxs nor the option: --with-apxs2.
-
Then we do the usual make.
-
Finally, of course, the make install.
Now we can start programming scripts like madmen with PHP, that said, remember that now the first line of the script will not be:
but rather now we'll have to put:
#!/usr/local/bin/php -q
the '-q' parameter we have to put so that php doesn't show us the 'content-type' indicating the type of file that will be shown next. If you want an example of a script here's one:
3 comments
Comments from the old blog, as they were written. Comments are closed.
Oriol Rius
Ja he canviat la versió del PHP3 q pràcticament no uso per cap
pàgina actual del servidor, però q per comprobar nous bugs i fer
proves al sistema va bé tenir-lo.
Oriol Rius
Degut al tema dels modems GSM, he hagut de posar el PHP amb soport des de CGI,
de forma, q els processos q llenci puguin estar molta estona funcionant sense q
el preprocessador de PHP es queixi per excessiu temps de CPU usat per
l'script.
La única cosa q s'ha de canviar entre el PHP Scripting i el PHP CGI
Scripting és una opció al compilar el PHP, perquè no
mostri la línia on s'invoca l'interpret, la opció és:
--enable-discard-path
Oriol Rius
Instal·lat el PHP-4.0.5 per fer scripts en el servidor, amb les mateixes
propietats que el PHP-4.0.4pl1 q hi ha instal·lat actualment com a
preprocessador d'scripts PHP.
La instal·lació esta feta per fer un script en mode cgi q es
demanava a una pràctica d STT.