Using PHP 5
Posted by on 01 December 2011 05:35 PM
|
|||||||
Applicable Plans - All Cloud Hosting PlansUsing PHP 5Overview
Installing PHP Installing PHP Extensions PHP Configuration How to choose a different PHP version (Alternate PHP Versions - ISPmanager 5.3.1 and above) PHP Accelerators, Loaders, and Frameworks Installing PHPPHP can be installed from the Control Panel and also from the command line of the Virtual Server. Installing PHP using the Control PanelInstalling PHP using the ISPmanager Control PanelIf you are using the ISPmanager Control Panel, you can install PHP from that Control Panel.
Information on how to tell which version of ISPmanager you are using can be found here - ISPmanager versions Installing PHP using the command linePHP can be installed from the command line of the Virtual Server. You will need to log in to the Virtual Server using SSH and work as the root user. Install PHP with the [root@eapps-example ~]# yum install -y php Installing PHP ExtensionsOne of the strengths of PHP is the number of different extensions or modules available that can increase and expand its functionality. The PHP 5 application supplied by eApps comes with a large number of extensions pre-installed, and you are also able to install additional extensions using the Control Panel or the command line using PEAR and PECL. Viewing installed PHP extensionsBy default there are several PHP extensions installed. You can view the currently installed PHP extensions from the Control Panel or from the command line. Viewing the installed PHP extensions using the ISPmanager Control Panel
Viewing the installed PHP extensions using the command lineYou can also view the installed PHP extensions from the command line of the VS, with the php -m command. [root@eapps-example ~]# php -m Installing additional PHP ExtensionsIf you need a PHP extension that is not currently installed, you can install it yourself. This can be done from either the Control Panel or the command line. Installing PHP extensions from the ISPmanager Control Panel
Installing from the command lineYou can install PHP extensions from the command line using either pear or pecl. Your Virtual Server has both pear and pecl installed, which means that you can install any modules from the http://php.net site.
To get the correct name for a Pear module, go the Pear packages page, and then click on the module itself. Then, click on the Download tab. The Easy Install section will have the correct command to install the module. To get the correct name for a PECL module, go to the PECL packages page, click on the module name, and then look for the version you wish to install. To install a pear or pecl module, use one of the following commands: [root@eapps-example ~]# pear install module_name [root@eapps-example ~]# pecl install module_name Once the module is installed, it will need to be loaded into PHP so that it is available for use. To load the module into PHP, you will need to create a file in the /etc/php.d directory called module_name.ini that will contain the line: extension=module_name.so Do not use extension version numbers, just use the extension name. Use one file for each extension. Also, some modules have their own list of variables, and those should be in the extension file, not in php.ini. Read the documentation for each module to see if you need to configure any variables for your modules. After adding the extension files to the php.d directory, you will need to restart the Apache web server so that the extensions will be loaded into PHP.
PHP ConfigurationFor the majority of users, PHP as installed should require no additional configuration. However, there are some common PHP configuration changes that are made for application requirements or performance. These changes can be made from the Control Panel or the command line. Common PHP configuration changes
Changing PHP configuration using the Control PanelChanging PHP configuration using the ISPmanager Control PanelFrom ISPmanager, you can make changes to certain PHP settings. What you are doing in editing the /etc/php.ini file, which controls all the PHP options.
Changing PHP configuration using the command lineYou can also make configuration changes to PHP by editing the /etc/php.ini file directly, which is the file being edited by the Control Panel. The same options are available. Make sure that after you make any changes to the php.ini file to restart the Apache web server. How to choose a different PHP Version - Alternate PHP Versions (ISPmanager 5.31 and above only)If you are using the ISPmanager Control Panel version 5.31.1 or above, you have the ability to install and use alternate versions of PHP on a per web-domain basis. This is available for both CentOS 6 and CentOS 7 OS Templates. This feature will enable you to deploy websites and web applications that require a different version of PHP than the one installed natively by ISPmanager in the Web-server (WWW) configuration. To tell what version of ISPmanager you are on, log in as the root user, and then scroll all the way to the bottom of the left navigation pane. At the very bottom, you should see NOTE - the alternate PHP versions can only be run as CGI or FastCGI. Make sure your website or web application is configured correctly. Installing the Alternate PHP VersionsTo install the alternate PHP versions, go to Settings > Features, click on Alternate PHP versions, and then click on Install. This will show a dialog box with the versions of PHP to be installed, which you will need to confirm. This takes you back to the main Features screen. Wait about 5 minutes, and then click on Features again to see the status. Once the installation is complete, you will see a list of the available versions. Click on Alternate PHP versions, and then click on Edit. This will allow you to select or deselect which versions you wish to use. Note that all are selected by default. Using the Alternate PHP VersionsIn order to use the alternate PHP versions, the user will need to have PHP as Apache module, PHP as CGI, and PHP as FastCGI (Apache) selected in Accounts > Users > {select the user} > Edit. Look for the Access section, and make sure those three items are checked. Then click Ok. The alternate PHP version can be selected by either the root user, or by the actual website user.
Once you have clicked Ok, the website or web application will now be able to use the alternate version of PHP. PHP Accelerators, Loaders, and FrameworksThere are several applications that will allow you improve the speed of your PHP code, allow you to run PHP code that is encoded by ionCube, and allow you to take advantage of the Zend framework. You can install ionCube Loader, and Zend Guard Loader These applications are installed from your Control Panel. Installing using ISPmanager
In order to have ionCube Loader and Zend Guard Loader installed together, they have to be installed in this order in the /etc/php.d directory:
By default, they will install in this exact order, unless you change the names of the configuration files in the /etc/php.d directory. ionCube LoaderThe ionCube Loader application allows you to execute ionCube encoded files. ionCube develops software products for PHP, including an encoder that protects and encrypts software written in PHP. This is not the ionCube PHP Encoder. That product is only available from ionCube and requires a paid license. Zend Guard LoaderZend Guard Loader is required to run Zend Guard encoded PHP scripts. This is usually the case when you have purchased a commercial application that is written in PHP and encoded with Zend Guard.
| |||||||
|