{"id":684,"date":"2021-06-04T06:42:06","date_gmt":"2021-06-04T06:42:06","guid":{"rendered":"http:\/\/www.peakproductions.at\/sides\/peakproductions\/?p=684"},"modified":"2021-06-04T12:39:27","modified_gmt":"2021-06-04T12:39:27","slug":"ubuntu-server-fuer-webanwendungen-teil-4-php","status":"publish","type":"post","link":"https:\/\/www.peakproductions.at\/sides\/peakproductions\/index.php\/2021\/06\/04\/ubuntu-server-fuer-webanwendungen-teil-4-php\/","title":{"rendered":"Ubuntu Server f\u00fcr Webanwendungen &#8211; Teil 4 \u2013 php"},"content":{"rendered":"\n<p>Damit die Webanwendung ein wenig Logik verliehen bekommt, ben\u00f6tigt es noch eine Programmiersprache. Sehr einsteigerfreundlich und auch beliebt ist php. PHP ist zum Gl\u00fcck mit ein paar Befehlszeilen installiert ;-).<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt install php libapache2-mod-php php-mysql<\/code><\/pre>\n\n\n\n<p>Nach der Installation kann php recht einfach getestet werden. Damit es ein wenig spannender wird, erstellen wir hier direkt den ersten kurzen Code. Zuerst muss in das richtige Verzeichnis gewechselt werden. Daf\u00fcr im Terminal den cd (change directory) Befehl verwenden.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cd \/var\/www\/html<\/code><\/pre>\n\n\n\n<p>Im html-Ordner angekommen, ben\u00f6tigen wir zuerst ein leeres Textdokument in dem wir unser Programm schreiben k\u00f6nnen. Dazu verwende ich Nano, was ist ein einfacher und viel verwendeter Texteditor ist. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo nano index.php<\/code><\/pre>\n\n\n\n<p>In dem ge\u00f6ffneten Editor jetzt folgenden Code einf\u00fcgen:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php phpinfo(); ?&gt;<\/code><\/pre>\n\n\n\n<p>Kurz erkl\u00e4rt was hier gemacht wird. HTML wird grunds\u00e4tzlich in Tags &lt; Befehl &gt; geschrieben. In diesem Tag sagen wir aber, dass hier ein teil mit php interpretiert werden soll. &lt;?php Befehl ?&gt;. der Teil mit phpinfo(); ist ein sogenannter Funktionsaufruf, diese Funktion ist ebenfalls in php geschrieben und gibt uns etwas zur\u00fcck. In diesem Fall werden alle relevanten Informationen von der installierten php-Version zur\u00fcckgegeben und das bereits sch\u00f6n formatiert in html. Mit &#8222;strg+x&#8220; und dann &#8222;y&#8220; kann die Datei gespeichert werden.<\/p>\n\n\n\n<p>Wieder zur\u00fcck im Browser wird die IP-Adresse des Servers eingegeben, gefolgt von \/index.php<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;ip-adresse&gt;\/index.php<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"301\" src=\"http:\/\/www.peakproductions.at\/sides\/peakproductions\/wp-content\/uploads\/2021\/06\/image-9-1024x301.png\" alt=\"\" class=\"wp-image-686\" srcset=\"https:\/\/www.peakproductions.at\/sides\/peakproductions\/wp-content\/uploads\/2021\/06\/image-9-1024x301.png 1024w, https:\/\/www.peakproductions.at\/sides\/peakproductions\/wp-content\/uploads\/2021\/06\/image-9-300x88.png 300w, https:\/\/www.peakproductions.at\/sides\/peakproductions\/wp-content\/uploads\/2021\/06\/image-9-768x225.png 768w, https:\/\/www.peakproductions.at\/sides\/peakproductions\/wp-content\/uploads\/2021\/06\/image-9-1536x451.png 1536w, https:\/\/www.peakproductions.at\/sides\/peakproductions\/wp-content\/uploads\/2021\/06\/image-9.png 1608w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/figure>\n\n\n\n<p>In der jetzigen Seite stehen die Informationen \u00fcber die aktuell installierte php-Version.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"900\" src=\"http:\/\/www.peakproductions.at\/sides\/peakproductions\/wp-content\/uploads\/2021\/06\/image-10-1024x900.png\" alt=\"\" class=\"wp-image-687\" srcset=\"https:\/\/www.peakproductions.at\/sides\/peakproductions\/wp-content\/uploads\/2021\/06\/image-10-1024x900.png 1024w, https:\/\/www.peakproductions.at\/sides\/peakproductions\/wp-content\/uploads\/2021\/06\/image-10-300x264.png 300w, https:\/\/www.peakproductions.at\/sides\/peakproductions\/wp-content\/uploads\/2021\/06\/image-10-768x675.png 768w, https:\/\/www.peakproductions.at\/sides\/peakproductions\/wp-content\/uploads\/2021\/06\/image-10-1536x1349.png 1536w, https:\/\/www.peakproductions.at\/sides\/peakproductions\/wp-content\/uploads\/2021\/06\/image-10-2048x1799.png 2048w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/figure>\n\n\n\n<p>Gratulation. Die Entwicklungsumgebung ist hiermit fertig \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Damit die Webanwendung ein wenig Logik verliehen bekommt, ben\u00f6tigt es noch eine Programmiersprache. Sehr einsteigerfreundlich und auch beliebt ist php. PHP ist zum Gl\u00fcck mit ein paar Befehlszeilen installiert ;-). Nach der Installation kann php recht einfach getestet werden. Damit es ein wenig spannender wird, erstellen wir hier direkt den ersten kurzen Code. Zuerst muss &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.peakproductions.at\/sides\/peakproductions\/index.php\/2021\/06\/04\/ubuntu-server-fuer-webanwendungen-teil-4-php\/\" class=\"more-link\"><span class=\"screen-reader-text\">\u201eUbuntu Server f\u00fcr Webanwendungen &#8211; Teil 4 \u2013 php\u201c<\/span> weiterlesen<\/a><\/p>\n","protected":false},"author":1,"featured_media":690,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15],"tags":[17,21,18,19,20,16],"class_list":["post-684","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux-tipps-und-tricks","tag-apache","tag-lamp","tag-linux","tag-mysql","tag-php","tag-webdev"],"_links":{"self":[{"href":"https:\/\/www.peakproductions.at\/sides\/peakproductions\/index.php\/wp-json\/wp\/v2\/posts\/684","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.peakproductions.at\/sides\/peakproductions\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.peakproductions.at\/sides\/peakproductions\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.peakproductions.at\/sides\/peakproductions\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.peakproductions.at\/sides\/peakproductions\/index.php\/wp-json\/wp\/v2\/comments?post=684"}],"version-history":[{"count":4,"href":"https:\/\/www.peakproductions.at\/sides\/peakproductions\/index.php\/wp-json\/wp\/v2\/posts\/684\/revisions"}],"predecessor-version":[{"id":696,"href":"https:\/\/www.peakproductions.at\/sides\/peakproductions\/index.php\/wp-json\/wp\/v2\/posts\/684\/revisions\/696"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.peakproductions.at\/sides\/peakproductions\/index.php\/wp-json\/wp\/v2\/media\/690"}],"wp:attachment":[{"href":"https:\/\/www.peakproductions.at\/sides\/peakproductions\/index.php\/wp-json\/wp\/v2\/media?parent=684"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.peakproductions.at\/sides\/peakproductions\/index.php\/wp-json\/wp\/v2\/categories?post=684"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.peakproductions.at\/sides\/peakproductions\/index.php\/wp-json\/wp\/v2\/tags?post=684"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}