How can I implement a website using HTML and CSS without functionality?

In summary, the conversation involved discussing how to implement a website using HTML and CSS, specifically focusing on creating a table and adjusting the layout using padding. The conversation also included troubleshooting an issue with an image source and finding the correct URL to use.
  • #106
evinda said:
I get:

httpd: Syntax error on line 39 of C:/Users/evinda/Desktop/Apache/httpd-2.4.35/httpd-2.4.35-o102p-x86-vc14/Apache24/conf/httpd.conf: ServerRoot must be a valid directory
We have to edit that httpd.conf file.
It contains
Code:
Define SRVROOT "/Apache24"

I've changed mine to:
Code:
Define SRVROOT "C:\Users\vanaarse\Downloads\httpd-2.4.46-o111k-x86-vc15\Apache24"
and it works now. 🤔
 
Technology news on Phys.org
  • #107
Klaas van Aarsen said:
I've changed mine to:
Code:
Define SRVROOT "C:\Users\vanaarse\Downloads\httpd-2.4.46-o111k-x86-vc15\Apache24"
and it works now. 🤔

So we just write "C:\Users\evinda\Desktop\Apache\httpd-2.4.35\httpd-2.4.35-o102p-x86-vc14\Apache24>"... We don't have to edit something else, do we? 🧐

When we get no error, it means that it works, right? 🤔

What do we do next? 🧐
 
  • #108
evinda said:
So we just write "C:\Users\evinda\Desktop\Apache\httpd-2.4.35\httpd-2.4.35-o102p-x86-vc14\Apache24>"... We don't have to edit something else, do we?

When we get no error, it means that it works, right?

What do we do next?
Open http://localhost in your browser and see if an apache web page shows up.
And if you have your example.html in the correct htdocs directory, we can also try http://localhost/example.html. 🤔

Btw, there should not be a '>' at the end of the path. :eek:
 
  • #109
Klaas van Aarsen said:
Open http://localhost in your browser and see if an apache web page shows up.
And if you have your example.html in the correct htdocs directory, we can also try http://localhost/example.html. 🤔

I open http://localhost and I get:

1617478889051.png


So it still doesn't work, right? (Sweating)

Klaas van Aarsen said:
Btw, there should not be a '>' at the end of the path. :eek:
I wrote:

cd C:\Users\evinda\Desktop\Apache\httpd-2.4.35\httpd-2.4.35-o102p-x86-vc14\Apache24

and I got:

C:\Users\evinda\Desktop\Apache\httpd-2.4.35\httpd-2.4.35-o102p-x86-vc14\Apache24> 🧐
 
  • #110
evinda said:
I open http://localhost and I get:

So it still doesn't work, right?

I wrote:
cd C:\Users\evinda\Desktop\Apache\httpd-2.4.35\httpd-2.4.35-o102p-x86-vc14\Apache24
and I got:
C:\Users\evinda\Desktop\Apache\httpd-2.4.35\httpd-2.4.35-o102p-x86-vc14\Apache24>
Yes, but the '>' is not part of the path and must not be in the httpd.conf file.
It seems likely that is the reason that it does not work yet. 🤔

Furthermore, in the Apache24 directory there is a 'logs' directory that contains the file 'error.log'.
It will contain a line at the end that clarifies why apache does not work yet. 🤔
 
  • #111
Klaas van Aarsen said:
Yes, but the '>' is not part of the path and must not be in the httpd.conf file.
It seems likely that is the reason that it does not work yet. 🤔

Furthermore, in the Apache24 directory there is a 'logs' directory that contains the file 'error.log'.
It will contain a line at the end that clarifies why apache does not work yet. 🤔

In Apache directory I have:

1617480634957.png


In the log directory I have:

1617480665035.png


There is also a error directory which contains:

1617480693347.png


🧐 🧐 🧐
 
  • #112
evinda said:
In Apache directory I have:

In the log directory I have:

There is also a error directory which contains:
Ah, the error.log is not there yet because the path is wrong, so Apache can't write error.log to its proper location yet.
If we fix the path and run httpd.exe again, then the error.log file will appear in the 'logs' directory. 🤔
 
  • #113
Klaas van Aarsen said:
Ah, the error.log is not there yet because the path is wrong, so Apache can't write error.log to its proper location yet.
If we fix the path and run httpd.exe again, then the error.log file will appear in the 'logs' directory. 🤔

I wrote now:

