Archive for the ‘php’ Category

Ubuntu blows me away

December 21, 2009

Ubuntu 9.10 simply blows me away with its speed and elegance (and so reasonably priced). It took me a total of 50 or 60 hours experimenting, first with Wubi installs on top of Windows, and then with a pure Ubuntu install on a 280 gig
Gateway. I took detailed notes at my WordPress blog. Anyone with those notes should be able to install it in 5 hours or less. Firefox is amazing on Ubuntu. There is a multi platform Instant Message program (Yahoo, AIM, ICQ, MSN, etc), an email client, an IRC client (Konverse) which lands you in a Kubuntu channel with dozens of specialty rooms and hundreds of people on line around the world. The only think it cant do yet, which I like, is Paltalk. Ubuntu updates are far smoother, more automated, less in your face, less annoying than Windows updates. I tried out Ubuntu because I finally had a spare machine I could afford to ruin. I felt if I did succeed in installing Ubuntu, that it would be very primitive and user unfriendly. It is very user friendly with lots of GUI interfaces.
You do not have to be some C++ wizard or know shell and bash commands. You CAN do all that if you know how, but you don’t NEED to to use it. And you get Open Office for spreadsheet, word processor and presentation manager. If more apps become CLOUD based, then you will do everything in your browser, and all apps and data will be on some remote server.

2nd Attempt Ubuntu Multiple Local Sites Apache2

December 2, 2009

Note, my user name is always bryan, because he gave me his old machine, with a password on it, so I just keep everything the same, for convenience.

Step 1:
Terminal
sudo chown bryan /var/www

Step 2: having given myself rights with that above chown command
I should be able to create folders withing /var/www
e.g. /var/www/proj1

and then invoke the 1st pg of the application by typing into the browser

localhost/proj1/report.html

I shall test this, and place the exercises from Head First PHP MySQL into a folder /var/www/proj1 and see if the exercise works

The only question that remains in my mind is whether the exercise pages will work unchanges, honoring /var/www/proj1 as the root, or whether I need to issue some other command to MAKE proj1 the default directory, or whether I have to hard code paths into all the exercise pages, which, if I do, would kind of defeat the purpose of developing a project in a folder, and then transparently moving it to some other location.

What follows is the raw text from the IRC channel where I asked my questions. I sorted through it to come up with the above, step-by-step procedure to achieve my goals.

+++ the steps WORK AND here is my email feedback to the person that gave me the valuable guidance:

You saved me HOURS of grief, and made it possible for me to now make rapid progress with my HEAD FIRST book. And Yes, I want to pay $60 for the paperback, because I want to be able to take it in the bathroom or on the subway. I want to really let all this PHP MySQL stuff sink in, and become second nature, for the simple reason that I am sick and tired of years of bondage to Micr0$oft and products like Access (or worse VISUAL FOXPRO which they finally dropped as a supported product). I figure that php mysql apache is the best choice for me, because I can kind of understand whats going on, and there is tons of documentation to make it work, but forum and IRC support (like YOUR excellent patient help).

You are CORRECT, THAT YOU did tell me what I need to know, but you did not realize that as a beginner, I cannot recognize the right answer UNTIL certain concepts sink in. Once I did the CHOWN trick you showed me, then I could navigate with the GUI, to /var/www and create a folder, proj1. Then I could navigate to my Desktop to a folder where I put two of the Head First exercises, but with the word TEST inserted in each field, so I would KNOW that it was these executing, and that I was not somehow executing the same original pages in /var/www . Now, I could NOT get Desktop/testwww/report.html to run and then correctly post with report.php and see the added record in the MySQL database with phpmyadmin.

BUT, as soon as it dawned upon me the simple steps you were saying, I copied to cloned files to /var/www/proj1 went to my folder and entered localhost/report.html, actually SAW the cloned version come up with TEST prefixed to each field, I entered data prefixed by TEST so I would see it in the mysql table,… pressed submit, and BINGO, when I did localhost/phpmyadmin and signed in, there was the new record in the sql table.

