{"id":1463,"date":"2016-03-07T07:01:09","date_gmt":"2016-03-07T15:01:09","guid":{"rendered":"http:\/\/internetofhomethings.com\/homethings\/?p=1463"},"modified":"2016-03-18T12:40:30","modified_gmt":"2016-03-18T19:40:30","slug":"web-server-part-2-adding-php","status":"publish","type":"post","link":"https:\/\/internetofhomethings.com\/homethings\/?p=1463","title":{"rendered":"USB LAMP Web Server Part 2 &#8211; Adding php"},"content":{"rendered":"<p><a href=\"http:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2016\/03\/php.jpg\" rel=\"attachment wp-att-1467\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1467\" src=\"http:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2016\/03\/php.jpg\" alt=\"php\" width=\"283\" height=\"178\" \/><\/a><\/p>\n<p>PHP is an essential component of a majority of\u00a0contemporary web servers. Initially, PHP was an acronym for &#8220;Personal Home Page&#8221;. But it is actually a\u00a0widely used server-side scripting language. PHP is also the foundation for the popular WordPress content management system (CSM).<\/p>\n<p>Now let&#8217;s add php to the USB LAMP web server installation from <a href=\"http:\/\/wp.me\/p5NRQ8-n3\" target=\"_blank\">part 1<\/a> of this series.<\/p>\n<h3 style=\"text-align: center;\"><strong>Adding php to the Web\u00a0Server<\/strong><\/h3>\n<p>Launch the Puppy Package Manager again. In the search window (Find), enter &#8220;php&#8221;.<\/p>\n<p>From the list of results, select php5_5.3.10.<\/p>\n<p><a href=\"http:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2016\/03\/php-install.jpg\" rel=\"attachment wp-att-1471\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1471\" src=\"http:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2016\/03\/php-install.jpg\" alt=\"php-install\" width=\"502\" height=\"296\" srcset=\"https:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2016\/03\/php-install.jpg 502w, https:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2016\/03\/php-install-300x177.jpg 300w\" sizes=\"auto, (max-width: 502px) 100vw, 502px\" \/><\/a><\/p>\n<p>A pop-up windows will appear as shown below:<\/p>\n<p><a href=\"http:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2016\/02\/examinedepenancies.jpg\" rel=\"attachment wp-att-1452\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1452\" src=\"http:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2016\/02\/examinedepenancies.jpg\" alt=\"examinedepenancies\" width=\"550\" height=\"476\" srcset=\"https:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2016\/02\/examinedepenancies.jpg 550w, https:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2016\/02\/examinedepenancies-300x260.jpg 300w\" sizes=\"auto, (max-width: 550px) 100vw, 550px\" \/><\/a><\/p>\n<p>Click the &#8220;Examine dependencies&#8221; button. If this button is not present, just click on the Install button.<\/p>\n<p>Next, click &#8220;Download-and-install selected packages&#8221; in the window below.<\/p>\n<p><a href=\"http:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2016\/02\/downloadinstall.jpg\" rel=\"attachment wp-att-1451\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1451 size-full\" src=\"http:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2016\/02\/downloadinstall.jpg\" alt=\"downloadinstall\" width=\"956\" height=\"625\" srcset=\"https:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2016\/02\/downloadinstall.jpg 956w, https:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2016\/02\/downloadinstall-300x196.jpg 300w, https:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2016\/02\/downloadinstall-768x502.jpg 768w\" sizes=\"auto, (max-width: 956px) 100vw, 956px\" \/><\/a><\/p>\n<p>Another window will appear. Click &#8220;Download packages&#8221; in this\u00a0window.<\/p>\n<p><a href=\"http:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2016\/02\/downloadnow.jpg\" rel=\"attachment wp-att-1453\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1453\" src=\"http:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2016\/02\/downloadnow.jpg\" alt=\"downloadnow\" width=\"445\" height=\"416\" srcset=\"https:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2016\/02\/downloadnow.jpg 445w, https:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2016\/02\/downloadnow-300x280.jpg 300w\" sizes=\"auto, (max-width: 445px) 100vw, 445px\" \/><\/a><\/p>\n<p>Once the installation completes, only one step remains to complete the basic php setup. You must file link php for it to become enabled and active. That is done by entering the following line from a console window:<\/p>\n<p># ln -s \/etc\/apache2\/mods-available\/php5* \/etc\/apache2\/mods-enabled\/<\/p>\n<h3 style=\"text-align: center;\"><strong>Testing the php Installation<\/strong><\/h3>\n<p>Now lets run a simple script to verify php is working. Open a new file:<\/p>\n<p>\/var\/www\/helloworld.php<\/p>\n<p>Enter the following and save the file:<\/p>\n<p>&lt;?php<\/p>\n<p>echo &#8220;Hello World!&#8221;;<\/p>\n<p>?&gt;<\/p>\n<p>Just like in Part 1, the web server is started by entering the following from the console window:<\/p>\n<p>\/etc\/init.d\/apache2 restart<\/p>\n<p>Our test script can now be tested by entering the following into a web browser connected to the same local network as the server:<\/p>\n<p>http:\/\/192.168.0.110:9777\/test.php<\/p>\n<p><strong>Note: In Part 1, the ip of the server was set to 192.168.0.110 on port 9777. If your server is configured differently, change your test URL as appropriate.<\/strong><\/p>\n<p>You should see<\/p>\n<p>Hello World!<\/p>\n<p>displayed in the browser. This confirms php is working.<\/p>\n<h3 style=\"text-align: center;\"><strong>Additional php Packages<\/strong><\/h3>\n<p>While your php installation is complete, you may wish to add additional packages to extend the php functionality. Two widely used packages are APIs for\u00a0\u00a0XSLT\u00a0and mySQL.<\/p>\n<p><a href=\"http:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2016\/03\/xsl.jpg\" rel=\"attachment wp-att-1480\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1480 size-full\" src=\"http:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2016\/03\/xsl.jpg\" alt=\"xsl\" width=\"133\" height=\"133\" \/><\/a><\/p>\n<p>XSLT is a language for transforming XML documents. \u00a0For a web server, the result is\u00a0an HTML web\u00a0page.\u00a0 The transformation is done by matching templates in an XSLT style-sheet against an XML document.<\/p>\n<p><a href=\"http:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2016\/03\/mySQL.png\" rel=\"attachment wp-att-1481\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1481 size-thumbnail\" src=\"http:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2016\/03\/mySQL-150x150.png\" alt=\"mySQL\" width=\"150\" height=\"150\" srcset=\"https:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2016\/03\/mySQL-150x150.png 150w, https:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2016\/03\/mySQL-300x300.png 300w, https:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2016\/03\/mySQL.png 512w\" sizes=\"auto, (max-width: 150px) 100vw, 150px\" \/><\/a><\/p>\n<p>mySQL is a widely used database management system (DMS). it is used on many websites to store and retrieve information. It is important to understand that the\u00a0package we are about to install is an API to communicate with a mySQL database.<\/p>\n<p>This package\u00a0is not the mySQL DMS. That will come in part 3 of this series.<\/p>\n<p>Here are the specific packages known to support these APIs with the Precision Puppy distribution we are working with:<\/p>\n<p><strong>php5-xsl_5.3.10<\/strong><\/p>\n<p>libxslt1.1_1.1.26<\/p>\n<p>xsltproc_1.1.26<\/p>\n<p><strong>php5-mysql_5.3.10<\/strong><\/p>\n<p>mysql-common_5.5.47<\/p>\n<p>libmysqlclient18_5.5.47<\/p>\n<p>These are installed in the same manner as php was installed.<\/p>\n<p>For the XSLT packages, open the puppy package manager, search for XSLT, and select the bold package &#8220;<strong>php5-xsl_5.3.10&#8243;<\/strong>. The other two packages should get installed as &#8220;dependent&#8221; packages.<\/p>\n<p>Likewise, for the mysql\u00a0packages, open the puppy package manager, search for mysql, and select the bold package &#8220;<strong>php5-mysql_5.3.10&#8243;<\/strong>. The other two packages should get installed as &#8220;dependent&#8221; packages.<\/p>\n<h3 style=\"text-align: center;\"><strong>Coming Attractions<\/strong><\/h3>\n<p>That&#8217;s it for php. But there are additional php packages available to support unique website requirements. You can add any additional packages needed following the same process described in this post.<\/p>\n<p><a href=\"http:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2016\/03\/php-checklist.jpg\" rel=\"attachment wp-att-1476\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1476\" src=\"http:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2016\/03\/php-checklist.jpg\" alt=\"php-checklist\" width=\"204\" height=\"204\" srcset=\"https:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2016\/03\/php-checklist.jpg 204w, https:\/\/internetofhomethings.com\/homethings\/wp-content\/uploads\/2016\/03\/php-checklist-150x150.jpg 150w\" sizes=\"auto, (max-width: 204px) 100vw, 204px\" \/><\/a><\/p>\n<p>In part 3, we will be adding the mySQL database management system\u00a0to our Apache server.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>PHP is an essential component of a majority of\u00a0contemporary web servers. Initially, PHP was an acronym for &#8220;Personal Home Page&#8221;. But it is actually a\u00a0widely used server-side scripting language. PHP &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[116,117],"class_list":["post-1463","post","type-post","status-publish","format-standard","hentry","category-alltheposts","tag-php-on-apache-server","tag-php-on-usb-server"],"_links":{"self":[{"href":"https:\/\/internetofhomethings.com\/homethings\/index.php?rest_route=\/wp\/v2\/posts\/1463","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/internetofhomethings.com\/homethings\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/internetofhomethings.com\/homethings\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/internetofhomethings.com\/homethings\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/internetofhomethings.com\/homethings\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1463"}],"version-history":[{"count":15,"href":"https:\/\/internetofhomethings.com\/homethings\/index.php?rest_route=\/wp\/v2\/posts\/1463\/revisions"}],"predecessor-version":[{"id":1509,"href":"https:\/\/internetofhomethings.com\/homethings\/index.php?rest_route=\/wp\/v2\/posts\/1463\/revisions\/1509"}],"wp:attachment":[{"href":"https:\/\/internetofhomethings.com\/homethings\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1463"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/internetofhomethings.com\/homethings\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1463"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/internetofhomethings.com\/homethings\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1463"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}