Linux for PHP Documentation Release 8.2.0

Linux for PHP Documentation Release 8.2.0

Linux for PHP Documentation Release 8.2.0 Foreach Code Factory Jun 16, 2021 Contents 1 Installation 3 2 Basic Usage 5 2.1 Docker’s Interactive Mode........................................5 2.2 Docker’s Detached Mode........................................6 2.3 Pre-Compiled PHP Binaries.......................................6 2.4 Compiling PHP from Source.......................................6 2.5 Manually Compiling PHP from Source.................................7 3 Advanced Features 9 3.1 Starting and Stopping Services in Linux for PHP............................9 3.2 Automating Services in Linux for PHP................................. 10 3.3 Package Installation Using the lfphp-get Command........................ 10 4 Linux for PHP Cookbook 13 4.1 CMS Installation Using the lfphp-get Command.......................... 13 4.2 PHP Framework Installation Using the lfphp-get Command.................... 13 4.3 Blackfire.io Installation Using the lfphp-get Command....................... 14 4.4 Node.js Installation Using the lfphp-get Command......................... 14 4.5 MongoDB Installation Using the ‘lfphp-get’ Command......................... 14 5 What’s New in Version 8.2 15 5.1 New Since Version 8.2.0 (May 17, 2020)................................ 15 5.2 New Since Version 8.1.3 (Jan 2, 2019).................................. 20 5.3 New Since Version 8.1.2 (Oct 25, 2018)................................. 24 5.4 New Since Version 8.1.1 (Jun 20, 2018)................................. 28 5.5 New Since Version 8.1 (May 17, 2018)................................. 31 5.6 New Since Version 8.0 (Dec 20, 2017)................................. 35 6 Linux for PHP License 37 6.1 Apache License............................................. 37 7 Indices and tables 41 Index 43 i ii Linux for PHP Documentation, Release 8.2.0 Linux for PHP Home Page Contents 1 Linux for PHP Documentation, Release 8.2.0 2 Contents CHAPTER 1 Installation In order to start using Linux for PHP, you must install Docker on your computer first. General information on the Docker CE engine is available at the following address: https://docs.docker.com/install/ For more specific information on how to install Docker CE on your operating system of choice, please see the following pages: • Windows 10 : https://docs.docker.com/docker-for-windows/install/ • Windows 7/8 : https://docs.docker.com/toolbox/overview/ • MacOS : https://docs.docker.com/docker-for-mac/install/ • CentOS : https://docs.docker.com/install/linux/docker-ce/centos/ • Debian : https://docs.docker.com/install/linux/docker-ce/debian/ • Fedora : https://docs.docker.com/install/linux/docker-ce/fedora/ • Ubuntu : https://docs.docker.com/install/linux/docker-ce/ubuntu/ • Linux Binaries : https://docs.docker.com/install/linux/docker-ce/binaries/ 3 Linux for PHP Documentation, Release 8.2.0 4 Chapter 1. Installation CHAPTER 2 Basic Usage Once Docker is installed, you can now run a Linux for PHP container. It is possible to run the container in Docker’s interactive or detached modes. 2.1 Docker’s Interactive Mode To run a Linux for PHP container in interactive mode, with the non thread-safe version of PHP 7.4, please enter the following command using your system’s shell (Bash/PowerShell): $ docker run --rm -it asclinux/linuxforphp-8.2-ultimate:7.4-nts /bin/bash You will then get a command-line interface similar to this one : To find out the IP address assigned (assuming you did not set one manually): $ ifconfig Once you are done with the container, please quit the container by typing: $ exit 5 Linux for PHP Documentation, Release 8.2.0 2.2 Docker’s Detached Mode And, what if you wish to run a PHP application from a Web browser and start the Linux for PHP container in Docker’s detached mode? To do so, enter the following command: # Change to your project's working directory $ cd /my/project/folder $ docker run -dit --restart=always \ -v ${PWD}/:/srv/www \`` -p 8181:80 \ -p 10443:443 \ asclinux/linuxforphp-8.2-ultimate:7.4-nts \ lfphp Note: This last command uses the lfphp script to start all available services inside the container. For more details, please see Automating Services in Linux for PHP. You should now be able to access any of the PHP scripts contained in your project folder by pointing your browser to http://localhost:8181/. Once you are done with the container, you can stop and remove it as you would any other Docker container running in detached mode: $ docker stop [container_id_here] $ docker rm [container_id_here] 2.3 Pre-Compiled PHP Binaries As mentioned previously, it is possible to run Linux for PHP containers that come with pre-compiled binary versions of any of the major versions of PHP. To obtain a list of the available binaries, please visit the project’s download page: https://linuxforphp.net/download 2.4 Compiling PHP from Source Of course, Linux for PHP is a lightweight version of Linux with all the software needed to easily compile any recent version of PHP. Thus, if you prefer to compile and use a different version of PHP, you can do so by entering the following command in a new terminal window. Please make sure to enter the version that you wish to compile, as per the following example (8.1.0dev in this case): $ docker run -dit -p 8181:80 asclinux/linuxforphp-8.2:src /bin/bash -c "lfphp-compile ,!8.1.0 nts" After a few minutes, the new PHP binaries will be compiled and ready to be used! You can always check on the compilation’s progress by connecting to the container using the docker exec command: $ docker exec -it [id_of_the_container] /bin/bash On the container’s CLI, enter the top command: 6 Chapter 2. Basic Usage Linux for PHP Documentation, Release 8.2.0 $ top To return to the command line, press Q. 2.5 Manually Compiling PHP from Source Alternatively, you could also decide to do it manually. If so, start by running a Linux for PHP base image containing the PHP source files with the following command: $ docker run -it asclinux/linuxforphp-8.2-ultimate:src /bin/bash And, on the container’s command line interface (CLI), checkout the version of PHP you wish to compile and begin compilation by entering the following commands (in our example, we will compile PHP 7.4.6): $ cd /root $ wget https://github.com/php/php-src/archive/PHP-7.4.6.zip $ unzip PHP-7.4.6.zip $ cd php-src-PHP-7.4.6 $ ./buildconf --force $ ./configure \ --prefix=/usr \ --sysconfdir=/etc \ --localstatedir=/var \ --datadir=/usr/share/php \ --mandir=/usr/share/man \ --enable-fpm \ --with-fpm-user=apache \ --with-fpm-group=apache \ --with-config-file-path=/etc \ --with-zlib \ --enable-bcmath \ --with-bz2 \ --enable-calendar \ --enable-dba=shared \ --with-gdbm \ --with-gmp \ --enable-ftp \ --with-gettext=/usr \ --enable-mbstring \ --enable-pcntl \ --with-pspell \ --with-readline \ --with-snmp \ --with-mysql-sock=/run/mysqld/mysqld.sock \ --with-curl \ --with-openssl \ --with-openssl-dir=/usr \ --with-mhash \ --enable-intl \ --with-libdir=/lib64 \ --enable-sockets \ --with-libxml \ --enable-soap \ --enable-gd \ --with-jpeg \ (continues on next page) 2.5. Manually Compiling PHP from Source 7 Linux for PHP Documentation, Release 8.2.0 (continued from previous page) --with-freetype \ --enable-exif \ --with-xsl \ --with-xmlrpc \ --with-pgsql \ --with-pdo-mysql=/usr \ --with-pdo-pgsql \ --with-mysqli \ --with-pdo-dblib \ --with-ldap \ --with-ldap-sasl \ --enable-shmop \ --enable-sysvsem \ --enable-sysvshm \ --enable-sysvmsg \ --with-tidy \ --with-expat \ --with-enchant \ --with-imap=/usr/local/imap-2007f \ --with-imap-ssl=/usr/include/openssl \ --with-kerberos=/usr/include/krb5 \ --with-sodium=/usr \ --with-zip \ --enable-opcache \ --with-pear \ --with-ffi \ --enable-opcache $ make $ make test $ make install $ install -v -m644 php.ini-production /etc/php.ini $ mv -v /etc/php-fpm.conf{.default,} $ cp -v /etc/php-fpm.d/www.conf.default /etc/php-fpm.d/www.conf $ sed -i 's@php/includes"@&\ninclude_path = ".:/usr/lib/php"@' /etc/php.ini $ sed -i -e '/proxy_module/s/^#//' -e '/proxy_fcgi_module/s/^#//' /etc/httpd/httpd. ,!conf $ echo 'ProxyPassMatch ^/(.*.php)$ fcgi://127.0.0.1:9000/srv/www/$1' >> /etc/httpd/ ,!httpd.conf $ sed -i 's/DirectoryIndex index.html/DirectoryIndex index.php index.html/' /etc/ ,!httpd/httpd.conf $ /etc/init.d/mysql start $ /usr/sbin/php-fpm & $ /etc/init.d/httpd start 8 Chapter 2. Basic Usage CHAPTER 3 Advanced Features 3.1 Starting and Stopping Services in Linux for PHP When manually starting and stopping services within a Linux for PHP container, one must use the standard init system to do so. To start the PHP-FPM server: $ /etc/init.d/php-fpm start To stop the PHP-FPM server: $ /etc/init.d/php-fpm stop To get the status of the PHP-FPM server: $ /etc/init.d/php-fpm status These commands apply to all the main services that are included within all Linux for PHP images : • Apache : /etc/init.d/httpd [start/stop/status] • nginx : /etc/init.d/nginx [start/stop/status] • MariaDB (MySQL) : /etc/init.d/mysql [start/stop/status] • PostgreSQL : /etc/init.d/postgresql [start/stop/status] • OpenLDAP : /etc/init.d/slapd [start/stop/status] • Exim Mail : /etc/init.d/exim [start/stop/status] • MongoDB : /etc/init.d/mongod [start/stop/status] • OpenSSH : /etc/init.d/sshd [start/stop/status] 9 Linux for PHP Documentation, Release 8.2.0 Note: All configuration files can be found within the /etc directory. 3.2 Automating Services in Linux for PHP When using a Linux for PHP container in detached mode, it is possible to automate services using the lfphp com- mand. If you wish to start a container with only the MariaDB (MySQL) server running, you would enter the following command when invoking the container: $ docker run -dit asclinux/linuxforphp-8.2-ultimate:7.4-nts bash -c "lfphp --mysql" The available services are : • Apache (--apache) • Exim Mail (--exim) • OpenLDAP (--ldap) • MariaDB/MySQL (--mysql) • nginx (--nginx) • PostgreSQL (--pgsql) • PHP FPM (--phpfpm) Note: These optional switches can be combined and that the default behavior of the lfphp command is to start all services when no options are given.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    47 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us