PHP

From HaFrWiki
Revision as of 13:30, 15 May 2021 by Hjmf (talk | contribs) (PHP Language)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

PHP [1] is a widely-used general-purpose scripting language that is especially suited for Web development and can be embedded into HTML. PHP development is (heavily) under development [2].

ASP

When you are looking for the PHP equivalents to ASP, ther are several sites giving solutions:

Mac OSX

The location of php.ini is in /private/etc. If it is not there then

$ sudo cp /private/etc/php.ini.default /private/etc/php.ini

Pear

Pear is the installation tool for PHP. To install pear please note that:

  • Environment variable for PHP are available:
    • PHP_BIN: Should be the full path tp PHP.exe, i.e. f:\wamp\bin\php\php5.3.0\php.exe
    • Use the go-pear.phar, and be aware to go to the directory containing this file.
    • Keep notice of the changes in the environment for pear.

See also:

Mac Pear

From: http://stackoverflow.com/questions/8333279/phpunit-warning-requirephpunit-autoload-php-failed-to-open-stream-no-such
I hit a similar issue on MAC OSX Lion. I installed phpunit with the PEAR package manager, and when I try to run it I got the error as described by udo. I was able to resolve it with the following simple steps:

  1. Get the latest php archive of pear
    curl http://pear.php.net/go-pear.phar > go-pear.php
  2. Install the archive with
    sudo php -q go-pear.php

During installation, it detects if the include_path in your php.ini does not contain the PEAR PHP directory. You can choose to let it fix it for you automatically when given the option.
Comments
By Howard Lo
Cool thanks, I'd like to add something, after these steps I had to install phpunit again using the following commands:

$ sudo pear channel-discover pear.phpunit.de 
$ sudo pear channel-discover components.ez.no 
$ sudo pear channel-discover pear.symfony-project.com 
$ sudo pear install phpunit/PHPUnit 

Sebastian Perez Feb 16 at 15:43

Mac Pear Alternative

On Mac OS 10.4 and earlier, the PEAR Package Manager is already installed in /usr/bin/pear.

To install your version of pear, get the latest version of pear into a writeable directory:

$ cd /Downloads
$ curl http://pear.php.net/go-pear.phar > go-pear.php

To make it easier got to the directory here to install. For example:

$ cd /usr/local/bin
$ php -d detect_unicode=0 /Downloads/go-pear.phar

Add the directories to the path in your .profile.

# Add some more custom software to PATH.
PATH=/usr/local/pear/bin:$PATH
export PATH

PHP Language

A very short language reference and mainly meant for giving hints on the one or more specific topics. So this is not a full language reference at all!

  • PHP Namespages, What are namespaces? In the PHP world, namespaces are designed to solve two problems that authors of libraries and applications encounter when creating re-usable code elements such as classes or functions:
    • Name collisions between code you create, and internal PHP classes/functions/constants or third-party classes/functions/constants.
    • Ability to alias (or shorten) Extra_Long_Names designed to alleviate the first problem, improving readability of source code.
  • PHP Function Reference,
  • Type Declaration, PHP 7 return type declaration and argument type declaration.

PHPUnit

PHPUnit is equivalent to JUnit. To install PHPUnit with pear use the commands:

  • pear config-set auto_discover 1
  • pear install pear.phpunit.de/PHPUnit

See also:

W3 Schools

The W3 Schools has a specific site for PHP. Nice to learn the language and also a reference how to use the language.

WAMP

WAMP stands for Windows Apache Mysql and PHP. It is often use because it is the most simple implementation of a web-server (Apache), a Database (MySQL) and a programming language (PHP) on the windows environment.

  • Howto upgrade: WAMP.

Smarty

Smarty [3] is a template engine for PHP, facilitating the separation of presentation (HTML/CSS) from application logic. This implies that PHP code is application logic, and is separated from the presentation.
The Smarty design is based on the philosophy:

  • clean separation of presentation from application code
  • PHP backend, Smarty template frontend
  • compliment PHP, not replace it
  • fast development/deployment for programmers and designers
  • quick and easy to maintain
  • syntax easy to understand, no PHP knowledge required
  • flexibility for custom development
  • security: insulation from PHP
  • free, open source

PHP Documentator

Documentation Generator for PHP [4] 2 is a tool with which it is possible to generate documentation from your PHP source code. With this documentation you can provide your consumers with more information regarding the functionality embedded within your source and not only what is usable to them from your user interface. Documentation generated by phpDocumentor 2 does not aim to be a replacement for conventional documentation but is rather supplemental, or reference, documentation. This documention can prove to be very useful in the following, example, situations:

  • Sets of libraries or applications providing an API, such as phpDocumentor 2 itself
  • Frameworks, such as Zend Framework or Symfony
  • Pluggable architectures, such as WordPress or PyroCMS
  • Long-running, complex projects, to help you find the right function or method for the job

Install

Easy installation of the PHP Documentator using pear:

$ pear channel-discover pear.phpdoc.org
$ pear install phpdoc/phpDocumentor-alpha

See also

Internal

  • PHP Composer is a tool for dependency management in PHP. It allows you to declare the libraries your project depends on and it will manage (install/update) them for you.

External

top

  • PHP.net, The PHP Site. Containing downloads, references and manuals.
  • PEAR
  • PHPLens PHP Everywhere.
  • PHP2Net Tutorials
  • phpunit.de, PHPUnit testing by Sebastian Bergman. An implementation of JUnit texting for PHP.
  • PHP GTK, PHP-GTK [5] is a PHP extension that implements language bindings for GTK+. It provides an object-oriented interface to GTK+ classes and functions and greatly simplifies writing client side cross-platform GUI applications.
  • WAMP, Apple OSX Apache Webserver and Windows Apache Webserver, or Apache, MySQL and PHP.
  • Sonar, Quality management, metrics, static and dynamic software analysis, now also available for PHP with the plugins:

Reference

top

  1. PHP.net The official PHP Website. The quote is from this website.
  2. PHP the Right Way, website aims to introduce new PHP developers to some topics which they may not discover until it is too late, and aims to give seasoned pros some fresh ideas on those topics they’ve been doing for years without ever reconsidering.
  3. Smarty Home Page, A template library for PHP.
  4. phpdoc, Homepage of the PHP Documentator
  5. GTK+ (GIMP Toolkit) is a cross-platform widget toolkit for creating graphical user interfaces.