For Dummies problem

August 29, 2008

<!– /* Font Definitions */ @font-face {font-family:”Cambria Math”; panose-1:2 4 5 3 5 4 6 3 2 4; mso-font-charset:0; mso-generic-font-family:roman; mso-font-pitch:variable; mso-font-signature:-1610611985 1107304683 0 0 159 0;} @font-face {font-family:Calibri; panose-1:2 15 5 2 2 2 4 3 2 4; mso-font-charset:0; mso-generic-font-family:swiss; mso-font-pitch:variable; mso-font-signature:-1610611985 1073750139 0 0 159 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-unhide:no; mso-style-qformat:yes; mso-style-parent:”"; margin-top:0cm; margin-right:0cm; margin-bottom:10.0pt; margin-left:0cm; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:”Calibri”,”sans-serif”; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:Calibri; mso-fareast-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:”Times New Roman”; mso-bidi-theme-font:minor-bidi; mso-fareast-language:EN-US;} .MsoChpDefault {mso-style-type:export-only; mso-default-props:yes; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:Calibri; mso-fareast-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:”Times New Roman”; mso-bidi-theme-font:minor-bidi; mso-fareast-language:EN-US;} .MsoPapDefault {mso-style-type:export-only; margin-bottom:10.0pt; line-height:115%;} @page Section1 {size:595.3pt 841.9pt; margin:72.0pt 72.0pt 72.0pt 72.0pt; mso-header-margin:35.4pt; mso-footer-margin:35.4pt; mso-paper-source:0;} div.Section1 {page:Section1;} –>
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:”Table Normal”;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-qformat:yes;
mso-style-parent:”";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin-top:0cm;
mso-para-margin-right:0cm;
mso-para-margin-bottom:10.0pt;
mso-para-margin-left:0cm;
line-height:115%;
mso-pagination:widow-orphan;
font-size:11.0pt;
font-family:”Calibri”,”sans-serif”;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:”Times New Roman”;
mso-fareast-theme-font:minor-fareast;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;}

Problems found whilst working with PHP & MySQL for Dummies 3rd Edition.

In section about testing the PHP the code given doesn’t uite work (maybe it is just my PC, who knows). The code given is as follows:

<html>

<head>

<title>PHP Test</title>

</head>

<body>

<p>This is an HTML line

<p>

<?php

echo “This is a PHP line”;

phpinfo();

?>

</body></html>

You’ll notice that there are double quotation marks where it says echo “This is a PHP line”; change to singles like this echo ‘This is a PHP line’; Simple but bloody annoying when it doesn’t work and you have to try and figure out why. The error it returns doesn’t even relate to that minor alteration. I suspect I will have the same problem with testing MySQL, let’s see.

Yep, exactly the same problem. Replace all “ with ‘.

So, who’s the dummy?

Apache Virtual Host Problem

August 29, 2008

<!– /* Font Definitions */ @font-face {font-family:”Cambria Math”; panose-1:2 4 5 3 5 4 6 3 2 4; mso-font-charset:0; mso-generic-font-family:roman; mso-font-pitch:variable; mso-font-signature:-1610611985 1107304683 0 0 159 0;} @font-face {font-family:Calibri; panose-1:2 15 5 2 2 2 4 3 2 4; mso-font-charset:0; mso-generic-font-family:swiss; mso-font-pitch:variable; mso-font-signature:-1610611985 1073750139 0 0 159 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-unhide:no; mso-style-qformat:yes; mso-style-parent:”"; margin-top:0cm; margin-right:0cm; margin-bottom:10.0pt; margin-left:0cm; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:”Calibri”,”sans-serif”; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:Calibri; mso-fareast-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:”Times New Roman”; mso-bidi-theme-font:minor-bidi; mso-fareast-language:EN-US;} a:link, span.MsoHyperlink {mso-style-priority:99; color:blue; mso-themecolor:hyperlink; text-decoration:underline; text-underline:single;} a:visited, span.MsoHyperlinkFollowed {mso-style-noshow:yes; mso-style-priority:99; color:purple; mso-themecolor:followedhyperlink; text-decoration:underline; text-underline:single;} .MsoChpDefault {mso-style-type:export-only; mso-default-props:yes; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:Calibri; mso-fareast-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:”Times New Roman”; mso-bidi-theme-font:minor-bidi; mso-fareast-language:EN-US;} .MsoPapDefault {mso-style-type:export-only; margin-bottom:10.0pt; line-height:115%;} @page Section1 {size:595.3pt 841.9pt; margin:72.0pt 72.0pt 72.0pt 72.0pt; mso-header-margin:35.4pt; mso-footer-margin:35.4pt; mso-paper-source:0;} div.Section1 {page:Section1;} –>
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:”Table Normal”;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-qformat:yes;
mso-style-parent:”";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin-top:0cm;
mso-para-margin-right:0cm;
mso-para-margin-bottom:10.0pt;
mso-para-margin-left:0cm;
line-height:115%;
mso-pagination:widow-orphan;
font-size:11.0pt;
font-family:”Calibri”,”sans-serif”;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:”Times New Roman”;
mso-fareast-theme-font:minor-fareast;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;}

If you are new to the Apache Server, you ay have been experiencing the same problems that I did when first downloading it and attempting to work with it. By now you have probably been through various tutorials and are now pulling out your hair. Each and every one tells you to do this and that and they are all relatively the same, but what happens when you follow it all step by step? Bugger all.

The first thing I attempted was to download Apache 2.2.9…it just didn’t want to work when I did the http://localhost/ or http://127.0.0.1/ test. So, I got rid of that and downloaded the latest XAMPP from Apache Friends, installed it and voila, it worked first time.

However, my troubles didn’t end there, but I must admit there was some fun amongst the frustration, especially when I finally sorted out all the problems. When I tried to set up a virtual hot it started giving me errors. I had followed all the tutorials and done exactly what they said. I then decided to bugger around with it myself and I adjusted some of the script in the httpd.conf file itself (i.e. added the virtual host there as opposed to the httpd-vhosts.conf file). It worked….but not quite. Although I could see the website I was directing my browser to, it made that site the default, therefore, no matter how many more hosts I added every address went to that one site, and localhost wasn’t working anymore. So, after about 4 or so days I tried the internet again and went searching for yet another tutorial, the idea being to compare the slight differences that were given and see where the truth was lying. I came across a tutorial (unfortunately I don’t have the url anymore) that made a change to the slashes which was completely opposed to all the other tutorial sites. Instead of the Document Path reading with forward slashes (/) it used backslashes (\). So, I tried it, it worked and amazingly enough is still working.

So, to help you along in case you are having the sme problem is moi, here is the code to use. Also, open the httpd-vhosts.conf file in the apache/conf/extras folder and delete everything in there, then copy and paste the following:

NameVirtualHost 127.0.0.1:80

<VirtualHost 127.0.0.1:80>
DocumentRoot C:/xampp/htdocs/
ServerName localhost
</VirtualHost>

You can try the * instead of the IP address (this being your local computer) if you like and as suggested in most places. I left everything as it was because it is working, not changing it now.

After that, the above defining the localhost, insert the following text, changing the necessary places (those being in bold):

<VirtualHost example.com>
DocumentRoot “C:\Path\to\the\Files\example.com
ServerName example.com

CustomLog “ C:\Path\to\the\Files\example.com.access.log” combined
ErrorLog “ C:\Path\to\the\Files\example.com.error.log”

<Directory “C:\Path\to\the\Files\example.com “>
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

Let me know if this helped or if it just made things a whole lot worse.


Follow

Get every new post delivered to your Inbox.