C:\Users\evinda\Desktop\Apache\httpd-2.4.35\httpd-2.4.35-o102p-x86-vc14\Apache24\conf>httpd.conf

and then I got:

1617487757120.png


1617487848920.png


1617487986114.png


1617488079344.png


1617488131411.png


1617488175157.png


1617488270947.png


1617488325072.png

1617488366149.png


1617488414039.png


1617488463597.png


So Apache is working now, or not? 🧐
 
  • #114
evinda said:
I wrote now:
C:\Users\evinda\Desktop\Apache\httpd-2.4.35\httpd-2.4.35-o102p-x86-vc14\Apache24\conf>httpd.conf
and then I got:
So Apache is working now, or not?
I'm afraid not. :oops:

Let's go through it step by step.
  1. We start with the command prompt that you have.
    It shows C:\Users\evinda\Desktop\Apache\httpd-2.4.35\httpd-2.4.35-o102p-x86-vc14\Apache24\conf>.
  2. Type C:\Users\evinda\Desktop\Apache\httpd-2.4.35\httpd-2.4.35-o102p-x86-vc14\Apache24\conf> notepad httpd.conf, which will open the configuration file in notepad.
  3. Near the top, which is also in your first screenshot, there is a line that reads Define SRVROOT "/Apache24".
    Change that line to Define SRVROOT "C:\Users\evinda\Desktop\Apache\httpd-2.4.35\httpd-2.4.35-o102p-x86-vc14\Apache24"
  4. Save the file and close notepad.
  5. Type C:\Users\evinda\Desktop\Apache\httpd-2.4.35\httpd-2.4.35-o102p-x86-vc14\Apache24\conf> cd ..\bin.
  6. Type C:\Users\evinda\Desktop\Apache\httpd-2.4.35\httpd-2.4.35-o102p-x86-vc14\Apache24\bin> httpd.exe, which should start apache.
    The prompt will not return.
    Later on, if we want to, we can stop apache by pressing Ctrl+C, after which the prompt will return.
  7. Check if we can open http://localhost in the browser.
(Sweating)
 
  • #115
Klaas van Aarsen said:
I'm afraid not. :oops:

Let's go through it step by step.
  1. We start with the command prompt that you have.
    It shows C:\Users\evinda\Desktop\Apache\httpd-2.4.35\httpd-2.4.35-o102p-x86-vc14\Apache24\conf>.
  2. Type C:\Users\evinda\Desktop\Apache\httpd-2.4.35\httpd-2.4.35-o102p-x86-vc14\Apache24\conf> notepad httpd.conf, which will open the configuration file in notepad.
  3. Near the top, which is also in your first screenshot, there is a line that reads Define SRVROOT "/Apache24".
    Change that line to Define SRVROOT "C:\Users\evinda\Desktop\Apache\httpd-2.4.35\httpd-2.4.35-o102p-x86-vc14\Apache24"
  4. Save the file and close notepad.
  5. Type C:\Users\evinda\Desktop\Apache\httpd-2.4.35\httpd-2.4.35-o102p-x86-vc14\Apache24\conf> cd ..\bin.
  6. Type C:\Users\evinda\Desktop\Apache\httpd-2.4.35\httpd-2.4.35-o102p-x86-vc14\Apache24\bin> httpd.exe, which should start apache.
    The prompt will not return.
    Later on, if we want to, we can stop apache by pressing Ctrl+C, after which the prompt will return.
  7. Check if we can open http://localhost in the browser.
(Sweating)

It works now! (Clapping)

So to run the program I save the html file in the "htdocs" directory and the php in the "cgi-bin" directory, right? 🧐

1617490693745.png
 
  • #116
evinda said:
It works now!
Nice. (Sun)

evinda said:
So to run the program I save the html file in the "htdocs" directory and the php in the "cgi-bin" directory, right?
Yep. (Nod)
 
  • #117
Klaas van Aarsen said:
Yep. (Nod)

I open http://localhost/example.html and after giving the input I get:
1617491926492.png
I saved the two files as follows in the directory we said in the previous post:
1617491994715.png


1617492023609.png


At the logs directory there is now a file with the name "error":
1617492065660.png


And in this file I get:

