Changes

Jump to navigation Jump to search

Coral: php intro

11,964 bytes added, 13:41, 12 November 2011
Created page with "<div id="top" style="margin:0;padding: 0px 0px 0px 5px; color: #000; background-color: #FFFFEB; border: 1px solid darkslateblue;"><span id="top" style="margin:0;padding: 0px;font..."
<div id="top" style="margin:0;padding: 0px 0px 0px 5px; color: #000; background-color: #FFFFEB; border: 1px solid darkslateblue;"><span id="top" style="margin:0;padding: 0px;font-size:12px">'''''Coral'' :'''&nbsp; [[Coral: php intro|PHP]] | [[Coral: php short open_tags|PHP - Short open tags]] | [[Coral: php pear|PHP - PEAR Auto Install]] | [[Coral: php pear manual install|PHP - PEAR Manual Install]] | [[Coral: php apc|PHP - APC]]</span></div>

{|style="margin-top:5px;"
|-valign="top"
|
<span style="margin-bottom:5px;font-size:25px;color: #31799F;">PHP - Introduction</span>

'''PHP''' is a general-purpose scripting language designed for creating dynamic web pages. The Apache server uses a PHP processor module to generate the final web page being served. It interprets code embedded into HTML documents. PHP has been pre-configured for production and development. One of Unicontroller's sub-menus allows you to easily switch between the two configurations. This page covers the configuration sub-menu and its additional features for maintaining PHP.


__TOC__

|
{| cellpadding="0" cellspacing="0" style="margin-left:6px;margin-bottom:5px;padding-left:6px;padding-right:6px;font-size:11px;background-color: #FFFFEB;border: 1px solid darkslateblue;"
|-
|colspan="2" style="font-weight:bold;"| UniServer&nbsp;8-Coral
|-
|&nbsp;||[[Coral: Introduction|Home]]
|-
|&nbsp;||[[Coral: start quick start|Quick Start]]
|-
|&nbsp;||[[Coral: general intro|General]]
|-
|&nbsp;||[[Coral: apache intro|Apache]]
|-
|&nbsp;||[[Coral: mysql intro|MySQL]]
|-
|<span style="font-size: 14px;">»</span>||[[Coral: php intro|PHP]]
|-
|&nbsp;||[[Coral: msmtp intro|MSMTP]]
|-
|&nbsp;||[[Coral: cron intro|CRON]]
|-
|&nbsp;||[[Coral: dtdns intro|DtDNS]]
|-
|&nbsp;||[[Coral: dbbackup intro|Db Backup]]
|-
|&nbsp;||[[Coral: perl intro|Perl]]
|-
|&nbsp;||[[Coral: index main|Main Index]]
|}
|}

==Edit Basic Configuration==
<span style="padding:6px;background-color:#99FFFF"> Server Configuration > PHP > Edit Basic Configuration </span>

{|
|-valign="top"
|
This menu item allows you to change commonly configured PHP options.

# '''Current''': This file is the active file used by PHP for configuration. Switching to development or production overwrites this file. Consider any changes you make to this file as temporary.
# '''Development''': Configuration file used for development. Errors will be written to the screen. You can enable other parameters for testing.
# '''Production''': Configuration file for production ini file. Prevents errors being written to screen. The initial settings tighten security. For example, globals are off by default. Any changes you wish to be permanent should be made in this file.

|
[[Image:Coral_php_basic_config_1.gif]]
|}
'''Note 1''': After making changes, click the corresponding update button. This writes the modified data to the associated configuration file.

'''Note 2''': Changes to the current configuration are used next time the servers are started.

