{"id":2953,"date":"2018-07-10T04:49:17","date_gmt":"2018-07-10T04:49:17","guid":{"rendered":"http:\/\/myprojects.advchaweb.com\/?p=2953"},"modified":"2022-06-02T07:59:05","modified_gmt":"2022-06-02T07:59:05","slug":"php-7-2-fpm-and-nginx","status":"publish","type":"post","link":"https:\/\/myprojects.advchaweb.com\/index.php\/2018\/07\/10\/php-7-2-fpm-and-nginx\/","title":{"rendered":"PHP 7.2 FPM AND NGINX"},"content":{"rendered":"<p>From http:\/\/myprojects.advchaweb.com\/index.php\/2018\/06\/25\/symfony-4-blog-app\/<\/p>\n<p>I NEED TO CHECK MY PHP VERSION. CLI ALREADY 7.2.<\/p>\n<pre class=\"lang:default decode:true \">teddy@teddy:~\/Documents\/works\/symfony4\/blog$ php -v\r\nPHP 7.2.7-1+ubuntu16.04.1+deb.sury.org+1 (cli) (built: Jun 22 2018 08:44:50) ( NTS )\r\nCopyright (c) 1997-2018 The PHP Group\r\nZend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies\r\n    with Zend OPcache v7.2.7-1+ubuntu16.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies\r\n    with Xdebug v2.6.0, Copyright (c) 2002-2018, by Derick Rethan<\/pre>\n<p>BUT THE SERVER STILL 7.0 (http:\/\/localhost\/phpinfo.php).<br \/>\nIF NOT, CHANGE THE PHP-CLI FROM PHP7.0 (FOR EXAMPLE) TO PHP7.2:<\/p>\n<pre class=\"lang:default decode:true \">teddy@teddy:~$ sudo ln -sfn \/usr\/bin\/php7.2 \/etc\/alternatives\/php \r\nteddy@teddy:~$ php -v<\/pre>\n<p>I ALREADY HAS 7.2 BUT SOME EXTENSIONS ARE MISSING. SO INSTALL THEM<\/p>\n<pre class=\"lang:default decode:true \">sudo apt-get install php7.2-mysql php7.2-curl php7.2-cgi php7.2-mbstring php-mcrypt php7.2-zip php7.2-fpm php7.2-xml php7.2-xmlrpc php-xdebug php7.2-intl<\/pre>\n<p>TO ENABLE PHP 7.2 ON APACHE2 SERVER, PLS DO (MAKE SURE NGINX IS STOPPED IF IT&#8217;S RUNNING AND START APACHE2):<\/p>\n<pre class=\"lang:default decode:true \">sudo a2dismod php7.0\r\nsudo a2dismod php7.1\r\nsudo a2enmod php7.2\r\nsudo systemctl restart apache2<\/pre>\n<p>TEST: http:\/\/localhost\/phpinfo.php<\/p>\n<p>IF NEEDED TO CHANGE THE PHP SETTING, PLS EDIT:<\/p>\n<pre class=\"lang:default decode:true\">sudo gedit \/etc\/php\/7.2\/apache2\/php.ini<\/pre>\n<pre class=\"lang:default decode:true \">upload_max_filesize = 2000M -&gt; (default 2M)\r\nmax_file_uploads = 2000 -&gt; (default 20)\r\npost_max_size = 2000M -&gt; (default 8M)\r\nmax_execution_time = 600 -&gt; (default 30) in second\r\nmax_input_time = 600 -&gt; (default 60) in second\r\nmemory_limit = 2560M -&gt; (default 128M)<\/pre>\n<p>TO ENABLE PHP 7.2 ON NGINX SERVER, PLS DO (MAKE SURE APACHE2 IS STOPPED IF IT&#8217;S RUNNING AND START NGINX):<\/p>\n<p>THE NGINX MAIN CONFIG IN \/etc\/nginx\/nginx.conf<br \/>\nTHE DEFAULT VIRTUALHOST IN \/etc\/nginx\/sites-available\/default<br \/>\nEDIT IT TO ENABLE PARSING PHP FILE:<\/p>\n<pre class=\"lang:default decode:true\">sudo gedit \/etc\/nginx\/sites-available\/default<\/pre>\n<p>CHANGE THE CONTENT TO ENABLE PHP 7.2 FPM:<\/p>\n<pre class=\"lang:default decode:true\">...\r\nserver {\r\n        ...\r\n        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000\r\n\t#\r\n\tlocation ~ \\.php$ {\r\n\t\tinclude snippets\/fastcgi-php.conf;\r\n\t#\r\n\t#\t# With php7.0-cgi alone:\r\n\t#\tfastcgi_pass 127.0.0.1:9000;\r\n\t#\t# With php7.0-fpm:\r\n\t\tfastcgi_pass unix:\/run\/php\/php7.2-fpm.sock;\r\n\t}\r\n\r\n\t# deny access to .htaccess files, if Apache's document root\r\n\t# concurs with nginx's one\r\n\t#\r\n\tlocation ~ \/\\.ht {\r\n\t\tdeny all;\r\n\t}\r\n}\r\n...<\/pre>\n<p>THEN CHANGE PHP7.2-FPM SETTING:<\/p>\n<pre class=\"lang:default decode:true\">sudo gedit \/etc\/php\/7.2\/fpm\/php.ini<\/pre>\n<p>CHANGE THE CONTENT:<\/p>\n<pre class=\"lang:default decode:true\">cgi.fix_pathinfo=0\r\nupload_max_filesize = 2000M -&gt; (default 2M)\r\nmax_file_uploads = 2000 -&gt; (default 20)\r\npost_max_size = 2000M -&gt; (default 8M)\r\nmax_execution_time = 6000 -&gt; (default 30) in second\r\nmax_input_time = 600 -&gt; (default 60) in second\r\nmemory_limit = 2560M -&gt; (default 128M)<\/pre>\n<p>THEN RESTART PHP7.2-FPM SERVICE:<\/p>\n<pre class=\"lang:default decode:true\">sudo systemctl restart php7.2-fpm<\/pre>\n<p>CHECK NGINX SYNTAX: sudo nginx -t<br \/>\nRESTART NGINX: sudo systemctl restart nginx<br \/>\nOPEN IT: http:\/\/localhost\/phpinfo.php (NEED TO CLEAR THE BROWSER CACHE FIRST)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>From http:\/\/myprojects.advchaweb.com\/index.php\/2018\/06\/25\/symfony-4-blog-app\/ I NEED TO CHECK MY PHP VERSION. CLI ALREADY 7.2. teddy@teddy:~\/Documents\/works\/symfony4\/blog$ php -v PHP 7.2.7-1+ubuntu16.04.1+deb.sury.org+1 (cli) (built: Jun 22 2018 08:44:50) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies with Zend OPcache v7.2.7-1+ubuntu16.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies with Xdebug v2.6.0, Copyright (c) &hellip; <a href=\"https:\/\/myprojects.advchaweb.com\/index.php\/2018\/07\/10\/php-7-2-fpm-and-nginx\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;PHP 7.2 FPM AND NGINX&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[48],"tags":[],"class_list":["post-2953","post","type-post","status-publish","format-standard","hentry","category-php-2"],"_links":{"self":[{"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/posts\/2953","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/comments?post=2953"}],"version-history":[{"count":3,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/posts\/2953\/revisions"}],"predecessor-version":[{"id":9710,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/posts\/2953\/revisions\/9710"}],"wp:attachment":[{"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/media?parent=2953"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/categories?post=2953"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/tags?post=2953"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}