[Sun Apr 04 01:51:22.887386 2021] [ssl:warn] [pid 17024:tid 540] AH01909: localhost:443:0 server certificate does NOT include an ID which matches the server name
[Sun Apr 04 01:51:23.427353 2021] [ssl:warn] [pid 17024:tid 540] AH01909: localhost:443:0 server certificate does NOT include an ID which matches the server name
[Sun Apr 04 01:51:23.428355 2021] [mpm_winnt:notice] [pid 17024:tid 540] AH00455: Apache/2.4.35 (Win32) OpenSSL/1.0.2p configured -- resuming normal operations
[Sun Apr 04 01:51:23.428355 2021] [mpm_winnt:notice] [pid 17024:tid 540] AH00456: Server built: Sep 17 2018 21:34:44
[Sun Apr 04 01:51:23.428355 2021] [core:notice] [pid 17024:tid 540] AH00094: Command line: 'httpd.exe -d C:/Users/evinda/Desktop/Apache/httpd-2.4.35/httpd-2.4.35-o102p-x86-vc14/Apache24'
[Sun Apr 04 01:51:23.541351 2021] [mpm_winnt:notice] [pid 17024:tid 540] AH00418: Parent: Created child process 15708
[Sun Apr 04 01:51:26.324483 2021] [ssl:warn] [pid 15708:tid 584] AH01909: localhost:443:0 server certificate does NOT include an ID which matches the server name
[Sun Apr 04 01:51:26.496066 2021] [ssl:warn] [pid 15708:tid 584] AH01909: localhost:443:0 server certificate does NOT include an ID which matches the server name
[Sun Apr 04 01:51:26.501077 2021] [mpm_winnt:notice] [pid 15708:tid 584] AH00354: Child: Starting 64 worker threads. (Sweating)(Sweating)(Sweating)
 
  • #118
evinda said:
I open http://localhost/example.html and after giving the input I get:
I saved the two files as follows in the directory we said in the previous post:
At the logs directory there is now a file with the name "error":
And in this file I get:

It seems there is nothing relevant in the error.log file at this time. :confused:

What is the address in your browser after you submit the input?
Perhaps it does not match the location of the .php file?
It should be http://localhost/cgi-bin/action.php. 🤔
 
  • #119
Klaas van Aarsen said:
It seems there is nothing relevant in the error.log file at this time. :confused:

What is the address in your browser after you submit the input?
Perhaps it does not match the location of the .php file?
It should be http://localhost/cgi-bin/action.php. 🤔

No, it is http://localhost/action.php 🧐
 
  • #120
evinda said:
No, it is http://localhost/action.php
It is correct then that it cannot find it. 🧐

We need to modify example.html so that it says action="cgi-bin/action.php". (Sweating)
 
  • #121
Klaas van Aarsen said:
It is correct then that it cannot find it. 🧐

We need to modify example.html so that it says action="cgi-bin/action.php". (Sweating)

I open again that localhost but it directed again to " http://localhost/action.php ".
Then I tried to run the html file from the htdocs I saved that earlier. Then it still doesn't show the result, but now I think it is linked to the correct directory.

The address I get in the browser is:
file:///C:/Users/evinda/Desktop/Apache/httpd-2.4.35/httpd-2.4.35-o102p-x86-vc14/Apache24/htdocs/cgi-bin/action.php

and the position of the file is:
C:\Users\evinda\Desktop\Apache\httpd-2.4.35\httpd-2.4.35-o102p-x86-vc14\Apache24\cgi-bin\action.php

Or is the problem that I get also "htdocs" before the "cgi-bin/action.php"? :unsure:
 
  • #122
evinda said:
I open again that localhost but it directed again to " http://localhost/action.php ".
Then I tried to run the html file from the htdocs I saved that earlier. Then it still doesn't show the result, but now I think it is linked to the correct directory.

Or is the problem that I get also "htdocs" before the "cgi-bin/action.php"?
Did you change example.html? :unsure:

It is indeed a problem that we get "htdocs" before "cgi-bin/action.php".
It is also a problem that we get a 'file://' address in the browser. A .php script cannot execute from a file:// address. It can only execute from an http address. 🧐
 
  • #123
Klaas van Aarsen said:
Did you change example.html? :unsure:

In example.html I have now:
Code:
<form action="cgi-bin/action.php" method="post">
 <p>Ihr Name: <input type="text" name="name" /></p>
 <p>Ihr Alter: <input type="text" name="alter" /></p>
 <p><input type="submit" /></p>
</form>
Klaas van Aarsen said:
It is indeed a problem that we get "htdocs" before "cgi-bin/action.php".
It is also a problem that we get a 'file://' address in the browser. A .php script cannot execute from a file:// address. It can only execute from an http address. 🧐

