{"componentChunkName":"component---src-templates-post-tsx","path":"/posts/2019/07/learn-php-from-previous/","result":{"data":{"markdownRemark":{"fields":{"slug":"/2019/07/learn-php-from-previous/"},"frontmatter":{"title":"Learning PHP from other programming languages","tag":["php","bolt CMS","pinned"],"image":"https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcT-OMfTIWpQi63ocxmaCRVYOc0QIzgejLDHdFJtJuTYOmJgDqr_"},"correctedDateEpoch":1562518800000,"html":"<p>PHP is a bit different from other languages, like Python or Dart, in that, it is a mainly a web programming language, running on a server. Furthermore, it is actually pre-installed in macOS.</p>\n<p>I would actually recommend this -- <a href=\"https://phptherightway.com/\">https://phptherightway.com/</a>, and it is quite updated.</p>\n<!-- excerpt_separator -->\n<h2>Installing PHP</h2>\n<p>Although there are pre-installed packages for PHP, like <a href=\"https://www.apachefriends.org/index.html\">XAMPP</a> or <a href=\"https://www.mamp.info/en/\">MAMP</a>, I would rather recommend installing separate parts normally, for learning; for the ease of installing packages: and for project management.</p>\n<ul>\n<li><code>brew install php</code></li>\n<li>Install <a href=\"https://getcomposer.org/\">Composer</a></li>\n<li>\n<p>Install Apache (<code>brew install httpd</code>) or Nginx (<code>brew install nginx</code>); and set it up.</p>\n<ul>\n<li>It seems that Apache is easier to use, but Nginx is faster. Also, Nginx's config looks nicer.</li>\n</ul>\n</li>\n</ul>\n<h2>PHP CLI programming</h2>\n<p>It seems that in the end, PHP is not only for web servers. CLI app programming can also done...</p>\n<pre><code class=\"language-php\">// script.php\n&#x3C;?php\n// Your code here\n</code></pre>\n<h2>PHP in HTML</h2>\n<p>Although this was originally the intent of PHP, it doesn't seem to be a good practice to intermingle PHP and HTML in the same file (just like JavaScript).</p>\n<h2>PHP web frameworks</h2>\n<p>Of course, that is where I am coming from…</p>\n<h2>Downloading a repo from the internet / use a project scaffold</h2>\n<p>For the purpose of testing, I use <a href=\"https://bolt.cm/\">Bolt CMS</a>.</p>\n<p>However, in order to upload to Heroku, you have to set your own web server, like no other programming languages -- <a href=\"https://github.com/patarapolw/bolt-heroku#deploy-bolt-on-heroku\">https://github.com/patarapolw/bolt-heroku#deploy-bolt-on-heroku</a></p>"}},"pageContext":{"slug":"/2019/07/learn-php-from-previous/"}}}