'''Note 3''': For development and production configuration files to become effective, you need to switch over the appropriate file (see [[##Configuration file switching|switching]].) and restart Apache.

'''Note 4''': Do not enable '''short open tags'''. Doing so will conflict with other languages such as XML’s open tag. For detailed information, and the exception, see [[Coral: php short open tags|Short open tags]]

'''''[[#top | Top]]'''''
==Directly edit configuration files==
The following menu items allow you to edit the specific PHP configuration file in notepad.

===Edit Current Configuration file: php.ini===
<span style="padding:6px;background-color:#99FFFF"> Server Configuration > PHP > Edit Current Configuration file: php.ini </span>

* File path: UniServer\usr\local\php\'''php.ini'''
* This configuration file is the active configuration. When Apache is started, the contents of this file will configure PHP.
* '''Note 1''': When either production or development configuration file is selected, as explained in the next section on switching, any edits in this file will be overwritten. Consider changes to this file as temporary. This is ideal for testing without making permanent changes.
* '''Note 2''': The initial version of the current configuration file is a copy of the production version.

===Edit Production Configuration file: php.ini_production===
<span style="padding:6px;background-color:#99FFFF"> Server Configuration > PHP > Edit Production Configuration file: php.ini_production </span>

Server Configuration > PHP > Edit Production Configuration file: php.ini_production

* File path: UniServer\usr\local\php\'''php.ini_production'''
* This configuration file is pre-configured for production use.
* '''Note''': In a default installation of The Uniform Server, the current configuration is a copy of this file (php.ini = php.ini_production).

===Edit Development Configuration file: php.ini_development===
<span style="padding:6px;background-color:#99FFFF"> Server Configuration > PHP > Edit Development Configuration file: php.ini_development </span>

* File path: UniServer\usr\local\php\'''php.ini_development'''
* This configuration file is pre-configured for development use.
* '''Note''': Errors will be displayed in a user's browser.

===Edit Command Line Configuration file: php-cli.ini===

<span style="padding:6px;background-color:#99FFFF"> Server Configuration > PHP > Edit Command Line Configuration file: php-cli.ini </span>

* File path: UniServer\usr\local\php\'''php-cli.ini'''
* This configuration file is pre-configured for command-line operation.
* '''Note''': Do not change the existing directives. These are required for correct operation of UniController's command-line scripts. You can add any directives you want that are not included.

'''''[[#top | Top]]'''''
==Configuration file switching==
The following two menu items allow you to easily switch between PHP production and development configuration files.

===Switch to Production Configuration file===

<span style="padding:6px;background-color:#99FFFF"> Server Configuration > PHP > Switch to Production Configuration file </span>

* File path: UniServer\usr\local\php\'''php.ini_production'''
* This configuration file is pre-configured for production use.
* '''Note 1''': In a default installation of The Uniform Server, the current configuration is a copy of this file (php.ini = php.ini_production).
* '''Note 2''': Errors are not displayed; these are directed to Apache's log file.
* '''Note 3''': Switching '''overwrites''' the php.ini configuration file.
* '''Note 4''': After switching you must '''restart''' the servers or the new configuration will not be recognised.

===Switch to Development Configuration file===

<span style="padding:6px;background-color:#99FFFF"> Server Configuration > PHP > Switch to Development Configuration file </span>

* File path: UniServer\usr\local\php\'''php.ini_development'''
* This configuration file is pre-configured for development.
* '''Note 1''': Errors are displayed in a user's browser and also directed to log file
* '''Note 2''': Switching '''overwrites''' the php.ini configuration file. The php.ini file is replaced by a copy of php.ini_development.
* '''Note 3''': After switching you must '''restart''' the servers or the new configuration will not be recognised.

'''''[[#top | Top]]'''''
==PHP Accelerators==
The Uniform Server provides two PHP accelerators: APC and eAccelerator. The following UniController sub-menu allows you to enable or disable these accelerators and open their corresponding controller in your default browser.

<span style="padding:6px;background-color:#99FFFF"> Server Configuration > PHP > PHP Accelerators </span>

{|
|-valign="top"
|
'''''eAccelerator'''''

* Check box 1) enables or disables eAccelerator. With the box checked eAccelerator is enabled.
* Control panel button 2) opens eAccelerator’s control panel in the default browser.

'''''APC'''''

* Check box 3) enables or disables APC. With the box checked APC is enabled.
* Control panel button 2) opens APC’s control panel in the default browser.
|
[[Image:Coral_php_accelerators_1.gif]]
|}
'''Note''': After enabling or disabling either accelerator, the Apache server must be restarted in order for the new configuration to become effective.

