Posts

Showing posts from May, 2017

Escaping from HTML

Home  >> Basic PHP Syntax  >> Escaping from HTML E scaping from HTML Everything outside of a pair of opening and closing tags is ignored by the PHP parser which allows PHP files to have mixed content. This allows PHP to be embedded in HTML documents, for example to create templates. <p>This is going to be ignored by PHP and displayed by the browser.</p> <?php  echo  'Coders today - This line is going to be parsed.' ;  ?> <p>This will also be ignored by PHP and displayed by the browser.</p> This works as expected, because when the PHP interpreter hits the ?> closing tags, it simply starts outputting whatever it finds (except for an immediately following newline - see separation of code ) until it hits another opening tag unless in the middle of a conditional statement in which ...

PHP Tags

Image
Home  >> Basic PHP Syntax  >> PHP tags PHP Tags When PHP parses a file, it looks for opening and closing tags, which are  <?php and ?>  which tell PHP to start and stop interpreting the code between them. Parsing in this manner allows PHP to be embedded in all sorts of different documents, as everything outside of a pair of opening and closing tags is ignored by the PHP parser. PHP also allows for short open tag  <?  (which is discouraged since it is only available if enabled using the short_open_tag  php.ini configuration file directive, or if PHP was configured with the --enable-short-tags option). If a file is pure PHP code, it is preferable to omit the PHP closing tag at the end of the file. This prevents accidental whitespace or new lines being added after the PHP closing tag, which may cause unwanted effects because PHP will start output buffering when there is no intention from ...

Basic PHP Syntax

Home  >>Basic PHP Syntax Table of contents PHP tags Escaping from HTML Instruction Separation Comments

FastCGI Process Manager

Home  >> Installation of PHP  >>FastCGI Process Manager FastCGI Process Manager: FPM (FastCGI Process Manager) is another method of installing PHP with extra features. It is mostly useful for heavy-loaded sites.  The important features are:  advanced process management with graceful stop/start;  ability to start workers with different uid/gid/chroot/environment, listening on different ports and using different php.ini (replaces safe_mode);  stdout and stderr logging;  emergency restart in case of accidental opcode cache destruction;  accelerated upload support; "slowlog" - logging scripts (not just their names, but their PHP backtraces too, using ptrace and similar things to read remote process' execute_data) that are executed unusually slow; fastcgi_finish_request() - special function to finish request and flush all data while continuing to do something time-consuming (video converting, stats processing etc.); ...

Installation on Cloud

Image
Home  >> Installation of PHP  >>Installation on Cloud PHP is installed in Cloud by the following two ways 1) Azure App Services 2) Amazon EC2 Azure App Services PHP is used mostly on Azure App Services (aka Microsoft Azure, Windows Azure, Azure Web Apps). Azure App Services manages pools of Windows Web Servers to host your web application, as an alternative to managing your own web server on your own Azure Compute VMs or other servers. PHP is already enabled for your Azure App Services web site automatically. In the Azure Portal, select your web site, and you can choose which version of PHP to use. You may want to choose a newer version than the default. As such, PHP and extensions will run on Azure App Services just as it will on other Windows servers. Much of the knowledgebase is also portable, so see the Windows Troubleshooting Page too. However, the management interface for Azure App Services is different: Azure portal: create, edi...

Installation on MAC

Image
Home  >> Installation of PHP  >>Installation on Mac What is MAMP ? MAMP  - M acintosh, A pache, M ySQL, and P HP. MAMP is an application that can be installed on Mac which allows to have access to a local PHP server and MySQL server. Essentially, MAMP gives us all of the essential functionality that need to run any PHP application on our machine, for development and testing purposes . We can accomplish this in many ways, but the other ways aren't as simple like this. Step 1: Installing MAMP Before install MAMP on Mac, we'll need to download it from the MAMP website . MAMP requires that Mac be running Mac OS X 10.6.6 or later. Once the MAMP download is complete, double-click the MAMP disk image (it should be something like MAMP_2.0.3.dmg), and should get a MAMP window pop up. Drag the MAMP folder ( not MAMP PRO - we'll save that walk-through for another time) to the Applications folder. Step 2: Basic...

Installation on Windows

Image
Home  >> Installation of PHP  >> Installation on Windows XAMPP for Windows 7 version provides an easy to install Apache-MySQL-PHP-PERL-PEAR framework. XAMPP saves time and effort and provides the software support for web frameworks like Drupal, Joomla, Moodle, or wikiMedia on any Windows PC. Steps to install XAMPP: In your web browser, go to   https://www.apachefriends.org/index.html Click on the download link for XAMPP. When prompted for the download, click "Save" and wait for your download to finish. Open CD or DVD drive from My Computer.  Install the program, and click on "Run." Accept the default settings.  A command will open and offer an initial installation prompt. Just hit the Enter key, and accept the default settings. To simplify installation, just hit ENTER when prompted on the command line. You can always change settings, by editing the configuration files later. ...

Installation on Unix systems

Image
Home  >> Installation of PHP  >>Installation on Unix Systems Installing PHP on Unix System is now become so easy because of the software bundle (LAMP)  LAMP can be installed in two ways 1) GUI Mode LAMP refers to Linux + Apache + MySQL + PHP so installing these will give you an LAMP server, to install that easily you can use tasksel which you can install by opening a terminal ( ctrl + alt + t ) and do: sudo apt-get install tasksel After that is done call tasksel with sudo rights sudo tasksel Which will show you a window similar to the one in following screen-shot: Move your selector to the LAMP entry and press space to mark it, then press tab to highlight the <ok> field and press return. This starts the installation process. 2) Command Line Mode: As pointed out by the GUI window tasksel is not necessarily needed to do the lamp-server installation you can as well do it by simply en...

Installation of PHP

Home  >>PHP Installation of PHP General Installation Considerations   Installation on Unix systems   Installation on Mac OS X  Installation on Windows systems  Installation on Cloud Computing platforms  Azure App  Services Amazon EC2 FastCGI Process Manager (FPM)            Installation Configuration Problems? Read the FAQ Other problems Bug reports Runtime Configuration The configuration file .user.ini files Where a configuration setting may be set

PHP Installation Considerations

Home  >> Installation of PHP  >>PHP Installation Considerations Before starting the installation, first we must know where PHP can be used. There are three main areas where we can use PHP,   Websites and web applications  Command line scripting.   Desktop (GUI) applications.          In order to execute the web application, we need three components: PHP itself, a web server and a web browser. We probably already have a web browser, and depending on the installed operating system , we may also have a web server (e.g. Apache on Linux and MacOS X; IIS on Windows). We may also rent webspace at a company. This way, we don't need to set up anything on our own, only write your PHP scripts, upload it to the server you rent, and see the results in the browser.           In case of setting up the server and PHP on our own, we have two choices for the method of connecting P...