In this article, we will go through several PHP modules that our customers often ask about. PHP modules allow you to optimize and configure the work of PHP scripts on the server. Each module has its own functionality and can greatly facilitate and speed up tasks regarding php code. You can find out how to enable / disable PHP modules in our article here.
Let's start with caching modules. Using memory caching can significantly improve server performance. This is the process of storing frequently requested objects in memory for faster retrieval and playback in the future. There are two types of memory caching:
- PHP code cache (OPcache module): The operation code cache stores compiled PHP scripts, the server does not compile and converts the PHP script into machine-readable code for each request. These compiled PHP scripts are stored in memory on the server on which they are compiled. OPcache has been available since PHP 5.5 and is the default caching mechanism for caching code at the bytecode level. With activated OPcache, it is possible to handle much more requests. at the same time, this is a very important advantage for the operation of large sites.
- Data cache. The data cache stores copies of data, templates, and other types of information files. Depending on the cache implementation, it may be local to one server or distributed across several servers.
The APCu PHP module (APC User Cache) is responsible for the local cache for systems starting with PHP version 5.6 and higher. APCu is a data cache and is available on most distributions. APCu succeeds APC
Redis is a great modern memory cache that can be used for both distributed caching and as a local cache for blocking file transactions, as it ensures that cached objects are available as long as they are needed. The Redis module comes from PHP version 2.2.6 or higher.
There are also two PHP extensions available: Memcache and Memcached. Memcached - PHP extension for interacting with memcached through the libmemcached library. The libmemcached library is used to provide an API for communicating with memcached servers. And Memcache is an extension to Memcached. Memcached is designed specifically for dynamic web applications to reduce the load on the database by storing objects in memory, using special keys to reduce the number of queries to the server from the database. This extension allows you to work with Memcached through a convenient procedural interface.
The APM (Application Performance Monitoring) module is an application performance monitoring tool. There are many tools for monitoring application performance, such as Pinpoint, New Relic, AppDynamics, Apache SkyWalking, Stagemonitor, etc. Many of them offer reduced free versions of their products.
This tool allows you to effectively measure and calculate the statistics of the real work of your application depending on its use. Using APM, you can view detailed performance indicators of PHP applications such as memory, processor, system load, memory dumps, and so on, which is useful for identifying the causes of slow system operation, optimizing performance, analyzing causes, and potential problems. The ability to quickly understand the topology and dependencies of your application The response of lines of code to all your transactions to track the smallest errors and failures.
The cURL module allows PHP programs to access curl functions in PHP. CURL stands for "Client for URLs". There are two libcurl and curl products in the cURL project.
libcurl is a PHP library and a command line tool (like wget) that helps send files as well as upload data via HTTP and FTP. It supports proxies, and transmits data via SSL connections, it is also possible to set cookies and even receive files that are behind the login.
curl: a command line tool for receiving or sending files using URL syntax. Because curl uses libcurl, it supports a number of common internal protocols, including HTTP, HTTPS, FTP, FTPS, GOPHER, TELNET, DICT, and FILE.
The IMAP module (available for PHP 5.6, 7.0, 7.1, 7.2, or 7.3.) Is a powerful open source library for connecting to a mailbox using POP3, IMAP, and NNTP protocols using the PHP IMAP extension. This library allows you to receive emails from your mail server. The message data read from the mail server will be used to compile a list of emails in the mailbox, create notifications of unread messages, and for many other purposes. Using IMAP, you can create convenient applications for processing messages, so IMAP is more functional and modern, the POP3 protocol.
IMAP works under TCP / IP protocol with SSL protection, so before we can make any IMAP calls, we must open the connection. Before that, you need to check in the mail settings whether the ability to connect via IMAP is enabled. If this feature is disabled, you just need to enable it in the mail settings.
Next, to connect, you need to specify the incoming mail server (IMAP), the outgoing mail server (SMTP), while indicating the connection port, the mailbox to which you want to connect, the password and the path to the folder where the mail messages will be saved. If you need additional information about IMAP access, look in the mail help center where you have a mailbox, they always post detailed instructions and data for connecting.
ionCube loader is a PHP extension, comes in the form of a .so or .dll library, it is necessary to use and read decode source code encoded using ionCube Encoder, which is mainly used in commercial software applications to protect against unlicensed use of source code and prevent its visibility , theft and change by compilation into bytecode.
The ionCube PHP encoder has 3 versions: Basic, Pro, and Cerberus, and there is already an additional file encryption not with PHP markup. These versions differ from each other in a set of functions. If you just need encryption, Basic will suit you, Pro or Cerberus will reduce the risk of running any stolen files on another server, as they provide the ability to create license files for your products. Pro and Cerberus have an interesting feature that is useful for developers, which provides access to the protected code during the set time for the set number of users. PHP Encoder is available for Windows, Linux, FreeBSD, and OS X. Support for other platforms is available on request.
You can familiarize yourself with the IonCube product and using it on servers in more detail in our article here.
The FTP module functions allow, if necessary, to use for php scripts connections and access to servers via FTP (File Transfer Protocol). More information about the protocol on how to connect and configure can be found in our article here.
Also, for remote access, you can use the SSH2 protocol. SSH2 is a safer, more efficient and portable version of SSH, including SFTP, functionally similar to FTP, but with SSH2 encryption. For use, you need the presence of the connected libraries libssh2 and OpenSSL.
OpenSSL uses the functionality of the OpenSSL library for symmetric and asymmetric encryption and decryption, PBKDF2, PKCS7, PKCS12, X509, cryptographic operations and implements TLS streams.
The PHP Zlib module allows you to read and write compressed gzip files on the go. To use the module, you also need to connect the zlib library starting from version 1.0.9. The compression algorithm used in zlib is the deflate method. The deflate method encodes input into compressed data. The decompression algorithm used in zlib is the inflate method, which is a decoding process. This module is used to provide faster output of the necessary information by compressing the data stream. In php.ini file. You can adjust the compression settings.
ZIP module for writing, reading, modifying ZIP archives. You need the libzip library to work. The PHP RAR module is intended for reading archives of Rar archives using unRAR libraries. This extension gives you the ability to read Rar archives, but does not support the ability to write Rar archives, since this function is not supported by the UnRar library.
If you want to implement the database, then use the appropriate modules to connect them: pgsql - PostgreSQL, mongodb - MongoDB (the mongo module is considered obsolete), mssql - MS SQL Server, mysql - MySQL (considered obsolete, and since PHP version 7.0.0 this module removed, it is better to use mysqli or pdo_mysql modules instead of this module).
Mysqli module - allows you to access the functionality provided by MySQL DBMS. And the PHP Data Objects Extension (PDO) defines a lightweight, consistent interface for accessing databases in PHP. PDO supports various databases, which is very convenient, if you need to switch from using one to the other in the project, you do not need to rewrite all the code and queries as in the case of mysqli.
If you are interested in the functionality and availability of other PHP modules, then write, HyperHost specialists will be happy to provide information and help enable and configure the necessary modules for the effective operation of your project.