{"id":4335,"date":"2021-06-02T14:59:25","date_gmt":"2021-06-02T14:59:25","guid":{"rendered":"https:\/\/puvox.software\/blog\/?p=4335"},"modified":"2024-02-15T08:00:41","modified_gmt":"2024-02-15T08:00:41","slug":"docker-php-8-zts-apache-swoole-parallel","status":"publish","type":"post","link":"https:\/\/puvox.software\/blog\/docker-php-8-zts-apache-swoole-parallel\/","title":{"rendered":"PHP-8 (zts) &#038; Apache &#038; Swoole\/Parallel (+ WordPress)  with Docker\/Ubuntu\/PhpBrew"},"content":{"rendered":"<div class=\"default-content-clss content_4335 type_post \">\r\n<p class=\"wp-block-paragraph\">We had another scenario, where the mentioned combination was needed to be installed. It was a bit cumbersome, but the final solution turned out to be:<\/p>\r\n\r\n\r\n\r\n<h2 class=\"wp-block-heading\" id=\"method-1-using-docker\">### METHOD 1: using Docker ###<\/h2>\r\n\r\n\r\n\r\n<p>If you want to use <strong>ubuntu<\/strong> (instead of debian), the I reckon <a href=\"https:\/\/github.com\/phusion\/baseimage-docker\">Ubuntu (phusion image)<\/a> as the champion image for docker and so, to build your PHP8 on top of that, you can <span style=\"font-size: revert; color: initial;\">Download official <\/span><a style=\"font-size: revert;\" href=\"https:\/\/github.com\/docker-library\/php\/blob\/master\/8.0\/buster\/apache\/\">php8-docker<\/a><span style=\"font-size: revert; color: initial;\"> folder and m<\/span><span style=\"font-size: revert; color: initial;\">odify Dockerfile with the changes shown in this <\/span><a style=\"font-size: revert;\" href=\"https:\/\/github.com\/docker-library\/php\/commit\/b891441dffd047f2d3a81fbd75db19df10b1f5d9\">DIFF<\/a><span style=\"font-size: revert; color: initial;\"> and build it. (or you can also use ready-made <a href=\"https:\/\/github.com\/mattrayner\/docker-lamp\">LAMP image<\/a>)<\/span><\/p>\r\n<p>P.S. <em data-rich-text-format-boundary=\"true\">We recommend to look into the <a href=\"https:\/\/puvox.software\/blog\/useful-commands-for-docker-windows\/\"><strong>useful docker commands<\/strong><\/a>. Whoever wants, steps <a href=\"https:\/\/puvox.software\/blog\/install-redis-cache-for-php-8\/\">to install Redis<\/a> )<\/em><\/p>\r\n\r\n\r\n\r\n<h4 class=\"wp-block-heading\" id=\"wordpress\">WordPress<\/h4>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\">To install wordpress on top of the above image, download <a href=\"https:\/\/github.com\/docker-library\/wordpress\">https:\/\/github.com\/docker-library\/wordpress<\/a> and modify Dockerfile with changes as shown in this <a href=\"https:\/\/github.com\/docker-library\/wordpress\/commit\/a3ff3defd198f1ed02e634707f0b82eeb804b5d4\">DIFF<\/a> and build it. <em>(if you want to connect to outside MYSQL server, you might need <a href=\"https:\/\/stackoverflow.com\/a\/69868094\/2377343\">this tip<\/a>)<\/em><\/p>\r\n\r\n\r\n\r\n<h2 class=\"wp-block-heading\" id=\"method-2-using-phpbrew\">### METHOD 2 : using PhpBrew ###<\/h2>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\">After following &#8220;requirements&#8221; part of phpbrew, then install PHP with phpbrew. at first check if <code>echo $PKG_CONFIG_PATH<\/code> variable returns result, if not, set it:<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-code\"><code>export PKG_CONFIG_PATH=\/usr\/lib\/pkgconfig1<\/code><\/pre>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\">Then use<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">sudo apt-get install apache2-dev\r\nsudo apt-get install libonig-dev\r\nsudo chmod -R oga+rw \/etc\/apache2\r\n\r\n#if you having problems with phpbrew, read this: https:\/\/github.com\/phpbrew\/phpbrew\/wiki\/Cookbook#install-phpbrew-into-system-wide-environment\r\n<code>phpbrew --debug install 8.0 +default +mysql +sqlite +mb +curl +bcmath +debug +fpm +zip +intl +openssl=\/usr\/local\/opt\/openssl +bz2=\/usr\/local\/opt\/bzip2 +zlib=\/usr\/local\/opt\/zlib +apxs2=\/usr\/bin\/apxs2<\/code>\u00a0 <code>+zts <\/code>-- --enable-zts #for php7 (instead of <code>+zts<\/code>) in the end needs -- --enable-maintainer-zts phpbrew --debug ext install swoole phpbrew --debug ext install parallel #or follow instructions from github readme. If the command doesn't success, use: phpbrew ext install parallel -- --enable-parallel-coverage --enable-parallel-dev #p.s. you might need also these extensions in addition to above ones (<a href=\"https:\/\/www.digitalocean.com\/community\/tutorials\/how-to-install-wordpress-on-ubuntu-20-04-with-a-lamp-stack\">for wordpress<\/a>): +xmlrpc +gd +soap<\/pre>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\">and this will help to tell apache to use phpbrew: <a href=\"https:\/\/stackoverflow.com\/a\/41904646\/2377343\"> here<\/a> or <a href=\"https:\/\/github.com\/phpbrew\/phpbrew\/issues\/1221\">here<\/a><\/p>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\">&nbsp;<\/p>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\">&nbsp;<\/p>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\">____________<\/p>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\">* Other components: some people might want to compile php with different components, like <code>--with-gmp <\/code> or etc. However, in such case, the needed module bases should be installed before php-module, so, in dockerfile you might need to put <code>RUN apt-get update &amp;&amp; apt-get install -y libgmp-dev<\/code> before the php-build line.<\/p>\r\n<\/div>","protected":false},"excerpt":{"rendered":"<div class=\"default-content-clss excerpt_4335 type_post \"><p>We had another scenario, where the mentioned combination was needed to be installed. It was a bit cumbersome, but the final solution turned out to be: ### METHOD 1: using<a class=\"excerpt-read-more\" href=\"https:\/\/puvox.software\/blog\/docker-php-8-zts-apache-swoole-parallel\/\">(Continue Reading)<\/a><\/p>\n<\/div>","protected":false},"author":1,"featured_media":5530,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"default","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"set","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[17],"tags":[],"class_list":["post-4335","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-coding"],"_links":{"self":[{"href":"https:\/\/puvox.software\/blog\/wp-json\/wp\/v2\/posts\/4335","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/puvox.software\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/puvox.software\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/puvox.software\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/puvox.software\/blog\/wp-json\/wp\/v2\/comments?post=4335"}],"version-history":[{"count":1,"href":"https:\/\/puvox.software\/blog\/wp-json\/wp\/v2\/posts\/4335\/revisions"}],"predecessor-version":[{"id":5531,"href":"https:\/\/puvox.software\/blog\/wp-json\/wp\/v2\/posts\/4335\/revisions\/5531"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/puvox.software\/blog\/wp-json\/wp\/v2\/media\/5530"}],"wp:attachment":[{"href":"https:\/\/puvox.software\/blog\/wp-json\/wp\/v2\/media?parent=4335"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/puvox.software\/blog\/wp-json\/wp\/v2\/categories?post=4335"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/puvox.software\/blog\/wp-json\/wp\/v2\/tags?post=4335"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}