Wednesday, September 14, 2016

How to install PHP and APACHE on LINUX?
               
                Installation Prerequisites
Let’s begin the installation process by downloading the necessary software. At a minimum, this will entail downloading PHP and the appropriate web server (either Apache or IIS 7, depending on your platform and preference). If your platform requires additional downloads, that information will be Provided in the appropriate section. Enjoy the reading.
                How to Download Apache?
These days, Apache is packaged with all mainstream Linux distributions. So if you’re using one of these platforms, chances are quite good you already have it installed or can easily install it through your distribution’s packaging service (e.g., by running the apt-get command on Ubuntu).
                Downloading PHP?
Like Apache, PHP is available through all Linux distributions’ package environments nowadays,
                Downloading the Documentation?
Both the Apache and PHP projects offer truly exemplary documentation, covering practically every aspect of the respective technology in lucid detail. You can view the latest respective versions at http://httpd.apache.org and www.php.net, or download a local version to your local machine and read it there.
Downloading the Apache Manual?
Each Apache distribution comes packaged with the latest versions of the documentation in XML and HTML formats and in a variety of languages. The documentation is located in the directory docs, found in the installation root directory.
Should you need to upgrade your local version, require an alternative format such as PDF or Microsoft Compiled HTML Help (CHM) files, or want to browse it online, proceed to the following website: http://httpd.apache.org/docs-project.
Downloading the PHP Manual?
The PHP documentation is available in more than 20 languages and in a variety of formats, including a single HTML page, multiple HTML pages, and CHM files. These versions are generated from DocBook-based master files, which can be retrieved from the PHP project’s CVS server should you wish to convert to another format. The documentation is located in the directory manual in the installation directory.
                How To Install Apache and PHP on Linux Plateform?