SO, you see, for a beginner, the Head First book leaves out a VERY IMPORTANT CONCEPT, about creating folders for projects in /var/www and doing the CHOWN trick once, up front, to allow access.

THANKS! And, as you will notice from my blog, when I asked the same question in IRC last week, someone thought that I wanted to do that
http://www.debian-administration.org/articles/412 complex business (which was CORRECT, if I wanted to access separate projects from some remote client, BUT unnecessary for my simple desktop purposes).

And here is the RAW irc chat to illustrate what a beginner may have to do to sort out the proper answers from a technically savvy person trying to help.
++++++++++++++++++++++++++++++

I am trying to set up several websites on my desktop ubuntu under Apache 2, and I have a detailed tutorial, but it says I need my IP address, but

sudo ipconfig gives me an internal, and

whatismyip.com gives me an external, any clues as to which is required, thanks

[04:08] WilliamBuell: what IP address? where do you want to reach them from?

(the answer, as it turns out, which I did not make clear to the IRC channel, is that I only want to make this stuff work from my DESKTOP, not from some remote client on the internet, which might require some ip address)

[04:08] thanks I am following this excellent tutorial on apache2 multiple sites

http://www.debian-administration.org/articles/412

[04:09] I have Ubuntu desktop with LAMP installed, but can only get php pages to work in /var/www

[04:09] I want to be able to have several projects i.e /home/proj1

[04:09] WilliamBuell: that’s where they should go

[04:09] why not put them in /var/www?

(this turns out to be an EXCELLENT QUESTION!)

[04:10] the tutorial mentions IP address but does not indicate whether it is EXTERNAL from whatismyip.com or local from

sudo ifconfig

[04:10] BECAUSE I would need a different name for each html and php page

[04:10] WilliamBuell: where are you trying to access them from? you shouldn’t need an ip address at all most likely

[04:11] suppose I am following several tutorials, with several pages with same name, they cannot BOTH be in /var/www

[04:11] why not /var/www/proj1, /var/www/proj2?

[04:11] and i dont know how to access some search path that would support /var/www/proj1

[04:12] or does apache2 lamp automatically honor any folder within www

[04:12] yes, automatically http://localhost/folder

(above is the KEY CONCEPT that I needed)

[04:12] and, if so (i am total beginner) ….

aha…. localhost/folder seems to make sense to me

[04:13] next question in TERMINAL does it matter HOW i create those folders, i mean do i have to be sudo or root

[04:13] do permissions matter?

[04:13] what would the proper command be to create the folder in /var/www would it be mkdir /home/www/www.example.com
[04:14] with sudo mkdir /home/www/www.example.com

[04:14] except it would be sudo mkdir /var/www/www.example.com

[04:14] if i follow along with this one tutorial

[04:15] but that tutorial is talking about MULTIPLENAMEHOST

[04:15] WilliamBuell: you can cheat and do sudo chown USER /var/www

( the above is the OTHER KEY CONCEPT that I require.. and if it works, then I can navigate in a GUI file folder system and create project folders at will, without fussing with sudo permissions)

[04:15] it sounds like you are saying if I simply create a folder in /var/www/proj1 that it will work from localhost/proj1

[04:15] WilliamBuell: only on a desktop though
[04:16] WilliamBuell: correct

[04:16] i am a 60 year old total beginner, so i dont need hints like “you can cheat” I am truly lost

[04:17] so i should say from TERMINAL sudo chown bryan /var/www but… HOW DO I MAKE THE FOLDER PROJ1
[04:17] i mean the chown command is changing rights or something

[04:17] chown changes the ownership of the file
[04:17] nothing else

[04:17] WilliamBuell: oh, one you own the folder, you can go into /var/www and make whatever you want :)

[04:18] in other words, from terminal, what is the command to correctly creat /var/www/proj1 with all the proper user rights for apache2 to work

[04:18] BUT, whenever i go into /var/www it doesnt let me do stuff i dont think unless i am root admin

[04:18] WilliamBuell: the support here is not too great… might want to try a support channel

[04:18] WilliamBuell: yeah, that’s why I suggested owning the folder

