PHP Hypertext Preprocessor


Apache HTTP Server (httpd)

It is the most widely used Web server software developed using the language C/C++. It is developed and maintained by an open community of developers.
Es el software más usado para servidores Web desarrollado usando el lenguaje C/C++. Este es desarrollado y mantenido por una comunidad abierta de desarrolladores.

PHP

It is a scripting language designed for Web development. These scripts are interpreted and executed on the server. PHP code is commonly mixed with HTML code. The PHP Interpreter is implemented as a Module or Common Gateway Interface (CGI) executable. The figure below shows how PHP works. First, a file with extension PHP is read, the PHP interpreter looks for tags <?php. They contained PHP code. Second, the PHP code is interpreted and executed generating some text. Finally, this text is combined with the rest of the HTML in the web page. As PHP supports most programming control sentences such as: if, if-else, for, switch, while, etc., it is possible to generate HTML programmatically.
Es un lenguaje para scripts diseñado para el desarrollo en el Web. Estos scripts son interpretados y ejecutados en el servidor. El código de PHP es comúnmente mezclado con código de HTML. El Interpretador de PHP es implementado en un Módulo o en un ejecutable del tipo Common Gateway Interface (CGI). La figura de abajo muestra como PHP trabaja. Primero, un archivo con extensión PHP es leído, el Interpretador de PHP busca por etiquetas <?php. Estas contienen código de PHP. Segundo, el código de PHP es interpretado y ejecutado generado texto. Finalmente, este texto se combina con el resto del HTML en la página web. Como PHP soporta la mayoría de las sentencias de control de programación tales como: if, if-else, for, switch, while, etc., es posible generar HTML vía programa.

PhpInterpreter

Tip
The PHP code declares two variables: $x and $y. Then, echo prints the result of adding the values of $x and $y. From the point of view of the client, there is no way to tell how the sent HTML was created.
El código de PHP declara dos variables $x y $y. Entonces, echo imprime el resultado de sumar los valores de $x y $y. Desde el punto de vista del cliente, no hay forma de saber como el HTML enviado fue creado.

