PHP is considered one of the easiest to use server-side scripting languages. Its usage for websites (top 10 million by Alexa rank) is steadily growing and currently reached 83.5%. The popularity of PHP engine is also proven by Jelastic customers, getting 47.6% among other programming languages due to software stacks statistics of the previous year.
Let’s take a journey to PHP cloud hosting within Jelastic PaaS, its chief peculiarities, winning points, and rich possibilities provided for the efficient running of applications.
To see in details how these servers can be configured, and find out the list of editable config files for each of them, refer to the document PHP App Server Configuration.
PHP Application Deployment
Zero downtime deployment provides the ability to run any cloud-native or legacy application. In order to deliver your PHP projects to the created environment within Jelastic, you can choose one of the available options:
For production purposes, you can bind an external domain name (custom) to your application instead of the default environment domain. This can be done in two ways: using eitherCNAME orA Record.
With the help of the swapping domains feature, end-users of your application won’t experience any downtime when you, for example, deploy a new application version. You can stage your new application version in a test environment and consequently swap URLs with a production environment just in a few clicks.
Using multiple domains on a single PHP server increases the application usability, efficiency, and scalability, simultaneously saving the costs on the necessity to set up separate instances.
Automatic Vertical Scaling
Automatic vertical scaling is made possible by Jelastic ability to dynamically change the number of allocated resources (RAM and CPU) for a server according to its current demands, with no manual intervention required. This feature guarantees you never overpay for unused resources and saves your time due to eliminating the necessity of handling the load-related adjustments or architectural changes.
In order to set up automatic resource consumption by your PHP server, open the environment topology wizard and specify the upper scaling limit of cloudlets (each equals to 128 MiB and 400 MHz) with the slider located at the top:
Your application will work within these limits reducing resource consumption when the load is down or increasing them when the load is up. Thus, you only pay for the resources that are actually consumed. For more information, please refer to the documentation about automatic vertical scaling.
Manual Horizontal Scaling
For adding extra PHP servers manually, just click Change environment topology. Then press the “+” button in the wizard and add the required number of instances.
The maximum number of the same-type servers within a single environment layer depends on a particular hosting provider settings (usually this limit stands for 16 nodes and can be adjusted by sending a request to support).
Also, as you can see, when you add extra servers, load balancing is enabled automatically.
Implementing the PHP sessions clustering for your application can highly increase its availability and failover capabilities using the sticky sessions, run on several app server nodes. This mechanism is ensured by a Memcached node, that should be added to your environment and used as storage for the processed sessions’ backups.
While scaling out PHP server with your deployed application, you get its exact copy with all the same configurations and files inside due to built-in data synchronization.
Beside, Jelastic has pre-packaged auto-scalableWordPress Cluster and Magento Cluster available for one-click installation to ensure your service operability. Moreover, you can package any PHP application in this way to automate its clustered installation.
Database Connection to PHP Application
Jelastic PaaS provides a set of scalable and fully manageable database servers that you can easily install and operate within the PHP environment. To establish the connection, adjust your application following the instruction based on the database you require:
While working with Jelastic PaaS, you can extend the functionality of the environment through setting different PHP extensions at the appropriate application servers. You can either select one of the default extensions and activate it, or upload your own custom one – both these operations are described in thePHP Modules instruction.
As a separate kind of PHP extension, PHP accelerators can be determined. They are used for enlarging your application efficiency through caching the already compiled parts of PHP code, which can be quickly executed upon a user’s request.
Apache PHP and NGINX servers include a particularset of the inbuilt modules. In addition, there are a few separate tutorials on configuring the various modules:
SSL / TLS (Secure Sockets Layer / Transport Layer Security) is the industry standard security technology for establishing an encrypted connection between a web server and a browser. This technology is supported by Jelastic PaaS and ensures that all passed data remains private and confidential, i.e., it can’t be intercepted by a third party.
Besides the common protection methods, security of your application can be increased through customizing the main PHP configuration file, named php.ini. You can edit a number of default settings it contains or adds your own in accordance with the needs of your application.
Additional configuration guidance is available for particular application servers:
One more way to ensure the application protection is using a container firewall feature. It lets control your nodes availability both from inside and outside of the platform.
“PHP has always been about making Web development easy and accessible to everyone. Jelastic’s approach to PaaS fits nicely with this mission, and I am looking forward to helping them build more great products,”- Rasmus Lerdorf, Creator of PHP.
Rasmus has joined Jelastic in 2013 as a senior advisor, and assisted while integrating PHP technologies to the platform. Currently, this language became the top choice of the users along with Java, Ruby, Python, Node.js, .Net and Go.