Home -|- Personal Reference -|- PHP Samples
PHP is a POWERFUL (scripting) language, that is now available for use on most server space ... the web file extension will be .php, and this will be passed through the server php runtime, before being passed back to the browser as HTML ...
PHP code blocks can be encased as follows -
echo "Hello World";
Installing PHP in a WIN32 (XP) system could not be easier. There are full 'installers' available, but the recommendation way is to do it manually ... I just downloaded the following from - http://www.php.net/downloads.php -
31/05/2007 14:33 9,954,944 php-5.2.2-Win32.zip
And unzipped it all into a C:\PHP folder. It is necessary to create a php.ini
in that folder, and two 'samples' are provided - php.ini-dist and
php.ini-recommended. I used the 'recommended', copying it to php.ini. To use
some of the extensions, it is necessary to 'fix' the 'extension directory, like
extension_dir = "C:\PHP\ext"
and in my case, place the line -
first in the list, before -
Then you are ready to write a php module, and run the runtime executable, php.exe, to obtain the output, like -
C:\phptest> c:\PHP\php myscript.php > temphtml.htm
This will place the HTML output into temphtml.htm, which can then be loaded into a browser ...
I find the online PHP HELP is fantastic ;=)) Like placing [ php opendir ] into a Yahoo! search, gives you many links, like - www.php.net/opendir - which puts you in the PHP Manual, and there are ALWAYS examples, ready to cut, paste and try for your self ... I use some great PHP scripts to massage JPG image - try a Yahoo! search [php exif_thumbnail], and [php imagecreatefromjpeg] - extracting any EXIF information, writing a 'thumb', writing a normal image, and finally an image without the EXIF ... this is using it in a local WIN32 runtime environment, as mini-applications ...
To learn more exactly HOW the PHP has been configured on your server, you can use the phpinfo() function. Create a file, called say phpinfo.php, and add the single line -
<?php phpinfo(); ?>
Unload this to your site, and point your browser at it. You should be rewarded with a BIG list of parameters, showing what is enabled, and disabled in your particular server. You can compare it to what is enabled in my GoDaddy server spaces through this URI ...