What do I have to change/fix for this problem? :unsure:
 
  • #124
evinda said:
In example.html I have now:

What do I have to change/fix for this problem?
What you have now is correct.
When you click the submit button, you should get http://localhost/cgi-bin/action.php instead of http://localhost/action.php in the address bar.
Do you get that? :unsure:
 
  • #125
Klaas van Aarsen said:
What you have now is correct.
When you click the submit button, you should get http://localhost/cgi-bin/action.php instead of http://localhost/action.php in the address bar.
Do you get that? :unsure:

Now I get:
1617517397413.png


:unsure:
 
  • #126
evinda said:
Now I get:
It suggests to check the error.log file.
What does it contain at the end now? (Wondering)
 
  • #127
Klaas van Aarsen said:
It suggests to check the error.log file.
What does it contain at the end now? (Wondering)

At the last lines I have:
Code:
[Sun Apr 04 09:19:26.215049 2021] [win32:error] [pid 15708:tid 1208] [client ::1:62075] AH02102: C:/Users/evinda/Desktop/Apache/httpd-2.4.35/httpd-2.4.35-o102p-x86-vc14/Apache24/cgi-bin/action.php is not executable; ensure interpreted scripts have "#!" or "'!" first line, referer: http://localhost/example.html
[Sun Apr 04 09:19:26.216044 2021] [cgi:error] [pid 15708:tid 1208] (9)Bad file descriptor: [client ::1:62075] AH01222: don't know how to spawn child process: C:/Users/evinda/Desktop/Apache/httpd-2.4.35/httpd-2.4.35-o102p-x86-vc14/Apache24/cgi-bin/action.php, referer: http://localhost/example.html
 
  • #128
evinda said:
At the last lines I have:
Code:
[Sun Apr 04 09:19:26.215049 2021] [win32:error] [pid 15708:tid 1208] [client ::1:62075] AH02102: C:/Users/evinda/Desktop/Apache/httpd-2.4.35/httpd-2.4.35-o102p-x86-vc14/Apache24/cgi-bin/action.php is not executable; ensure interpreted scripts have "#!" or "'!" first line, referer: http://localhost/example.html
[Sun Apr 04 09:19:26.216044 2021] [cgi:error] [pid 15708:tid 1208] (9)Bad file descriptor: [client ::1:62075] AH01222: don't know how to spawn child process: C:/Users/evinda/Desktop/Apache/httpd-2.4.35/httpd-2.4.35-o102p-x86-vc14/Apache24/cgi-bin/action.php, referer: http://localhost/example.html
We can find that it means that PHP is not enabled yet on Apache.
And it is not quite trivial to do so.
Instead of doing that, I propose that we install XAMPP instead.
It's a package bundle of Apache, MySQL, PHP, and Perl that is available for Windows.
It's here: https://sourceforge.net/projects/xampp/

Then everything will be configured for us, and we will only have to put example.html and action.php in the correct location again. 🤔
 
Last edited:
  • #129
Klaas van Aarsen said:
We can find that it means that PHP is not enabled yet on Apache.
And it is not quite trivial to do so.
Instead of doing that, I propose that we install XAMPP instead.
It's a package bundle of Apache, MySQL, PHP, and Perl that is available for Windows.
It's here: https://sourceforge.net/projects/xampp/

Then everything will be configured for us, and we will only have to put example.html and action.php in the correct location again. 🤔

I installed it! Do I save now the html and php files in the directory of XAMPP? :unsure:
 
  • #130
evinda said:
I installed it! Do I save now the html and php files in the directory of XAMPP?
Yep. (Nod)
It should also have an htdocs and cgi-bin directory.
 
  • #131
Klaas van Aarsen said:
Yep. (Nod)
It should also have an htdocs and cgi-bin directory.

I saved the files and I ran the html file and after submitting the data I get:
1617525272097.png


At the address there is again htdocs before cgi-bin. Is this correct? 🧐
 
  • #132
evinda said:
I saved the files and I ran the html file and after submitting the data I get:

At the address there is again htdocs before cgi-bin. Is this correct?
Nope. That is not correct. (Shake)
And it is not correct either that it refers to C:/xampp.
Perhaps you've opened C:/xampp/htdocs/example.html instead of http://localhost/example.html? (Wondering)
 
  • #133
Klaas van Aarsen said:
Nope. That is not correct. (Shake)
And it is not correct either that it refers to C:/xampp.
Perhaps you've opened C:/xampp/htdocs/example.html instead of http://localhost/example.html? (Wondering)

