{"id":929,"date":"2020-03-10T17:27:16","date_gmt":"2020-03-10T16:27:16","guid":{"rendered":"https:\/\/codedoneright.eu\/?page_id=929"},"modified":"2020-03-10T17:27:16","modified_gmt":"2020-03-10T16:27:16","slug":"php","status":"publish","type":"page","link":"https:\/\/codedoneright.eu\/?page_id=929","title":{"rendered":"PHP"},"content":{"rendered":"\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/upload.wikimedia.org\/wikipedia\/commons\/2\/27\/PHP-logo.svg\" alt=\"PHP logo\" width=\"178\" height=\"96\"\/><figcaption><a href=\"http:\/\/php.net\">PHP Logo<\/a><\/figcaption><\/figure><\/div>\n\n\n\n<p>PHP and SQL are vital to any modern website. They are not services themselves, but many services rely on them.<\/p>\n\n\n\n<p>PHP is a general-purpose programming language that allows for creation of dynamic websites. A lot of pages that you are using implement PHP, even this one \u2013 WordPress relies heavily on it.<\/p>\n\n\n\n<p>You also need to know that there is a necessity for a parser. A package that will allow PHP and SQL to talk to each other. Worry not, I will tell you exactly what you need to do in order for all this to work.<\/p>\n\n\n\n<div style=\"height:56px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">PHP installation<\/h3>\n\n\n\n<p>This one will be quite easy. Run the following<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt install php php-mysql<\/code><\/pre>\n\n\n\n<p>More or less that is all you need for now. Apt will install the latest available package with all the basic modules that you need. <\/p>\n\n\n\n<p><strong>CAUTION <\/strong>note that you need to install <em>php-mysql<\/em> package as well. This is the parser that I mentioned in the introduction. It will allow PHP and MySQL to talk to each other!<\/p>\n\n\n\n<p>After installation is finished, restart Apache with the following command<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo service apache2 restart<\/code><\/pre>\n\n\n\n<div style=\"height:56px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Find out which version is installed<\/h3>\n\n\n\n<p>In time, you will notice that you need additional modules, if you want your services to work properly. A newly installed forum or cloud solution is going to produce an error upon initial run stating that it requires certain PHP module to run.<\/p>\n\n\n\n<p>First of all you need to find out which version of PHP you are running. <a href=\"https:\/\/codedoneright.eu\/?page_id=176\">Useful tricks page<\/a> contains an instruction on how to check which packages are installed on your system. <\/p>\n\n\n\n<p>In short, run the following code<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>php -v\n\nor, if you want to see all packages with php in its name\n\napt list --installed | grep php<\/code><\/pre>\n\n\n\n<p>The first command will show you which the version you have on your system. Short and to the point, but take a look at the second approach.<\/p>\n\n\n\n<p>The second line will list all packages with PHP in their name that are installed on your system. Look for <em>phpX.X<\/em> string which will tell you what PHP version you have on your server. Take a look at the screenshot below. It shows that my server has <em>php7.3<\/em> installed<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"634\" height=\"164\" src=\"https:\/\/codedoneright.eu\/wp-content\/uploads\/php_version.png\" alt=\"php version\" class=\"wp-image-559\" srcset=\"https:\/\/codedoneright.eu\/wp-content\/uploads\/php_version.png 634w, https:\/\/codedoneright.eu\/wp-content\/uploads\/php_version-300x78.png 300w\" sizes=\"(max-width: 634px) 100vw, 634px\" \/><figcaption>php7.3 installed<\/figcaption><\/figure><\/div>\n\n\n\n<div style=\"height:56px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Installation of additional PHP modules <\/h3>\n\n\n\n<p>Now we know what version we are running. Now let us assume a service told you that it needs CURL PHP module. The easiest way to find out which package you need to install is running the following command<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>axi-cache search php curl<\/code><\/pre>\n\n\n\n<p><strong>CAUTION <\/strong>if you do not have xapian search engine on your server, check out how to install it <a href=\"https:\/\/codedoneright.eu\/?page_id=176\">here<\/a>.<\/p>\n\n\n\n<p>Result will show you all packages with PHP CURL in their name. I know it is not that of an exact instruction but install the most logical choice. In this case it would be <em>php-curl<\/em>. Remember that you can uninstall a package, if it turns out this is not the one you were looking for, and install a different one.<\/p>\n\n\n\n<p>Now why we needed to find the version? Some packages are version specific and you need to install a compatible one. Like in the case of a <em>zip<\/em> module for PHP, which is named <em>php7.3-zip<\/em> <\/p>\n\n\n\n<p>In short \u2013 if a package has a version number, grab the one for your version. If there is no package that contains a version number, try this one instead.<\/p>\n\n\n\n<p>When installing new services without their perquisites they will tell you that they require new modules, packages etc. You can use the above method to find out what are the names of said packages. Check out <a href=\"https:\/\/codedoneright.eu\/?page_id=176\">Useful tricks<\/a> page to learn more about searching for packages.<\/p>\n\n\n\n<p>After you have installed required modules, remember to restart Apache with the following command<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo service apache2 restart<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>PHP and SQL are vital to any modern website. They are not services themselves, but many services rely on them. PHP is a general-purpose programming language that allows for creation of dynamic websites. A lot of pages that you are&hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"parent":483,"menu_order":14,"comment_status":"open","ping_status":"closed","template":"","meta":{"footnotes":""},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v23.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>PHP the engine under your website&#039;s hood &#8212; Code Done Right!<\/title>\n<meta name=\"description\" content=\"Learn how to install PHP and additional modules for use with your services on your Raspberry Pi server in no time with this tutorial!\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/codedoneright.eu\/?page_id=929\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:title\" content=\"PHP the engine under your website&#039;s hood &#8212; Code Done Right!\" \/>\n<meta name=\"twitter:description\" content=\"Learn how to install PHP and additional modules for use with your services on your Raspberry Pi server in no time with this tutorial!\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/upload.wikimedia.org\/wikipedia\/commons\/2\/27\/PHP-logo.svg\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/codedoneright.eu\/?page_id=929\",\"url\":\"https:\/\/codedoneright.eu\/?page_id=929\",\"name\":\"PHP the engine under your website's hood &#8212; Code Done Right!\",\"isPartOf\":{\"@id\":\"https:\/\/codedoneright.eu\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/codedoneright.eu\/?page_id=929#primaryimage\"},\"image\":{\"@id\":\"https:\/\/codedoneright.eu\/?page_id=929#primaryimage\"},\"thumbnailUrl\":\"https:\/\/upload.wikimedia.org\/wikipedia\/commons\/2\/27\/PHP-logo.svg\",\"datePublished\":\"2020-03-10T16:27:16+00:00\",\"dateModified\":\"2020-03-10T16:27:16+00:00\",\"description\":\"Learn how to install PHP and additional modules for use with your services on your Raspberry Pi server in no time with this tutorial!\",\"breadcrumb\":{\"@id\":\"https:\/\/codedoneright.eu\/?page_id=929#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/codedoneright.eu\/?page_id=929\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/codedoneright.eu\/?page_id=929#primaryimage\",\"url\":\"https:\/\/upload.wikimedia.org\/wikipedia\/commons\/2\/27\/PHP-logo.svg\",\"contentUrl\":\"https:\/\/upload.wikimedia.org\/wikipedia\/commons\/2\/27\/PHP-logo.svg\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/codedoneright.eu\/?page_id=929#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/codedoneright.eu\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Server features\",\"item\":\"https:\/\/codedoneright.eu\/?page_id=483\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"PHP\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/codedoneright.eu\/#website\",\"url\":\"https:\/\/codedoneright.eu\/\",\"name\":\"Code Done Right!\",\"description\":\"Raspberry Pi server guides\",\"publisher\":{\"@id\":\"https:\/\/codedoneright.eu\/#\/schema\/person\/50378701e349dbd5d40888bc5b532568\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/codedoneright.eu\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/codedoneright.eu\/#\/schema\/person\/50378701e349dbd5d40888bc5b532568\",\"name\":\"CodeDoneRight\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/codedoneright.eu\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/codedoneright.eu\/wp-content\/uploads\/www_icon.png\",\"contentUrl\":\"https:\/\/codedoneright.eu\/wp-content\/uploads\/www_icon.png\",\"width\":120,\"height\":120,\"caption\":\"CodeDoneRight\"},\"logo\":{\"@id\":\"https:\/\/codedoneright.eu\/#\/schema\/person\/image\/\"},\"sameAs\":[\"https:\/\/codedoneright.eu\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"PHP the engine under your website's hood &#8212; Code Done Right!","description":"Learn how to install PHP and additional modules for use with your services on your Raspberry Pi server in no time with this tutorial!","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/codedoneright.eu\/?page_id=929","twitter_card":"summary_large_image","twitter_title":"PHP the engine under your website's hood &#8212; Code Done Right!","twitter_description":"Learn how to install PHP and additional modules for use with your services on your Raspberry Pi server in no time with this tutorial!","twitter_image":"https:\/\/upload.wikimedia.org\/wikipedia\/commons\/2\/27\/PHP-logo.svg","twitter_misc":{"Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/codedoneright.eu\/?page_id=929","url":"https:\/\/codedoneright.eu\/?page_id=929","name":"PHP the engine under your website's hood &#8212; Code Done Right!","isPartOf":{"@id":"https:\/\/codedoneright.eu\/#website"},"primaryImageOfPage":{"@id":"https:\/\/codedoneright.eu\/?page_id=929#primaryimage"},"image":{"@id":"https:\/\/codedoneright.eu\/?page_id=929#primaryimage"},"thumbnailUrl":"https:\/\/upload.wikimedia.org\/wikipedia\/commons\/2\/27\/PHP-logo.svg","datePublished":"2020-03-10T16:27:16+00:00","dateModified":"2020-03-10T16:27:16+00:00","description":"Learn how to install PHP and additional modules for use with your services on your Raspberry Pi server in no time with this tutorial!","breadcrumb":{"@id":"https:\/\/codedoneright.eu\/?page_id=929#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/codedoneright.eu\/?page_id=929"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/codedoneright.eu\/?page_id=929#primaryimage","url":"https:\/\/upload.wikimedia.org\/wikipedia\/commons\/2\/27\/PHP-logo.svg","contentUrl":"https:\/\/upload.wikimedia.org\/wikipedia\/commons\/2\/27\/PHP-logo.svg"},{"@type":"BreadcrumbList","@id":"https:\/\/codedoneright.eu\/?page_id=929#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/codedoneright.eu\/"},{"@type":"ListItem","position":2,"name":"Server features","item":"https:\/\/codedoneright.eu\/?page_id=483"},{"@type":"ListItem","position":3,"name":"PHP"}]},{"@type":"WebSite","@id":"https:\/\/codedoneright.eu\/#website","url":"https:\/\/codedoneright.eu\/","name":"Code Done Right!","description":"Raspberry Pi server guides","publisher":{"@id":"https:\/\/codedoneright.eu\/#\/schema\/person\/50378701e349dbd5d40888bc5b532568"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/codedoneright.eu\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/codedoneright.eu\/#\/schema\/person\/50378701e349dbd5d40888bc5b532568","name":"CodeDoneRight","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/codedoneright.eu\/#\/schema\/person\/image\/","url":"https:\/\/codedoneright.eu\/wp-content\/uploads\/www_icon.png","contentUrl":"https:\/\/codedoneright.eu\/wp-content\/uploads\/www_icon.png","width":120,"height":120,"caption":"CodeDoneRight"},"logo":{"@id":"https:\/\/codedoneright.eu\/#\/schema\/person\/image\/"},"sameAs":["https:\/\/codedoneright.eu"]}]}},"_links":{"self":[{"href":"https:\/\/codedoneright.eu\/index.php?rest_route=\/wp\/v2\/pages\/929"}],"collection":[{"href":"https:\/\/codedoneright.eu\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/codedoneright.eu\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/codedoneright.eu\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codedoneright.eu\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=929"}],"version-history":[{"count":2,"href":"https:\/\/codedoneright.eu\/index.php?rest_route=\/wp\/v2\/pages\/929\/revisions"}],"predecessor-version":[{"id":933,"href":"https:\/\/codedoneright.eu\/index.php?rest_route=\/wp\/v2\/pages\/929\/revisions\/933"}],"up":[{"embeddable":true,"href":"https:\/\/codedoneright.eu\/index.php?rest_route=\/wp\/v2\/pages\/483"}],"wp:attachment":[{"href":"https:\/\/codedoneright.eu\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=929"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}