[04:18] yeah, but you guys know this like the back of your hand

[04:19] once you do that, you can mkdir in /var/www all you wnat

[04:19] and you just cant give a beginner the command to create the folder

[04:19] WilliamBuell: if we did we would have told you straight away

[04:19] so, you say , create the folder, and then use chown to change ownership?
[04:19] and then everything will be honkey dory ok

[04:19] WilliamBuell: no, chown /var/www, then you can create all the folders you want without sudo

[04:21] ok so sudo chown bryan /var/www gives me the rights, then i should be able to navigate with the gui and create proj1

[04:21] WilliamBuell: yep :)

[04:21] aha… now that is making sense to this beginner brain
[04:22] and i WONT need to mess with that other tutorial
[04:22] since i only want stuff to work locally…

[04:22] WilliamBuell: right no apache configs :)

[04:23] BUT, second question,…. if i make a bunch of php html pages in /var/www/proj1 do I need explicit paths to the other pages, or will they default to that local directory

[04:23] and is there some command i need to issue to make /var/www/proj1 a local directory for that session

[04:23] WilliamBuell: not sure I’m following

[04:23] WilliamBuell: not sure you’re sure what you’re asking
[04:24] http://localhost basically loads what’s in /var/www

[04:24] ok… you are telling me if i do all this then from browser .. i type localhost/proj1/report.html and it comes up

[04:24] yep

[04:24] but INSIDE report.html it is going to POST to report.php

[04:24] if you have /var/www/proj1/report.html

[04:24] yeah, default is current folder

[04:24] but, it will know enough to look in var/www/proj1 without
[04:25] well, it looks in http://localhost/proj1/report.php
[04:25] or rather posts to

[04:25] aha, and the very act of launching the project as localhost/proj1 is sufficient to make that the local directory for the entier project session

[04:25] which should correspond to /var/www/proj1/report.php
[04:25] if so, that makes sense

[04:25] WilliamBuell: not sure you quite get URL vs local path
[04:25] it’s not for the session

[04:25] in other words, i dont have to HARD CODE specific addresses in each html and php…

[04:26] that’s just how it it

[04:26] WilliamBuell: that you have to do
[04:26] i want to develop something in /var/www/proj1 test it , but have it work if i move it somewhere else

[04:26] WilliamBuell: why not just have a .php file?
[04:26] why have anything .html?

[04:26] well, i dont know enough to understand your hint

[04:26] WilliamBuell: a PHP file can have HTML and PHP in it

[04:27] because, the tutorial book i am following starts with report.html posting with report.php… but now i see what you are saying

[04:27] WilliamBuell: what book?

[04:27] but, php or html, is not germain to my path question at hand

[04:27] it is a great book called HEAD FIRST php mysql, which leads you step by step, including cookie sessions

[04:28] i have in my blog links to the book

[04:28] i am buying the book for $60 tomorrow, and i already downloaded a zip file of all the source code exercises from the publisher

[04:29] WilliamBuell: do you have any programming background and are you interested in mysql>??

[04:29] i started programming in 1979, through the 1980s, with stuff like cobol, rpg, then basic, then pick

[04:29] WilliamBuell: BTW, you know you can get it as an ebook for $36

[04:29] i am not a moron

[04:30] i just have some simple questions which in reality have very simple answers, but getting straight answers from techie types is like pulling teeth
[04:31] WilliamBuell: do you like head first series?

Sending Email from PHP in Ubuntu Desktop

November 28, 2009

http://ubuntuforums.org/showthread.php?t=135397

Re: Path of Sendmail
Open synaptic and search for sendmail. Then install it from there.

Sendmail will then be found in /usr/sbin/sendmail

; For Win32 only.
;sendmail_from = me@localhost.com

; For Unix only. You may supply arguments as well (default: “sendmail -t -i”).
sendmail_path = /usr/sbin/sendmail -t -i

or possibly:
sendmail_path = /usr/sbin/sendmail -i -t
or
sendmail_path = /usr/lib/sendmail -i -t