{|
|-valign="top"
|
===eAccelerator control panel===
eAccelerator is a free open-source PHP accelerator and optimizer. It increases the performance of PHP scripts by caching them in their compiled state, so that the overhead of compiling is almost completely eliminated.


The Uniform Server's default installation has eAccelerator '''enabled'''.


The eAccelerator control panel is shown on the right.
|
[[Image:Coral_php_eaccelerator_con_1.gif]]
|-valign="top"
|
===APC control panel===
The Alternative PHP Cache (APC) is a free and open opcode cache for PHP. It is a robust framework for caching and optimizing PHP intermediate code.


The Uniform Server's default installation has APC disabled.


The APC control panel is shown on the right.


For detailed information, see [[Coral: php apc|PHP APC]]
|
[[Image:Coral_php_apc_con_1.gif]]
|}

'''''[[#top | Top]]'''''
==PEAR control panel==

<span style="padding:6px;background-color:#99FFFF"> Server Configuration > PHP > PEAR control panel </span>

{|
|-valign="top"
|
The PHP Extension and Application Repository, or PEAR for short, contains re-usable code. This menu option opens the PEAR Controller. It consists of two buttons, operating as follows:

* 1) Install PEAR Click to install PEAR. For detailed information see [[Coral: php pear|PEAR Auto Install]]
* 2) View PEAR front-end Opens the PEAR front-end in the default browser.

'''Note 1''': Apache must be running, else the buttons remain greyed out.

'''Note 2:''' For a short tutorial on how to use PEAR, see Using [[Coral: php pear#PEAR Frontend|PEAR Frontend]]

Note 3: You can also view the PEAR Front-end by entering the following into your browser:
<nowiki>'''http://localhost/us_pear/index.php'''</nowiki>
|
[[Image:Coral_php_pear_controller_1.gif]]
|}

'''''[[#top | Top]]'''''
==PHP Extensions Enable Disable==
{|
|-valign="top"
|
The following sub-menu allows you to enable or disable PHP extensions:

<span style="padding:6px;background-color:#99FFFF"> Server Configuration > PHP > PHP Extensions Enable/Disable </span>

* Checkbox un-checked Extension disabled
* Checkbox checked Extension enabled

'''Note''': After changing state you must '''restart''' the Apache server for the new configuration to be recognised.


'''Files modified''':


UniServer\usr\local\php\'''php.ini''' <br />
UniServer\usr\local\php\'''php.ini_development''' <br />
UniServer\usr\local\php\'''php.ini_production''' <br />
|
[[Image:Coral_php_extensions_1.gif]]
|}


'''''[[#top | Top]]'''''
==Note: PHP mail() function==

Uniform Server has been pre-configured for sending mail using the open source '''msmtp''' client. For reference the configuration section contained in confiuration files php.ini, php.ini_development and php.ini_production is shown below:

<pre>
; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
;sendmail_path = "/usr/bin/sendmail.exe -t"

sendmail_path = "**path**/UniServer/msmtp/msmtp.exe --file=**path**/UniServer/msmtp/msmtprc.ini -t"

; Force the addition of the specified parameters to be passed as extra parameters
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail(), even in safe mode.
;mail.force_extra_parameters =

; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename
mail.add_x_header = On
</pre>

Note: **path** is automatically set to where Uniform Server is located; for example: C:/Coral_4

Before using the PHP mail function, the msmtp client must be set up. See the [[Coral: msmtp intro|MSMTP page]] for details.

'''''[[#top | Top]]'''''

----

[[Category: Uniform Server 8-Coral]]

Navigation menu