Problem 1
Download and install Apache HTTP Server (http://httpd.apache.org/download.cgi). Download the binaries for Win32 which are available from other sites such as: www.apachehaus.com.
Descargue e instale el servidor de HTTP de Apache (http://httpd.apache.org/download.cgi). Descargue los binarios para Win32 los cuales están disponibles en otros sitios tales como: www.apachehaus.com.

Problem 2
Install PHP.
Instale PHP.

Step A
Create a folder on your hard disk for PHP, i.,e., C:\php.

Step B
Download PHP ZIP file from http://windows.php.net/download/. Once the file has been downloaded extract the files in the folder C:\php

PhpFolder

Step C
You will find two files to configure PHP (you may use notepad to edit them if required):
  1. C:\php\php.ini-development
  2. C:\php\php.ini-production

Usted encontrará dos archivos para configurar PHP (usted pude usar el block de notar para editar si es requerido.):
  1. C:\php\php.ini-development
  2. C:\php\php.ini-production

Problem 3
Be sure you have Microsoft IIS installed: Control Panel > Programs and Features > Turn Windows Features on or off.
Asegurese que usted tiene instalado Microsoft IIS: Panel de Control > Programas y sus características > Activar o Desactivar características de Windows.

MicrosoftIIS

Problem 4
Setup Microsoft IIS for PHP.
Configurar Microsoft IIS para PHP.

Step A
Open Internet Information Services Manager: Control Panel > Administrative Tools > Internet Information Services Manager. Click at the root node on to select the Server.
Abra el administrador de Internet Information Services: Panel de Control > Herramientas Administrativas > Internet Information Services Manager. Haga clic en el nodo raíz para seleccionar el Servidor.

IISManager

Step B
Double click on Handler Mappings. Then click on: Add Module Mapping.
Hacer doble clic en Handler Mappings. Entonces haga clic en: Add Module Mapping.

HandlerMappings

AddModuleMapping

Step C
Provide the information as shown and press OK. Press the Request Restrictions... button, and select the options as shown. Press OK to close this dialog. Press OK to close the Add Module Mapping dialog. Another Dialog will open, select Yes.
Proporcione la información como se muestra y presione OK. Presione el botón de Request Restictions..., y selecciones las opciones como se muestra. Presione OK para cerrar el diálogo. Presione OK para cerrar el diálogo de Add Module Mapping. Otro diálogo se abrirá, seleccione Yes.

php_cgi_setup

RequestRestrictions

CreateFastCGI

Problem 5
Using notepad create the file hello.php. Save the file as C:\inetpub\wwwroot\hello.php. If you have installed Microsoft IIS Express the folder wwwroot may be located somewhere in C:\Users\JohnDoe.Finally, use a Web Browser to test your application.
Usando el block de notas cree el archivo hello.php. Guarde el archivo como C:\inetpub\wwwroot\hello.php. Si usted tiene instalado Microsoft IIS Express la carpetea de wwwroot puede estar localizada en algún lugar en: C:\Users\JuanPerez. Finalmente, use un Explorador Web para probar su aplicación.

hellophpContent

hellophp

hello_run

Tip
You may place a PHP island anywhere in the PHP file using: <?php .... ?>
Usted puede colocar una isla de PHP en cualquier parte del archivo PHP usando: <?php .... ?>

Tip
There are several PHP editor available, some of them are: Webmatrix, Aptana studio, Netbeans, Bluefish, Komodo edit, CodeLite, Codelobster, and Grease.
Hay varios editores de PHP disponibles, algunos de ellos son: Webmatrix, Aptana studio, Netbeans, Bluefish, Komodo edit, CodeLite, Codelobster, y Grease.

PHP Variables

A variable starts with the $ sign, followed by the name of the variable which is case sensitive. The name of a variable follows the same convention used in C/C++, for instance, the variable name must start with a letter or an underscore. The variable is created at the moment a value is assigned to it (the data type is also determined at this moment). Thus, to store text, you must use quotes like other programming languages.
Una variable comienza con el signo $, seguido del nombre de la variable el cual hace diferencia entre mayúsculas y minúsculas. El nombre de la variable sigue la misma convención usada en C/C++; por ejemplo, el nombre de la variable debe comenzar con una letra o un guión bajo. La variable es creada en el momento de asignarle un valor (el tipo de datos también es determinado en este momento). Así, para almacenar texto, usted debe usar comillas como en otros lenguajes de programación.

Problem 6
Test the following PHP file to test the use of strings in PHP.
Pruebe el siguiente archivo de PHP para probar el uso de cadenas de texto en PHP.

MyString

MyStringRun

Problem 7
Build a calculator using PHP.
Construya una calculadora usando PHP.

Calculator

CalculatorRun

Problem 8
Write and run the following PHP code to test if-else.
Escriba y corra el siguiente código de PHP para probar if-else.

TestingIF

TestingIFRun1

TestingIFRun2

Problem 9
Write and run the following PHP code to test for.
Escriba y corra el siguiente código de PHP para probar for.

TestingFor

TestingForRun

Problem 10
Write and run the following PHP code to test functions.
Escriba y corra el siguiente código de PHP para probar las funciones.

TestingFunctions

TestingFunctionsRun

Problem 11
Write and run the following PHP code to test arrays.
Escriba y corra el siguiente código de PHP para probar las arreglos.

TestingArray

TestingArrayRun

die

The function "die" prints the text and exists from the script.
La función "die" imprime el texto y se sale del script.

Problem 12
Write and run the following PHP code to test the connection with a SQL database. You need to have installed MySQLi. We will display clients from the city_bank database described in Wintempla > SQL > Sample databases .
Escriba y corra el siguiente código de PHP para probar una conexión a una base de datos SQL. Usted necesita tener instalado MySQLi. Nosotros mostraremos los clientes de la base de datos de city_bank descritos en Wintempla > SQL > Sample databases .

Step A
Create a new INI file using notepad as shown. Save the file as C:\php\php.ini. Then use IIS Manager to restart the web server: Control Panel > Administrative Tools > Internet Information Services Manager.
Cree un nuevo archivo INI usando el block de notas como se muestra. Guarde el archivo como C:\php\php.ini. Entonces use el administrador de IIS para Reiniciar el servidor web: Control Panel > Administrative Tools > Internet Information Services Manager.

ini_file_configuration

Step B
If you do not have MySQL, you need to install it.
Si usted no tiene instalado MySQL, usted necesita instalarlo.

Step C
Write and run the city_bank.sql file of Wintempla > SQL > Sample databases .
Escriba y corre el archivo city_bank.sql de Wintempla > SQL > Sample databases .

Step D
Write and test the TestingSql.php file as shown.
Escriba y pruebe el archivo TestingSql.php como se muestra.

TestingSql

TestingSqlRun

Problem 13
Indicate if it is possible to create a web application using only: (a) HTML and CGI, (b) HTML and CSS, (c) HTML and Javascript, (d) PHP, (e) HTML, Javacript and CGI.
Indique si es posible crear una aplicación web usando solamente: (a) HTMLy CGI, (b) HTML y CSS, (c) HTML y Javascript, (d) PHP, (e) HTML, Javacript y CGI.

© Copyright 2000-2021 Wintempla selo. All Rights Reserved. Jul 22 2021. Home