MY PHP.INI file is located in /etc/php5/apache2

I go into TERMINAL and type

sudo gedit
It prompts me for the root password
and then I am in gedit with superadmin rights and I can navigate to the php.ini file and change it. The very first thing I ever did was to open php.ini and do SAVE AS to original.php.ini so I can always revert back to the default.

http://ubuntuforums.org/showthread.php?t=331137

NOTE: THE synaptic mgr install of POSTFIX will remove SENDMAIL.
what worked for me was:
apt-get install postfix

and then edit php.ini
Relevant lines in /etc/php5/apache2/php.ini:

[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25

; For Win32 only.
;sendmail_from = me@example.com

; For Unix only. You may supply arguments as well (default: “sendmail -t -i”).
sendmail_path = /usr/sbin/sendmail -t -i

and edited /etc/postfix/main.cf and put my correct external smtp server
relayhost = smtpauth.earthlink.net

restart the services that had configuration changes

During the postfix installation, I chose the Internet Configuration. If you hover the mouse over the choice field, a tool tip will explain all the choices. I noticed that it offered me bryan-desktop as a name for the system, so I stuck with that, since it might be required, and I have no idea how to find the name of my system.

Now all I need to do is TERMINAL sudo gedit

and edited /etc/postfix/main.cf and put my correct external smtp server
example – relayhost = smtpauth.earthlink.net

(but mine will I THINK be smpt.gmail.com

restart the services that had configuration changes

OF COURSE, the first thing I do when I gedit main.cf is to
SAVE AS original.main.cf, close, and reopen main.cf

When I make the above mentioned chage to the file, I find:

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

AND HERE IS WHAT I FIND IN THE README FILE, NONE OF WHICH SEEMS VERY HELPFUL:

There are some significant differences between the Debian Postfix packages,
and the source from upstream:

1. The Debian install is chrooted by default.
2. Dynamically loadable map support.
3. For policy reasons:
a. SASL configuration goes in /etc/postfix/sasl
b. myhostname=/path/to/file is supported (and used) in main.cf
4. smtp_line_length_limit defaults to 0, instead of 990, in absolute
violation of the RFC. Note that mailers in the path will still
potentially split the line, though. This will be removed at some
point in the future.
5. IPV6 support is enabled: postfix listens on ipv6/ipv4 by default,
(see: inet_protocols)
6. TLS/SASL support is enabled.
7. rmail comes from sendmail, not from postfix.
8. The upstream main.cf is delivered as /usr/share/postfix/main.cf.dist,
rather than cluttering /etc/postfix/main.cf with comments.

Known caveats:
1. The dynamically loadable modules are not found in the chroot.
Therefore, proxy maps may require you to copy the appropriate shared
object into the chroot if you chroot the proxy service in master.cf.
2. Some map types (and SASL support) require some extra configuration
(beyond what upstream indicates) to run inside the chroot. The simplest
solution for the maps is to use the proxy service, which is not chrooted.
SASL is a bit more complex, and is on the TODO list…
3. Note that the chrooted daemons open /dev/log before chrooting, so if your
syslog daemon is restarted, the daemons will be unable to reconnect to the
syslog socket, and hence being unable to log. The postfix package provides
a config snipped for the rsyslog daemon in /etc/rsyslog.d/postfix.conf to
also open a socket in /var/log/postfix/dev. For other syslog daemons, you
will also have to restart postfix after restarting the syslog daemon, or
configure it to open an additional socket.
a. For sysklogd (the default in Debian versions prior to Lenny), add
SYSLOG=”-a /var/spool/postfix/dev/log” to /etc/default/syslog.
b. For inetutils-syslogd, add SYSLOGD_OPTS=”-a /var/spool/postfix/dev/log” to
/etc/default/inetutils-syslogd.

HERE IS A LINK THAT LOOKS MORE HELPFUL

http://behindmyscreen.newsvine.com/_news/2006/12/31/501615-configuringubuntu-postfix-and-gmail-in-101-easy-steps

Ubuntu Apache Path Question

November 28, 2009

I successfully installed LAMP (see another blog post here for details).

I KNOW that I can place files in /var/www such as .html and .php and .css and those files will be found and executed whenever I launch the browser and type localhost/report.html (i.e. if report.html is in /var/www it will run, and if it calles report.php and that file is in /var/www it will execute.

HERE IS MY QUESTION:

Suppost I want to have different folders holding different applications. What do I need to do to guarantee that Apache and PhP and MySQL will execute properly when invoked by files in a different folder.

I did find THIS in google:

There’s a ‘doc_root = ‘ in php.ini.
There’s also ‘DocumentRoot “drive:/path/”‘, ‘

and ‘DirectoryIndex index.html index.php otherfile.ext’ in the
httpd.

Does that mean that I should simply edit php.ini and put a search path?

SOMEONE IN KUBUNTU IRC CHANNEL told me I should google. Then they said they do not know too much but it is probably in php.ini which is a well documented file, so I took a second look and found:

;;;;;;;;;;;;;;;;;;;
; About php.ini ;
;;;;;;;;;;;;;;;;;;;
; This file controls many aspects of PHP’s behavior. In order for PHP to
; read it, it must be named ‘php.ini’. PHP looks for it in the current
; working directory, in the path designated by the environment variable
; PHPRC, and in the path that was defined in compile time (in that order).
; Under Windows, the compile-time path is the Windows directory. The
; path in which the php.ini file is looked for can be overridden using
; the -c argument in command line mode.

THIS LEADS ME TO BELIEVE THAT IF IN TERMINAL I issue cd /Desktop/testwww that perhaps that becomes the “current directory” and hence, in the browser, issuing the localhost/report.html would now look in that current directory. I will test out this theory.

I AM MAKING SLIGHT PROGRESS, because I created on Desktop testwww and I discover that the following link in the browser will open a copy of my file

file:///home/bryan/Desktop/testwww/report.html

so now all I need to do is copy the php there and see if it executes ok.

So far, it does not seem to work!?

[22:59] WilliamBuell: Aye; you want to go to /etc/apache2/sites-enabled/
[22:59] MenZa: that does sound familiar
[22:59] WilliamBuell: Create a config file, i.e. blah.domain.conf
[23:00] WilliamBuell: I’ll give you one of my config entries so you have something to work with

<VirtualHost *:80>
DocumentRoot "/var/www/projects.lassehavelund"
ServerName projects.lassehavelund.com
<Directory "/var/www/projects.lassehavelund">
allow from all
Options +Indexes
</Directory>
</VirtualHost>

Installing LAMP on Ubuntu

November 18, 2009

I worked 20 hours straight to prepare an old Gateway tower with 280 gig drive for an Ubuntu 9.10 install. The Gateway was hopelessly unbootable in Windows because of some operating system problem (not hardware problem). I realized that I should drop down to C: and type format, to just reformat the entire drive which took about 30 minutes. I forgot that I should have typed FDISK first, to set up the necessary partitions, but it was too late.

I downloaded an ISO image for GNOME partition and burned it to a bootable CD.

I booted the GNOME partition utility. It took me literally hours to guess at what I should do.

Finally I realized that Ubuntu expects THREE partitions. The first is referred to as ROOT but the actual name you give it in the partition process is simpl “/” (forward slash omitting the double quotes).

The second partition will have NO name, but you will designate its format TYPE as swapfile, and that will become the system swap file.
The third partition is called /home.

I had no idea how much space to allocate, so I gave 512 for root and 512 for swap, and the huge remainder for /home.

The software warned me that root and swap were too small. Just for the heck of it, I changed root and swap to 5000, and it worked.

Then it took me dozens of tries installing Ubuntu. I had a 2008 Ubuntu disc and a 9.10 disc I had created last week. Time after time, I would boot from each one, say INSTALL UBUNTU, and it would chug away for a long time, and then die with no messages. FINALLY, but why or how I dont know, the 9.10 unstall brought up an Ubuntu desktop with what looked like all kinds of error messages. There were TWO icons on the desktop which I had never seen before. One said EXAMPLES which I never looked at. I was about to give up in dispair when I decided to click on the icon marked Ubuntu. AS IT TURNS OUT, that is the icon which COMPLETES the install process, and it first brings you into its OWN partition software. I cant exactly remember what I did next. I do remember that GNOME partition utility offered me literally 20 DIFFERENT format types to choose from for each partition (one of which is swap-file). I had no clue what to choose. I did some google searching on my other machine (and you NEED a windows machine attached to the internet to look these things up). I discovered that format type ext3 is good for Debian Linux (and Ubuntu is a flavor of Debian) so I went with ext3.

Finally, I had a working bootable pure Ubuntu 9.10 machine.

My next Sisyphean agony task was to connect it to the Internet. The tower already had an Ethernet card. I was informed that IF I connected a cable from the ethernet to the router, then Ubuntu would automatically sense the ethernet connection and configure it. The ethernet board DID light up and pulse when I connected the cable to my Westell router. But Ubuntu never recognized it. Later I read that only certain ethernet cards will be automatically recognized, so I guess the one in my tower was not a compatible one. My next choice was to try and get my Belkin USB WiFi adapter working. I went to ADMINISTRATION -> SYNAPTIC PACKAGE MANAGER and keyed ndiswrapper into the search. I was prompted to place the Ubuntu install cd into my drive. It kept giving me errors. I placed my Belkin adapter install cd in the drive and looked around for the ini driver file, but could not see it. Finally, out of despair, I plugged the Belkin wifi adapter into the USB and LIKE MAGIC Ubuntu recognized it, asked me to choose a connection and enter the WEP key, which I have now done many times with other machines and during the Wubi Ubuntu install on Windows. So now I had a working Ubuntu machine connected to the Internet.

I went to J&R computer store up the street and found a $10 USB 4 gig memory stick by http://www.dane-elec.com which is REALLY cheap. I recently discovered that the Sancor memory sticks that I love actually have a lot of SOFTWARE on them, which only works under windows, AND if you have a password set on the device, then Ubuntu wont even read it.

I had to go into synaptic manager and search on usb for some installs. Again, it was trial and error, and I dont know what finally made it work, but finally, Ubuntu recognized the memory stick.

TODAY, I had to meet my step-son near at Borders Book Store next to Penn Station. This was lucky for me, because while I waited for him, I browsed the computer book section on the second floor. I found a $9 small Linux handbook reference of commands by Daniel J. Barrett (O Reilly publishers) so I got that to practice all the hundreds of Linux commands that I dont know but need to know.

I browse various books on Ubuntu and Mysql.

I found the key thing I needed to know for my next project, to install LAMP (Linux Apache MySQL PhP) on my new Ubuntu desktop.

All one needs to do is enter TERMINAL, and key in

sudo tasksel

(you will be prompted for your system password next)

A task selection window will pop up with many packages available for install, one of which is LAMP. Now here is a mystery that took me an hour to solve. You can arrow down to highlight LAMP, but you dont have a clue in the world as to how to CHECK it for install. Google revealed the secret: YOU SIMPLY PRESS THE SPACE BAR AND IT IS MARKED CHECKED FOR INSTALL. Then you press ENTER and the install proceeds, Apache, MySQL and PhP. You will be prompted for the MySQL admin password.

Next I wanted to install phpmyadmin to administrate mysql, creating databases, tables, etc. I went to SYSTEM-> Synaptic Manager and searched on phpmyadmin. I think there is only one. BUT HERE IS A SECRET. Once your LAMP install finishes, then power down and boot back up; otherwise, certain files will remain locked by processes and the phpmyadmin install will fail.

Once phpmyadmin installs (and you will again be prompted for that pesky password), then you can open firefox and key in http://localhost/phpmyadmin

You will be PROMPTED FOR A USER NAME AND PASSWORD. This is tricky and confusing. You have to key in the user name “root” without quotes, and then give the password that you have been using all along throughout this. Now you are in phpmyadmin, and you can go to Privileges, and create a new user and give him all possible privileges.

Then, I found a $50 book, also by O’Reilly, entitled
“Head First – PHP & MySQL”. THIS book looks like the perfect way to teach myself how to develop php mysql applications which will have proper security (which is a very complex topic).

I didnt purchase that book tonight, because I wanted to come home and see first if I could successfully install LAMP and phpmyadmin, which I just now finished.

The Head First book gave me links to try the book on line free for 45 days. Money is kind of tight, so I decided to see how far I can go without any additional purchases, but if I get things working, I will buy the book one day. It is interesting that O’Reilly also offers a link to an on line university which can grant degrees in computer science.

I signed up at Oreilly for a trial access of the electronic version of the above-mentioned book.

Here is something I tried which crashed my Ubuntu. I wanted to copy the introduction to the book, from the OReilly site, and PASTE it into an Open Office Document. The first time Open Office died, and the file was shown as requiring recovery. I did the recovery, opened it again with Open Office Document, and then the whole Ubuntu system crashed. I rebooted, and had to go through a long complicated reconstruct procedure. I thought perhaps I would have to install everything from scratch, but fortunately, Ubuntu repaired itself. Moral to story is paste into GEDIT and save, which I guess eliminates whatever hidden characters are in the webpage which cause Open Office to crash the system.

There, I found a link to download all the source code from the book.

I downloaded the zipped file of all the source code.

Next, I went to the source code for chapter 1. They have a beginning version (which I guess you make changes to, and then a final version).

I tried to copy and paste report.html to var/www which is where Apache wants to find pages loaded from local host. I was not allowed to paste because I do not have superuser privileges. So, I went to terminal and typed SUDO GEDIT, which gets me into gedit with super powers, so I can now navigate to the unzipped code in my DOCUMENTS in a special folder I created, open report.html, then do a save as to var/www.

THIS WORKED, because now, when I open Firefox and key in localhost/report , it runs the Chapter 1 example webpage.

FOR MY NEXT TRICK, I must figure out how to copy a chapter 1 tutorial image of a dog (fang.jpg) from the location where it unzipped (in a folder in my Documents) and copy it into var/www where I do not have Admin privileges. SO, I open my OReilly handbook of Linux commands and find the CP command. I open a TERMINAL session and key in SUDO CP which I know will executed it with super admin privileges, but NOW I do not have a clue as to what the PATH names are for the file source and destination.

I am permitted to copy fang.jpg from the unzipped file into DOCUMENTS, just to simplify things.

Using PLACES -> COMPUTER, which brings up the FILE BROWSER, I first navigate to home/Documents and I RIGHT CLICK on the fang.jpg image, and click on PROPERTIES which will SHOW ME that the path is
/home/bryan/Documents/fang.jpg (I use bryan as my user name, but that is my step-son’s name). Next I do the same right click trick on any file which is already in var/www such as report.html, and I discover THAT path, which tells me that the command I should issue in TERMINAL is

sudo cp /home/bryan/Documents/fang.jpg var/www/fang.jpg

BUT IT HANGS… NOTHING HAPPENS.

Then I realize that I should close my other applications, because they are somehow LOCKING UP something that the CP command needs. Sure enough, once I close a bunch of applications, the SUDO CP command asks me for the PASSWORD and then copies fang.jpg to var/www

I can now bring up the image by opening Firefox and typing

localhost/fang.jpg

into the browser address field.

NOW that fang.jpg is in var/www, if I once again open Firefox and type
localhost/report.html

the exercise 1 page loads and also shows the picture of the little dog fang.jpg

I still need to copy report.php and style.css from the place where they unzipped to var/www. Since I can launch gedit with sudo and have superadmin powers, I may open them in that fashion and do a save as.

I ran the finished example, hoping that it would actually send me an email.

I realized that I must examine my php.ini and somehow reconfigure it. I went to some pains to locate that file, but did not post notes as I went, and now I must reconstruct what I did. I still have not succeeded in getting the app to actually send an email through php. But I feel it is more essential for me to move on to other lessons in the HEAD FIRST book.


Follow

Get every new post delivered to your Inbox.