This section guides you through the process of building Apache and PHP from source, targeting the Linux platform. You need a respectable ANSI-C compiler and build system, two items that are available through all of the major distributions’ package managers. In addition, PHP requires both Flex (http://flex.sourceforge.net) and Bison (www.gnu.org/software/bison/bison.html), while Apache requires at least Perl version 5.003. Finally, you’ll need root access to the target server to complete the build process.
For the sake of convenience, before beginning the installation process, consider moving both packages to a common location such as /usr/src/. The installation process follows:
1.  Unzip and untar Apache and PHP. In the following code, represents the latest stable version numbers of the distributions you downloaded in the
Previous section:
%>gunzip httpd-2_X_XX.tar.gz
%>tar xvf httpd-2_X_XX.tar
%>gunzip php-XX.tar.gz
%>tar xvf php-XX.tar
2.  Configure and build Apache. At a minimum, you’ll want to pass the option --enable-so, which tells Apache to enable the ability to load shared modules:
%>cd httpd-2_X_XX
%>./configure --enable-so [other options]
%>make
3.  Install Apache (which you will need to do as the system super user):
%>make install
4.  Configure, build, and install PHP (see the “Configuring PHP at Build Time on
Linux” section for information regarding modifying installation defaults and
incorporating third-party extensions into PHP). In the following steps,
APACHE_INSTALL_DIR is a placeholder for the path to Apache’s installed location,
for instance /usr/local/apache2:
%>cd ../php-X_XX
%>./configure --with-apxs2=APACHE_INSTALL_DIR/bin/apxs [other options]
%>make
%>make install
5.  PHP comes bundled with a configuration file that controls many aspects of PHP’s behaviour. This file is known as php.ini, but it was originally named php.ini-dist. You need to copy this file to its appropriate location and rename it php.ini. The later section “Configuring PHP” examines php.ini’s purpose and contents in detail. Note that you can place this configuration file anywhere you please, but if you choose a nondefaultlocation, you also need to configure PHP using the --with-config-file-path option. Also note that there is another default configuration file at your disposal, php.ini-recommended. This file sets various nonstandard settings and is intended to better secure and optimize your installation, although this configuration may not be fully compatible with some of the legacy applications. Consider using this file in lieu of php.ini-dist. To use this file, execute the following command:
%>cp php.ini-recommended /usr/local/lib/php.ini
6.  Open Apache’s configuration file, known as httpd.conf, and verify that the
following lines exist. (The httpd.conffile is located at
APACHE_INSTALL_DIR/conf/httpd.conf.) If they don’t exist, go ahead and add them. Consider adding each alongside the other LoadModuleand AddType
entries, respectively:
LoadModule php5_module modules/libphp5.so
AddType application/x-httpd-php .php
Believe it or not, that’s it. Restart the Apache server with the following command:
%>/usr/local/apache/bin/apachectl restart
The Way ToTest Installation?
The best way to verify your PHP installation is by attempting to execute a PHP script. Open a text editor and add the following lines to a new file:
<?php
phpinfo();
?>
Save this file as phpinfo.php. If you’re running Apache, save it to the htdocs directory. If you’re
Now open a browser and access this file by entering the following URL:
http://localhost/phpinfo.php. Please note that you cannot just open the script by navigating through
your browser’s File | Open feature, because in doing so this script will not be passed through the web
server and therefore will not be parsed.
If all goes well, you should see output similar to that shown in next Figure. If you’re attempting to run
this script on a web hosting provider’s server, and you receive an error message stating phpinfo() has
been disabled for security reasons, you’ll need to create another test script. Try executing this one
instead, which should produce some simple output:
<?php
echo "A simple but effective PHP test!";
?>





If you encountered no noticeable errors during the build process but you are not seeing the appropriate output, it may be due to one or more of the following reasons:
•  If you manually configured Apache, changes to its configuration file do not take effect until Apache has been restarted. Therefore, be sure to restart Apache after adding the necessary PHP-specific lines to the httpd.conffile.
•  Invalid characters or incorrect statements will cause Apache’s restart attempt to fail. If Apache will not start, go back and review your changes.
•  Verify that any PHP-enabled file ends inthe same PHP-specific extension as defined in the httpd.conffile. For example, if you’ve defined only .phpas the recognizable extension, don’t try to embed PHP code in an .htmlfile.
•  Make sure that you’ve delimited the PHP code within the file using the <?php and ?>constructs. Neglecting to do this will cause the code to output to the browser.
•  You’ve created a file named index.php and are trying unsuccessfully to call it as you would a default directory index file (done by just referencing a directory within the URL sans the specific file name you’d like to request, for instance http://www.example.com/about/versus http://www.example.com/about/ index.php). However, Apache only recognizes index.html as the default directory index file. Therefore, you need to add index.php to Apache’s Directory Index directive.

Configuring Way For PHP?

Although the base PHP installation is sufficient for most beginning users, chances are you’ll soon want to make adjustments to the default configuration settings and possibly experiment with some of the third-party extensions that are not built into the distribution by default. In this section you’ll learn how to tweak PHP’s behaviour and features to your specific needs.

Configuring PHP at Build Time on Linux

Building PHP as described earlier in the chapter is sufficient for getting started; however, you should keep in mind the many other build-time options that are at your disposal. You can view a complete list of configuration flags (there are more than 200) by executing the following:
%>./configure --help
To make adjustments to the build process, you just need to add one or more of these arguments to PHP’s configure command, including a value assignment if necessary. For example, suppose you want to enable PHP’s FTP functionality, a feature not enabled by default. Just modify the configuration step of the PHP build process like so:
%>./configure --with-apxs2=/usr/local/apache/bin/apxs --enable-ftp
As another example, suppose you want to enable PHP’s Bzip2 extension. Just reconfigure PHP like so:
%>./configure --with-apxs2=/usr/local/apache/bin/apxs \
>--with-bz2=[INSTALL-DIR]
One common point of confusion among beginners is to assume that simply including additional flags will automatically make this functionality available via PHP. This is not necessarily the case. Keep in mind that you also need to install the software that is ultimately responsible for enabling the extension support. In the case of the bzip2 example, you need the Java Development Kit (JDK).

Run-Time Configuration
It’s possible to change PHP’s behavior at run time on both Windows and Linux through the php.ini file. This file contains myriad configuration directives that collectively control the behavior of each product. The remainder of this chapter focuses on PHP’s most commonly used configuration directives, introducing the purpose, scope, and default value of each.

Managing PHP’s Configuration Directives
Before you delve into the specifics of each directive, this section demonstrates the various ways in which these directives can be manipulated, including through the php.ini file, Apache’s httpd.conf and .htaccessfiles, and directly through a PHP script.
The php.ini File

The PHP distribution comes with two configuration templates, php.ini-dist and php.ini-recommended (as of PHP 5.3.0 these have been renamed to php.ini-development and php.ini-production, respectively). You’ll want to rename one of these files to php.ini tweaking your installation because there are well over 200 distinct configuration parameters in this file. Although the default values go a long way toward helping you to quickly deploy PHP, you’ll probably want to make additional adjustments to PHP’s behaviour, so you’ll need to learn a bit more about php.ini and its many configuration parameters. The upcoming blog about “PHP’s Configuration Directives” presents a comprehensive introduction to many of these parameters, explaining the purpose, scope, and range of each. 

What is Php?

INTRODUCTION OF PHP
In many ways the PHP language is representative of the stereotypical open source project, created to meet a developer’s otherwise unmet needs and refined over time to meet the needs of its growing community. As a budding PHP developer, it’s important you possess some insight into how the language has progressed, because it will help you to understand the language’s strengths as well as the reasoning behind its occasional idiosyncrasies.

History
The origins of PHP date back to 1995 when an independent software development contractor named Rasmus Lerdorf developed a Perl/CGI script that enabled him to know how many visitors were reading his online résumé. His script performed two tasks: logging visitor information, and displaying the count of visitors to the web page. Because the Web at the time was still a fledgling technology, tools such as these were non-existent. Thus, Lerdorf’s script generated quite a bit of interest. Lerdorf began giving away his toolset, dubbed Personal Home Page (PHP).

General features.
Practicality
From the very start, the PHP language was created with practicality in mind. After all, Lerdorf’s original intention was not to design an entirely new language, but to resolve a problem that had no readily available solution. Furthermore, much of PHP’s early evolution was not the result of the explicit intention to improve the language itself, but rather to increase its utility to the user. The result is a language that allows the user to build powerful applications even with a minimum of knowledge.
Power
PHP developers have almost 200 native libraries at their disposal, collectively containing well over 1,000 functions, in addition to thousands of third-party extensions. Although you’re likely aware of PHP’s ability to interface with databases, manipulate form information, and create pages dynamically, you might not know that PHP can also do the following:
• Create and manipulate Adobe Flash and Portable Document Format (PDF) files.
• Evaluate a password for guess ability by comparing it to language dictionaries and easily broken patterns.
• Parse even the most complex of strings using the POSIX and Perl-based regular expression libraries.
• Authenticate users against login credentials stored in flat files, databases, and even Microsoft’s Active Directory.
• Communicate with a wide variety of protocols, including LDAP, IMAP, POP3,
NNTP, and DNS, among others.
• Tightly integrate with a wide array of credit-card processing solutions. And this doesn’t take into account what’s available in the PHP Extension and Application Repository
(PEAR), which aggregates hundreds of easily installable open source packages that serve to further extend PHP in countless ways. You can learn more about PEAR in my next blog.
Possibility
PHP developers are rarely bound to any single implementation solution. On the contrary, a user is typically fraught with choices offered by the language. For example, consider PHP’s array of database support options. Native support is offered for more than 25 database products. PHP’s flexible string-parsing capabilities offer users of differing skill sets the opportunity to not only immediately begin performing complex string operations but also to quickly port programs of similar functionality (such as Perl and Python) over to PHP. PHP offers comprehensive support for OOP and procedural programming!
Price
PHP is available free of charge! Since its inception, PHP has been without usage, modification, and redistribution restrictions.  



Thanks for reading this encourage me to write more blogs on language pls. subscribe to notification of new activity of blog. Any suggestion plz leave a replay. 

What is “PHP’s Configuration Directives”?

What is “PHP’s Configuration Directives”?

The php.ini file is PHP’s global configuration file, much like httpd.conf is to Apache. This file underwent a fairly significant reorganization as of PHP 5.3.0; however, in both pre- and post-5.3 versions the file continues to be organized into twelve sections, including:
•  Language Options
•  Safe Mode
•  Syntax Highlighting
•  Miscellaneous
•  Resource Limits
•  Error Handling and Logging
•  Data Handling
•  Paths and Directories
•  File Uploads
•  Fopen Wrappers
•  Dynamic Extensions
•  Module Settings
The “PHP’s Configuration Directives” section that follows will introduce many of the directives found in the php.ini file. Later chapters will introduce module-specific directives as appropriate. Let’s first take a moment to review the php.inifile’s general syntactical characteristics. The php.ini file is a simple text file, consisting solely of comments and the directives and their corresponding values.
Here’s a sample snippet from the file:
;
; Allow the <? tag
;
short_open_tag = Off
Lines beginning with a semicolon are comments; the parameter short_open_tagis assigned the value Off. Exactly when changes take effect depends on how you install PHP. If PHP is installed as a CGI binary, the php.inifile is reread every time PHP is invoked,thus making changes instantaneous. If PHP is installed as an Apache module, php.iniis only read in once, when the Apache daemon is first tarted.
In this case, you must restart Apache for any of the changes to take effect. The Apache httpd.conf and .htaccess Files When PHP is running as an Apache module, you can modify many of the directives through either the httpd.conffile or the .htaccessfile. This is accomplished by prefixing directive/value assignment with one of the following keywords:
•  php_value: Sets the value of the specified directive.
•  php_flag: Sets the value of the specified Boolean directive.
•  php_admin_value: Sets the value of the specified directive. This differs from php_valuein that it cannot be used within an .htaccessfile and cannot be overridden within virtual hosts or .htaccess.
•  php_admin_flag: Sets the value of the specified directive. This differs from php_valuein that it cannot be used within an .htaccessfile and cannot be overridden within virtual hosts or .htaccess. or example, to disable the short tags directive and prevent others from overriding it, add the following line to your httpd.conffile:
php_admin_flag short_open_tag Off
Within the Executing Script The third, and most localized, means for manipulating PHP’s configuration variables is via the ini_set() function. For example, suppose you want to modify PHP’s maximum execution time for a given script. Just embed the following command into the top of the script:
ini_set('max_execution_time', '60');
Configuration Directive Scope
Can configuration directives be modified anywhere? The answer is no, for a variety of reasons, most of them security related. Each directive is assigned a scope, and the directive can be modified only within that scope. In total, there are four scopes:
•  PHP_INI_PERDIR: Directive can be modified within the php.ini, httpd.conf, or .htaccessfiles
•  PHP_INI_SYSTEM: Directive can be modified within the php.iniand httpd.conffiles
•  PHP_INI_USER: Directive can be modified within user scripts
•  PHP_INI_ALL: Directive can be modified anywhere
PHP’s Configuration Directives
The following sections introduce many of PHP’s core configuration directives. In addition to a general definition, each section includes the configuration directive’s scope and default value. Because you’ll probably spend the majority of your time working with these variables from within the php.ini file, the directives are introduced as they appear in this file.
Language Options
The directives located in this section determine some of the language’s most basic behaviour. You’ll definitely want to take a few moments to become acquainted with these configuration possibilities. Note that I am only highlighting some of the most commonly used directives. Please take some time to peruse your php.ini file for an overview of what other directives are at your disposal.
Caution Although the PHP documentation still refers to the default values associated with each directive, the reorganization of the php.ini file into two separate versions, php.ini-development for development purposes, and php.ini-production for production purposes, renders the meaning of “default” context-dependent. In other words, the default value of many directives found in the version of php.ini you choose will be set differently than the same value as defined in the other php.ini file. Therefore, in the interests of practicality, I am going to break from convention and identify the default value as that used within the php.ini-development file. engine = On | Off
Scope: PHP_INI_ALL; Default value: On
This parameter is responsible for determining whether the PHP engine is available. Turning it off
prevents you from using PHP at all. Obviously, you should leave this enabled if you plan to use PHP.
zend.ze1_compatibility_mode = On | Off
Scope: PHP_INI_ALL; Default value: Off
short_open_tag = On | Off
Scope: PHP_INI_ALL; Default value: Off
PHP script components are enclosed within escape syntax. There are four different escape formats,
the shortest of which is known as short open tags, which looks like this:
<?
echo "Some PHP statement";
?>
You may recognize that this syntax is shared with XML, which could cause issues in certain environments. Thus, a means for disabling this particular format has been provided. When short_open_tagis enabled (On), short tags are allowed; when disabled (Off), they are not. asp_tags = On | Off
Scope: PHP_INI_ALL; Default value: Off
PHP supports ASP-style script delimiters, which look like this:
<%
echo "Some PHP statement";
%>
If you’re coming from an ASP background and prefer to continue using this delimiter syntax, you can do so by enabling this tag.
precision = integer
Scope: PHP_INI_ALL; Default value: 14
PHP supports a wide variety of data types, including floating-point numbers. The precision parameter specifies the number of significant digits displayed in a floating-point number representation. Note that this value is set to 12 digits on Win32 systems and to 14 digits on Linux.
y2k_compliance = On | Off
Scope: PHP_INI_ALL; Default value: On
               
There are many directory in php configuration so take one visit to php.ini file any try experiment yourself this can help to better grip on php. Plz. Don’t forget to subscribe and plz leave a suggestion to improve my eligibility as writer. I hope You Like This in many Way.


Free Php Code editor For Windows, Linux and Mac OS X

Php Code editor for windows and Linux and Mac OS X.

 While there’s nothing wrong with getting started writing PHP scripts using no-frills editors also several open source and commercial solutions are available here I am write about best 4 code editor that widely used by millions of coder.

1: Adobe Dreamweaver CS5

Adobe’s Dreamweaver CS5 is considered by many to be the ultimate web designer’s toolkit. Intended to be a one-stop application, Dreamweaver CS3 supports all of the key technologies, such as Ajax, CSS,HTML, JavaScript, PHP, and XML, which together drive cutting-edge websites. In addition to allowing developers to create web pages in WYSIWYG (what-you-see-is-what-you-get) fashion, Dreamweaver CS5 offers a number of convenient features for helping PHP developers more effectively write and manage code, including syntax highlighting, code completion, and the ability to easily save and reuse code snippets.
Adobe Dreamweaver CS5 (www.adobe.com/products/dreamweaver) is available for the Windows and Mac OS X platforms.

2: Notepad++

Notepad++ is a mature open source code editor and avowed Notepad replacement available for the Windows platform. Translated into dozens of languages, Notepad++ offers a wide array of convenient features one would expect of any capable IDE, including the ability to bookmark specific lines of a document for easy reference; syntax, brace, and indentation highlighting; powerful search facilities; macro recording for tedious tasks such as inserting template comments; and much more. PHP-specific support is fairly slim, with much of the convenience coming from the general features. On some typing, although you’re still left to your own devices regarding remembering parameter names and ordering.

Note::  Notepad++ is only available for the Windows platform.

3: PDT (PHP Development Tools)
The PDT project is currently seeing quite a bit of momentum. Backed by Zend Technologies Ltd. and built on top of the open source Eclipse platform (www.eclipse.org), a wildly popular extensible framework used for building development tools, PDT is the likely front-runner to become the de facto PHP IDE for hobbyists and professionals alike.

4: Zend studio
Zend Studio is far and away the most powerful PHP IDE of all commercial and open source offerings available today. A flagship product ofZend Technologies Ltd., Zend Studio offers all of the features one would expect of an enterprise IDE, including comprehensive code completion, CVS and Subversion integration, internal and remote debugging, code profiling, and convenient code deployment processes.


THANKS for reading, you can suggest me on any topic don’t hesitated to comment I am always happy to lesion form you.