[2024-feb-29] Sad news: Eric Layton aka Nocturnal Slacker aka vtel57 passed away on Feb 26th, shortly after hospitalization. He was one of our Wiki's most prominent admins. He will be missed.
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
howtos:misc:approach_to_web_development_on_slackware [2020/11/21 16:57 (UTC)] – [Web Dev primarily HTML and PHP] captain_sensible | howtos:misc:approach_to_web_development_on_slackware [2020/12/01 16:54 (UTC)] (current) – [Structure of HTML & PHP] captain_sensible | ||
---|---|---|---|
Line 4: | Line 4: | ||
- | I'm going to give an overview of web development for users of Slackware. It's going to be from the perspective of approaches for a budding web developer who uses Slackware; the problems you might face due to using Slackware Linux and an eclectic look at what tools are available to help you, starting simplest first. There will be some embedded information on HTML and PHP, what they do and what they do not do.I will probably | + | I'm going to give an overview of web development for users of Slackware.It' |
+ | |||
+ | There will be some embedded information on HTML and PHP, what they do and what they do not do. I will probably | ||
+ | |||
+ | ==== Structure of HTML & PHP ==== | ||
| | ||
Line 24: | Line 28: | ||
</ | </ | ||
- | If you're good at geometric progressions, | + | If you're good at geometric progressions, |
- | is not programming code but merely about how things should be presented or markup. | + | |
- | <> designates the start of markup and </> the end of the markup. The file is conveniently organized into head and body areas and the whole text wrapped by < | + | <> designates the start of markup and </> the end of the markup. The file is conveniently organized into head and body areas and the whole text wrapped by < |
+ | So as a developer, you have two perspectives working with HTML; the text if the file is opened with a text editor and how it looks after a web browser has digested what's written | ||
- | I previously said HTML is markup, but what interprets | + | HTML is not the only text document that has associated with it instructions of how it should look. When you use a word processor like LibreOffice you see the text as you type, but behind the scenes the text has associated with it instructions such as font type, font size, and so on. For this reason, never use a word processor when constructing HTML documents, since you will have to edit out the accessory info. |
- | The markup in a HTML is specifically aimed at web browsers. | + | There are many alternatives to working with HTML documents using a text editor, but as good as any in my opinion |
- | So as a developer, you have two perspectives working with HTML; the text, if the file is opened with a text editor and how it looks after a web browser has digested what's written inside and then presented it (also called has rendered document). | ||
- | HTML is not the only text document that has associated with it instructions of how it is intended | + | ==== Using Built in PHP dev Server |
- | There are many alternatives to working with HTML documents, but as good as any in my opinion is Geany available from [[slackbuilds.org]]. It has basic text highlighting and gets the job done. | ||
- | Now, if we were working with Geany and saved the above text as a file, lets make it index.html and save it to Desktop. We have two choices; open and edit with a text editor or open it as intended with a web browser. If you do that, all you will see is "hello world" | ||
- | You could, if you want, have several | + | Now, if we were working with geany and saved the above text as a file say index.html to your Desktop, you then have two choices; open and edit with a text editor or open it as intended with a web browser. If you do that, all you will see is "hello world" |
+ | |||
+ | You could, if you want, have several | ||
So, this is what we now have on our Desktop: | So, this is what we now have on our Desktop: | ||
Line 49: | Line 52: | ||
webPlay | webPlay | ||
└── index.html | └── index.html | ||
- | |||
</ | </ | ||
- | We only have one file at the moment in directory | + | We only have one file at the moment in our directory ; we could put 1000's in that single directory and right click to open each with a web browser. When Tim Berners-Lee came up with the idea of HTML (hypertext markup language), he also had a vision of an architecture of how researchers at one institute would request a document |
Software that can be leveraged to make things convenient involves being able to " | Software that can be leveraged to make things convenient involves being able to " | ||
Line 70: | Line 72: | ||
Copyright (c) The PHP Group | Copyright (c) The PHP Group | ||
Zend Engine v3.4.0, Copyright (c) Zend Technologies | Zend Engine v3.4.0, Copyright (c) Zend Technologies | ||
- | | + | with Zend OPcache v7.4.1, Copyright (c), by Zend Technologies |
bash-5.0$ | bash-5.0$ | ||
</ | </ | ||
- | So, I have PHP version 7.4.1 available, which is very useful since most modern web software like CodeIgniter require PHP 7 and above. That version of PHP came with Slackware -current which I upgraded to early last year (5.4.12) - a very good vintage! | + | So, I have PHP version 7.4.1 available, which is very useful since most modern web software like CodeIgniter require PHP 7 and above as stated on the documentation of CodeIgniter4. That version of PHP came with Slackware -current which I upgraded to early last year (5.4.12) - a very good vintage! |
Let's fire up the dev server and "point it" to where our HTML files are: | Let's fire up the dev server and "point it" to where our HTML files are: | ||
Line 86: | Line 88: | ||
</ | </ | ||
- | When I open up the Terminal Emulator, it opens with the " | + | When I open up the Terminal Emulator, it opens with the " |
So, I change directory to Desktop, because that's where my directory containing my HTML file is. I also tell PHP, via the terminal, that I would like to use localhost and port 8080. | So, I change directory to Desktop, because that's where my directory containing my HTML file is. I also tell PHP, via the terminal, that I would like to use localhost and port 8080. | ||
Line 101: | Line 103: | ||
- | A single index.html is about as simple as you can get; if you uploaded it say via cPanel on hosting, and then you pointed your website domain to that hosting, as instructed by your hosting company then you will have a simple, but working one page web site. | + | A single index.html is about as simple as you can get; if you uploaded it say via cPanel on hosting, and then you pointed your website domain to your hosting, as instructed by your hosting company then you will have a simple, but working one page web site. |
- | More sophisticated web systems such as WordPress still have somewhere within them index.php (with WP its located at the web root). In these cases, the index.php is often referred to as the " | + | More sophisticated web systems such as WordPress still have somewhere within them one or more index.php (with WP its located at the web root). In these cases, the index.php |
- | Before we move on to PHP let's have a last look at HTML and how to link one page to another. Go to Geany -> | + | Before we move on to PHP let's have a last look at HTML and how to link one page to another. Go to geany -> |
Open it up and in the < | Open it up and in the < | ||
Line 130: | Line 132: | ||
Click on the line that says // | Click on the line that says // | ||
+ | |||
+ | |||
+ | ==== Making use of HTML presentation but with PHP functionality ==== | ||
Line 163: | Line 168: | ||
</ | </ | ||
- | Refresh your browser and now what do you see?Quite a lot! | + | Refresh your browser and now what do you see? Quite a lot of information concerning PHP! |
When I first did this it demonstrated the potential of PHP. | When I first did this it demonstrated the potential of PHP. | ||
+ | |||
+ | ==== Introducing Databases into the mix ==== | ||
+ | |||
+ | |||
Next we will have a simple look at using a database.When you mention anything about databases most people immediately think MySQl or Maria;so you can't do anything with a database on your Desktop since you need a daemon. Well actually you can since sqlite3 is server-less. | Next we will have a simple look at using a database.When you mention anything about databases most people immediately think MySQl or Maria;so you can't do anything with a database on your Desktop since you need a daemon. Well actually you can since sqlite3 is server-less. | ||
Assuming our Terminal Emulator is in webPlay lets create a database from the command line. Actually lets first check we have the tools in place: | Assuming our Terminal Emulator is in webPlay lets create a database from the command line. Actually lets first check we have the tools in place: | ||
Line 249: | Line 258: | ||
- | So here we just did a retrieval of data; its one small step from there to insert, update all part of what is referred to as " | + | So here we just did a retrieval of data; its one small step from there to insert, update all part of what is referred to as " |
- | A couple of other things to mention | + | A couple of other things to mention |
- | So what i have demonstrated here is that you can go a long way developing | + | So what i have demonstrated here is that you can go a long way developing |
which is another approach for working with web development. | which is another approach for working with web development. | ||
+ | |||
+ | ==== PHP framework ==== | ||
Before we look at xampp and apache i'm going to mention composer [[https:// | Before we look at xampp and apache i'm going to mention composer [[https:// | ||
- | When your working with single | + | When your working with single |
I've used it in 2 ways. | I've used it in 2 ways. | ||
Line 310: | Line 321: | ||
</ | </ | ||
- | A little bit about php frameworks. A few html or php files is ok for a small website but php frameworks come in handy where you are going to do a lot of work with data. Frameworks have a design of logic that splits | + | A little bit about PHP frameworks. A few HTML or PHP files is ok for a small website but PHP frameworks come in handy where you are going to do a lot of work with data. Frameworks have a design of logic that splits |
- | php built in server or using spark have their limitations; | + | PHP built in server or using spark have their limitations; |
Now xampp from apachefriends [[https:// | Now xampp from apachefriends [[https:// | ||
Line 318: | Line 329: | ||
It comes with an installer and I have previously tried it on Slackware. Although it comes with an installer it is not installed on your system but is put in /opt and the way i view it is that it is an " | It comes with an installer and I have previously tried it on Slackware. Although it comes with an installer it is not installed on your system but is put in /opt and the way i view it is that it is an " | ||
- | There are pro's and cons. Its doesn' | + | There are pro's and cons. Its doesn' |
+ | |||
+ | |||
+ | ==== Setting up a Development Environment using Apache ==== | ||
Line 327: | Line 341: | ||
</ | </ | ||
- | Thats where we are now going to move our CI4 to. I must at this point put in a disclaimer that i'm writing from my experience of getting things going. I have for a few months been writing a light C.M.S system on top of CodeIgniter 4.0.4; | + | Thats where we are now going to move our CI4 to. I must at this point put in a disclaimer that I'm writing from my experience of getting things going. I have for a few months been writing a light C.M.S system on top of CodeIgniter 4.0.4; |
- | Ok this is how I use CodeIgniter in apache: | + | Ok this is one way |
First we are going to our Desktop to zip up CI4 and them move it to / | First we are going to our Desktop to zip up CI4 and them move it to / | ||
Line 340: | Line 354: | ||
# mv CI4.zip / | # mv CI4.zip / | ||
</ | </ | ||
+ | |||
+ | === Approach To permission problems === | ||
- | Now i will mention | + | Now i will talk generally about problems |
- | Now this is where perhaps the bone of contention sets in; you could do su-> | + | Now this is where perhaps the bone of contention sets in; |
First lets have a look at httpd.conf | First lets have a look at httpd.conf | ||
Line 353: | Line 369: | ||
193 Group apache | 193 Group apache | ||
- | //i will use that later ,further down you will also see | ||
535 # Uncomment the following line to enable PHP: | 535 # Uncomment the following line to enable PHP: | ||
Line 414: | Line 429: | ||
secrets when I show you my local WP ;it looks like this: | secrets when I show you my local WP ;it looks like this: | ||
- | {{: | + | {{: |
Its an extract of how WP uses Sqlite (yes you can opt for sqlite | Its an extract of how WP uses Sqlite (yes you can opt for sqlite | ||
Line 490: | Line 505: | ||
Note the 127.0.0.9 in address bar and that I can now work with framework and edit as user andrew , without risk of messing up system as root. If you follow this through and you get a problem its probably either your php version is < than 7.3 or I did something somewhere forgot about it and forgot to mention . | Note the 127.0.0.9 in address bar and that I can now work with framework and edit as user andrew , without risk of messing up system as root. If you follow this through and you get a problem its probably either your php version is < than 7.3 or I did something somewhere forgot about it and forgot to mention . | ||
+ | |||
+ | |||
+ | |||
====== Sources ====== | ====== Sources ====== | ||
+ | |||
+ | |||
<!-- If you are copying information from another source, then specify that source --> | <!-- If you are copying information from another source, then specify that source --> | ||
<!-- * Original source: [[http:// | <!-- * Original source: [[http:// | ||
<!-- Authors are allowed to give credit to themselves! --> | <!-- Authors are allowed to give credit to themselves! --> | ||
- | <!-- * Originally written by [[wiki: | + | Originally written by [[wiki: |
<!-- * Contributions by [[wiki: | <!-- * Contributions by [[wiki: | ||