Yes, you are right. I opened it now http://localhost/example.html? and I get:

1617525983641.png
(Sweating) (Sweating) (Sweating)
 
  • #134
evinda said:
Yes, you are right. I opened it now http://localhost/example.html? and I get:
Well, at least it says at the bottom that we have a PHP server now, so that is good! ;)

What does the error.log file in the C:\xampp\logs directory show at the bottom? (Wondering)
 
  • #135
Klaas van Aarsen said:
Well, at least it says at the bottom that we have a PHP server now, so that is good! ;)

What does the error.log file in the C:\xampp\logs directory show at the bottom? (Wondering)

[Sun Apr 04 11:46:29.360215 2021] [win32:error] [pid 4540:tid 1872] [client ::1:63324] AH02102: C:/xampp/cgi-bin/action.php is not executable; ensure interpreted scripts have "#!" or "'!" first line
[Sun Apr 04 11:46:29.360215 2021] [cgi:error] [pid 4540:tid 1872] (9)Bad file descriptor: [client ::1:63324] AH01222: don't know how to spawn child process: C:/xampp/cgi-bin/action.php
 
  • #136
evinda said:
[Sun Apr 04 11:46:29.360215 2021] [win32:error] [pid 4540:tid 1872] [client ::1:63324] AH02102: C:/xampp/cgi-bin/action.php is not executable; ensure interpreted scripts have "#!" or "'!" first line
[Sun Apr 04 11:46:29.360215 2021] [cgi:error] [pid 4540:tid 1872] (9)Bad file descriptor: [client ::1:63324] AH01222: don't know how to spawn child process: C:/xampp/cgi-bin/action.php
I've noticed that there is an index.php file in the htdocs directory that does work.
So apparently we need to put the action.php file in the htdocs directory.
And we need to change the 'action' in example.html again to action="action.php". 🤔
 
  • #137
Klaas van Aarsen said:
I've noticed that there is an index.php file in the htdocs directory that does work.
So apparently we need to put the action.php file in the htdocs directory.
And we need to change the 'action' in example.html again to action="action.php". 🤔
It works now! (Blush) We have an other php file which is in the form:

Code:
<?php
$content = [
    "Phones" => [
        "filters" => ["Display",  "System"],
        "products" => [
            [
                "image" => [
                    "src" => "images/iphone-12.jpeg",
                    "width" => 150,
                    "height" => 200
                ],
                "title" => "Apple iPhone 12",
                "description" => ... ,
                "price" => 732
            ],
            [
                "image" => [
                    "src" => "images/galaxy-s21.jpeg",
                    "width" => 150,
                    "height" => 200
                ],
                "title" => "Samsung Galaxy S21",
                "description" => ... ,
                "price" => 709
            ]
        ]
    ] 
] 
?>

How do we use at the other php file the information of this array? Do we use something like "$file = file_get_contents('content.php');" ? 🧐
 
  • #138
evinda said:
We have an other php file which is in the form:

How do we use at the other php file the information of this array? Do we use something like "$file = file_get_contents('content.php');" ?
I believe we can do:
Code:
<?php
include 'content.php';
?>
in the other .php file.
Now we can use $content in the main php script. (Thinking)
 
Last edited:
  • #139
Klaas van Aarsen said:
I believe we can do:
Code:
<?php
include 'content.php';
?>
in the other .php file.
Now we can use $content in the main php script. (Thinking)

So in the main php file I write

Code:
<?php
include 'content.php';
?>

so that we can use the content of the file content.php? And when we want to refer to an element of that array do I call it $content? 🧐
 
Last edited:
  • #140
evinda said:
So in the main php file I write

so that we can use the content of the file content.php? And when we want to refer to αν element of that array do I call it $content?
$content is an array and we can access the elements in it yes. (Thinking)
 

Similar threads

  • Programming and Computer Science
Replies
3
Views
1K
  • Programming and Computer Science
Replies
4
Views
754
  • Programming and Computer Science
Replies
11
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
22
Views
1K
  • Programming and Computer Science
Replies
7
Views
2K
  • Art, Music, History, and Linguistics
Replies
21
Views
1K
  • Programming and Computer Science
3
Replies
81
Views
5K
Replies
3
Views
1K
  • Programming and Computer Science
Replies
4
Views
6K
  • Programming and Computer Science
Replies
4
Views
2K
Back
Top