IntroductionWelcome| 00:04 | Hi! I'm David Gassner.
| | 00:05 | I'd like to welcome you to this newly
updated course, Installing Apache, MySQL and PHP.
| | 00:12 | The lynda.com online training library
offers many training courses that depend
| | 00:18 | on a local installation of
what's commonly known as an AMP Stack.
| | 00:22 | In this video series, I'll describe a
number of ways to get started with a local
| | 00:27 | AMP Installation on both Windows and Mac OS X.
| | 00:31 | I'll show how to use the separate
components from the vendors who manage
| | 00:34 | these software packages.
| | 00:36 | I'll also show you some easier ways to
get started with free software bundles
| | 00:40 | such as WampServer, MAMP, XAMPP and BitNami.
| | 00:45 | I'll describe how to
configure Apache for use on Windows 8,
| | 00:50 | and I'll offer some troubleshooting tips,
describing the issues that are reported
| | 00:54 | most commonly by our members.
| | 00:56 | We're going to continue to keep
this course up-to-date as these
| | 00:59 | software products evolve.
| | 01:01 | I hope the course helps you get
started quickly and easily with Apache,
| | 01:05 | MySQL and PHP.
| | Collapse this transcript |
| Understanding Apache, MySQL, and PHP| 00:00 | If you're new to the world of Apache,
MySQL and PHP, or if you're trying to
| | 00:05 | figure out what's the best way to
install these software products on your local
| | 00:09 | disk, it's worth taking a few moments
to review how these software products
| | 00:13 | work together to support a web application.
| | 00:17 | Web-based applications are sometimes
known as multi-tier applications, that's
| | 00:22 | because they're built with multiple
software products or multiple tiers.
| | 00:27 | There are four major tiers in a web application:
| | 00:30 | the client, the web tier, the
business tier and the data tier.
| | 00:35 | The client tier is a web browser.
| | 00:38 | The browser software is installed on
your local computer whether that'd be
| | 00:42 | a desktop or a laptop computer, or a
mobile device such as a smartphone or a tablet.
| | 00:49 | The job of the browser is to send
requests to the server and then to receive and
| | 00:53 | render HTML, images and
cascading style sheets.
| | 00:57 | All modern web browsers
can execute client-side code.
| | 01:02 | They can all execute JavaScript and if
they support the feature, they can also
| | 01:07 | execute code supported by plug-ins
such as Flash Player, Silverlight or Java.
| | 01:14 | All of the other tiers of a web
application go into the server environment and
| | 01:19 | taken together, they are
known as the server stack.
| | 01:23 | There are three server tiers.
| | 01:25 | The web tier is the HTTP server.
| | 01:28 | It receives requests from the
client and returns responses.
| | 01:32 | The HTTP server dispatches requests to
the business tier, an application server,
| | 01:38 | and the application server interacts
with the data tier, the database server.
| | 01:42 | In the world of Apache, MySQL and PHP,
these roles are filled by Apache in the
| | 01:48 | web tier, PHP in the business
tier and MySQL in the data tier.
| | 01:54 | As a web application developer, you
will find it useful to be able to install
| | 01:58 | these software products locally, so
that you can develop and test your code
| | 02:02 | before you upload it to a production server.
| | 02:05 | There are a number of ways of doing this.
| | 02:08 | One approach is to install each
element of the AMP stack individually.
| | 02:13 | You'll be able to download all the
software you need for free from these web
| | 02:17 | sites at Apache, PHP and MySQL.
| | 02:21 | On Mac OS X, Apache and PHP are already
included, you just need to activate them,
| | 02:28 | and then you install MySQL separately.
| | 02:31 | On Windows, you will install
all of the components separately.
| | 02:34 | And in later videos of this series,
I'll show you how to do this on each of
| | 02:38 | these operating systems.
| | 02:40 | As of the time of this recording, it's
very easy to install PHP 5.3 with Apache,
| | 02:46 | but if you want to move to the newest
version of PHP, 5.4, you'll find it takes a
| | 02:51 | little bit more work.
| | 02:53 | In this version of the course, I
primarily focus on PHP 5.3 and offer some tips
| | 02:58 | about 5.4 where they're available.
| | 03:01 | One of the advantages of installing
these software products individually is that
| | 03:06 | if you need to upgrade one element,
you won't need to uninstall the others.
| | 03:10 | When you use the integrated software
bundles I'll describe next, most of the
| | 03:14 | time you'll find that in order to
change your software, you have to uninstall
| | 03:18 | everything and reinstall everything.
| | 03:21 | Individual components give you more control.
| | 03:23 | The advantage though of the AMP
software bundles is that they're very easy to
| | 03:28 | install and get started with.
| | 03:30 | All of the software bundles that
I'll describe here are free to download
| | 03:34 | and easy to set up.
| | 03:36 | If you're a Windows developer, you might
consider WampServer, and if you're a Mac
| | 03:41 | developer, you might look at MAMP.
| | 03:43 | These are the software bundles that I
typically use in my courses that involve
| | 03:48 | PHP, MySQL and Apache.
| | 03:50 | There are other bundles available too
and they each have their own benefits.
| | 03:56 | These three software bundles are
available for multiple operating systems;
| | 04:01 | Windows, Mac and Linux.
| | 04:02 | There is XAMPP, spelled with an X,
BitNami and Zend Server Community Edition.
| | 04:10 | When you choose an AMP distribution, it's
good to know some of the benefits of each.
| | 04:14 | For example WampServer and XAMPP both
install by default using the standard
| | 04:20 | ports for Apache and MySQL.
| | 04:23 | If you're working with MySQL and PHP,
using Dreamweaver for example, you'll find
| | 04:28 | that you have to use port 3306 with
MySQL and if you use an alternative port,
| | 04:34 | Dreamweaver won't be able
to connect to that database.
| | 04:37 | WampServer and XAMPP set up these
software products exactly how Dreamweaver
| | 04:41 | would expect them to be set up and
also how they are set up in a production
| | 04:45 | environment typically.
| | 04:46 | MAMP, on the other hand, by
default uses alternative ports.
| | 04:52 | This gives you the advantage on Mac of
being able to run side-by-side with the
| | 04:56 | versions of Apache and PHP that
are included in the operating system.
| | 05:00 | But MAMP also makes it very easy to reset
to the standard ports, port 80 and 3306.
| | 05:07 | BitNami has distributions that
include common PHP applications such as
| | 05:13 | WordPress, Drupal, and Joomla! and many others.
| | 05:16 | If your goal is to get started with
one of these content management systems,
| | 05:20 | you'll find that BitNami
provides a very easy road forward.
| | 05:24 | Also BitNami, uniquely among all of
these bundles as of the time of this
| | 05:28 | recording, offers
versions that integrate PHP 5.4.
| | 05:33 | These versions, again at this moment,
are available only for development and
| | 05:38 | not for production.
| | 05:39 | But if you want to get started with
PHP 5.4, BitNami offers a very easy path.
| | 05:45 | One of the most important things to
consider is that you can only have one copy
| | 05:50 | of each software product
running on each port at a time.
| | 05:55 | You could have more than one copy of
MySQL running, but only one can listen on
| | 05:59 | port 3306, and only one copy of
Apache can be listening on port 80.
| | 06:04 | So it's a good idea to choose one
approach and then stick with that approach on
| | 06:10 | each individual computer.
| | 06:13 | Particularly on Windows, installing
both an AMP bundle and the separate
| | 06:17 | components can cause a lot of problems.
| | 06:20 | You'll find that sometimes you will get
DLL conflicts, different versions of a
| | 06:25 | particular component that conflict
with each other and prevent one or both of
| | 06:30 | these software components
from starting up at all.
| | 06:33 | So on Windows, install the separate
components or an AMP bundle, but not both.
| | 06:39 | And finally, if you install two AMP
bundles on a single computer, make sure you
| | 06:44 | deactivate the first
before you start up the second.
| | 06:48 | There are some combinations of these
software bundles that can be installed
| | 06:51 | side-by-side, for example MAMP and the
included components of Mac OS X as long as
| | 06:57 | they're listening on different ports.
| | 06:59 | But if you want to make sure that your
software is going to run the first time
| | 07:03 | every time, install one of these
bundles and stick with that bundle and don't
| | 07:08 | install anything else on
that particular computer.
| | Collapse this transcript |
| Using the exercise files| 00:00 | The exercise files that accompany this
course, Installing Apache, MySQL, and PHP,
| | 00:06 | are free for everybody.
| | 00:08 | They include some custom files that
I've created and also one open source
| | 00:12 | software package that I'm redistributing
| | 00:14 | that should make it easier to
test and manage your software.
| | 00:18 | The files include a PHP file called
phpinfo.php that you can use to test
| | 00:24 | your PHP installation;
| | 00:26 | a text file that you can use to
uninstall MySQL on Mac OS X; an SQL file that
| | 00:32 | creates a new database with
structure and data in MySQL; and then in the
| | 00:38 | phpmyadmin folder, the
actual phpmyadmin software.
| | 00:43 | This is a free, open source web
application that you can use to manage your MySQL
| | 00:47 | databases, and it works on both Mac and Windows.
| | 00:51 | And to go with that software, I've
created some brief configuration files that
| | 00:56 | should make it easier to get up and
running with the software on your choice
| | 00:59 | of operating system.
| | 01:02 | So again, the exercise files are
completely free and you don't need a Premium
| | 01:05 | membership to use them.
| | Collapse this transcript |
| What's new in this update| 00:00 | This video series, installing Apache,
MySQL and PHP, is regularly updated to
| | 00:06 | keep up with changes in the software it covers.
| | 00:10 | Here's what's new in this course
update which was done in mid-2012.
| | 00:15 | First, I've updated coverage of WampServer.
| | 00:18 | WampServer is one of the most
popular AMP stacks for windows.
| | 00:22 | The ownership and management of WampServer
has changed and their web site was redesigned.
| | 00:27 | So I've rerecorded the videos that
show how to navigate that web site.
| | 00:32 | But the underlying
software is pretty much the same;
| | 00:35 | you install it in
management in the same way as before.
| | 00:38 | So if you are already using
WampServer and you don't need to go get a new
| | 00:42 | version or reinstall it, the new
coverage probably won't apply to you.
| | 00:47 | If you're brand new to WampServer though,
the newly recorded videos should match
| | 00:51 | what you see on their web site.
| | 00:53 | I've also added coverage of
BitNami AMP distributions.
| | 00:56 | BitNami is an organization
that creates and distributes AMP
| | 01:00 | installation packages.
| | 01:02 | They support Windows, OS X and Linux,
and uniquely, BitNami AMP distributions
| | 01:09 | are available with common CMS or content
management system applications already bundled.
| | 01:15 | For example if your goal is to get
started with WordPress, Drupal, Joomla!
| | 01:21 | or many other open source PHP-based
applications, you might find a distribution
| | 01:26 | on the BitNami web site that already has
this software bundled and ready to use.
| | 01:32 | Finally, I show how to
work with AMP on Windows 8.
| | 01:35 | Windows 8 has moved over to IPv6, a
new system for assigning IP addresses.
| | 01:42 | For developers working with Apache,
this has an interesting effect.
| | 01:46 | The term localhost, a DNS name that
points to your local computer, has
| | 01:51 | traditionally always equated
to an IP address of 127.0.0.1.
| | 01:58 | On computers that use IPv6, localhost
now equals a string of ::1. When you're
| | 02:05 | working with the Apache HTTP server,
this can cause some issues with your
| | 02:10 | configuration files.
| | 02:11 | I'd show how to handle this in Apache
specifically with WampServer, which when
| | 02:17 | you install it on the current
version of Windows 8, starts off broken.
| | 02:20 | I'll show you the underlying
problem and how to fix it in the Apache
| | 02:25 | configuration files.
| | 02:27 | So that's a look at what's new in
this mid-2012 update to installing
| | 02:31 | Apache, MySQL and PHP.
| | 02:34 | As always with this course, if you see
things that have changed in the software
| | 02:38 | we cover, let us know and we'll do our
best to update the content to match what
| | 02:43 | the software looks like in the real world.
| | Collapse this transcript |
|
|
1. Installing Separate Components on WindowsInstalling Apache on Windows| 00:00 | The Apache HTTP server is the most
popular HTTP server on the planet.
| | 00:06 | It's completely free and is
available from the HTTP Server Project
| | 00:10 | at httpd.apache.org.
| | 00:14 | To download the application, click
the "from a mirror" link, under Download.
| | 00:19 | The most stable version as of this
release is 2.2.19. Scroll down in the page
| | 00:25 | and you'll see that there are a
number of available distributions.
| | 00:29 | There are source versions for both Unix
and Win32, and Binary versions for Win32
| | 00:34 | and for NetWare. I recommend using
the Win32 Binary, including OpenSSL.
| | 00:40 | I've already downloaded this installer
to my desktop, and here's the installer.
| | 00:46 | I'll double-click it to start it,
and then I'll walk through the initial prompts.
| | 00:51 | I'll read through the license
agreement, and if I accept its terms, I'll
| | 00:55 | indicate so, and click Next.
| | 00:58 | There is some informational text here
about the server, and I'll click Next
| | 01:02 | again, and I'll come to the
Server Information screen.
| | 01:06 | You're running the Apache server
purely for local development, so set your
| | 01:10 | Network Domain and your
Server Name to localhost.
| | 01:15 | You can set the Email
Address to anything you like.
| | 01:18 | I'll use the fake email
address that's listed on the screen.
| | 01:22 | You can install the HTTP
server in one of two modes.
| | 01:26 | The recommended approach is to install
it as a Windows service, listening on
| | 01:29 | port 80, the default http port.
| | 01:33 | When you install as a service the
server will stay running, even after you
| | 01:37 | log out, as long as the computer stays on.
| | 01:40 | If you install for the current user,
it will run as an application and if you
| | 01:44 | log out, it will turn off.
| | 01:45 | Also, it will be listening
on a custom port, port 8080.
| | 01:50 | I'll use the Recommended mode,
port 80 as a service, and click Next.
| | 01:55 | I'll leave the Setup Type set to
Typical and click Next again, and that brings
| | 01:59 | me to the Destination Folder screen.
| | 02:01 | The default location is under the
Program files, or on 64-bit Windows,
| | 02:06 | Program Files (x86) folder.
| | 02:09 | I recommend placing the Apache
server in a folder without any spaces or
| | 02:13 | other special characters.
| | 02:14 | I'll click Change, and I'll set the
folder name to simply C:\apache, and click OK.
| | 02:23 | I'll click Next, and I'll click Install.
| | 02:27 | It'll take a few moments, and then you
might see a user account control dialog pop up.
| | 02:33 | If you do see this, just click Yes.
| | 02:37 | Then the files are copied over to your hard
disk and the server is set up as a Windows service.
| | 02:44 | You might see some little errors fly by
as the installation proceeds. That's okay.
| | 02:49 | I'll show you how to
resolve those errors in a moment.
| | 02:51 | Once the installation wizard
is completed, click Finish.
| | 02:56 | It might take a few moments for
the installation wizard to close;
| | 02:59 | there's still some work being done
in the background. Just be patient, and
| | 03:03 | when it closes, you'll be
ready to test your server.
| | 03:09 | Now to test the server, go into any
browser. Type in the URL http://localhost/.
| | 03:18 | You should see this very simple
HTML page, with the text "It works!"
| | 03:23 | Now I'll show you where
your web documents are stored.
| | 03:27 | The document root folder for the
Apache server is under C://apache/--
| | 03:32 | that's the root folder where I
installed the software--and then there is a
| | 03:36 | subfolder named htdocs.
| | 03:38 | This folder contains a single file, index.html.
| | 03:42 | I'll open it with a text editor, and show
that it has that very simple text of "It works!"
| | 03:49 | And that's what you're seeing in the browser.
| | 03:51 | This folder is where you'll place all
of your HTML, PHP, graphics files, and
| | 03:57 | other assets that you want to be
able to retrieve from a browser.
| | 04:01 | Now, it's also important to know where
to turn the Apache server on and off.
| | 04:06 | You do this through the
Windows Services Console.
| | 04:09 | I'll go to the Windows
Control panel from the Start menu.
| | 04:12 | I'll click into Search
Control panel and type, "services."
| | 04:17 | And then I'll click on View local services.
| | 04:20 | If you're working on Windows XP, you
should see the administrative tools link at
| | 04:24 | the top of the Control panel list,
and you'll find the Services Console there.
| | 04:29 | Here is the Apache 2.2 Service.
| | 04:33 | Notice it's set up as an automatic
startup service and that it's already started.
| | 04:39 | You can stop the service by clicking
the Stop button, and then you can click
| | 04:43 | the Start button again.
| | 04:45 | So that's the basics.
| | 04:47 | There are some troubleshooting tips
I'll share in a separate video, but if
| | 04:50 | you've gotten this far, you are ready
to install PHP and integrate it with
| | 04:54 | your Apache server.
| | Collapse this transcript |
| Starting Apache from the command line| 00:00 | When you're working with the Windows
service of the Apache web server, it's
| | 00:04 | sometimes hard to see errors that
pop up when the web server is started.
| | 00:08 | I'm looking at the Services Control
panel, and I'll show you that if I stop
| | 00:12 | the service and then restart it again, it
appears that it's starting without any problems.
| | 00:18 | But when you first install the
Apache web server, there is one additional
| | 00:21 | configuration you might want to make,
and the only way that you will know this
| | 00:24 | condition exists is if you start
Apache from the command line instead.
| | 00:28 | So I'm going to stop the Apache service,
and then I'll open up a command window.
| | 00:34 | I'll go to the Start menu
and type "cmd" and press Enter.
| | 00:39 | Then I'll change to the Apache
bin directory with "cd\apache\bin."
| | 00:49 | Here's a listing of the
files that are in this directory.
| | 00:51 | The most important one is here, httpd.exe.
| | 00:56 | That's the executable for the HTTP server.
| | 01:00 | So I will clear the screen, and then I'll
try to start the Apache server from the
| | 01:04 | command line with the command httpd.
| | 01:08 | I see this error, "could not reliably
determine the server," et cetera, and it
| | 01:13 | shows the dynamically generated IP
address that was assigned by this
| | 01:17 | computer's DHCP server.
| | 01:19 | Now, you might not see this on your system,
but if you do, I'll show you how to resolve it.
| | 01:23 | I will press Ctrl+C to stop
the server at the command line.
| | 01:27 | That brings back the prompt.
| | 01:29 | Now, I'm going to make an edit
to the Apache configuration file.
| | 01:32 | I will go to Windows Explorer and
navigate to the Apache conf directory, and
| | 01:38 | I'll open the file httpd.conf in a text editor.
| | 01:41 | I will search for the
phrase "localhost." Here it is!
| | 01:47 | This is a line that explicitly
configures your Apache server to use a particular
| | 01:51 | host name and a particular port.
| | 01:53 | I am just going to remove the pound sign, or
hash mark, at the beginning of the line.
| | 01:57 | That's commenting this option out right now.
| | 02:00 | I'll save my changes by pressing Ctrl+S
and then closing the text editor, I will
| | 02:06 | return to the command window,
and once again I'll start the httpd command.
| | 02:11 | This time it starts up without any errors.
| | 02:14 | To fully test it, I will go to a browser,
and I'll type in http://localhost, and
| | 02:23 | I get the homepage from the Apache server.
| | 02:27 | So now that I know the Apache
server is configured correctly,
| | 02:29 | I'll return to the command window,
| | 02:31 | I will Stop the server by pressing
Ctrl+C, and I'll close the command window.
| | 02:37 | Then I'll return to the Services
Control panel and I'll restart the service.
| | 02:42 | Now I know that the Apache HTTP
server is correctly configured.
| | 02:46 | You can use this option of starting
Apache from the command line, so you can
| | 02:50 | see any errors that are generated
more clearly, than are available in the
| | 02:54 | Services Control panel.
| | Collapse this transcript |
| Installing PHP with Apache on Windows| 00:00 | After installing the Apache HTTP
server, the next step is to install PHP.
| | 00:06 | You can download the free
installer for PHP for Windows from the web
| | 00:10 | site windows.php.net.
| | 00:13 | From the homepage, click the Downloads link.
| | 00:17 | As of this recording, the most recent
version of PHP listed here was 5.3.8,
| | 00:22 | but that's not the version I'm going to
show you how to install, and I'll show you why.
| | 00:27 | Notice that there are two
versions listed, both labeled VC9.
| | 00:32 | And then look at the text over on the
left labeled Which version do I choose?
| | 00:36 | It explains that if you're using the
HTTP server from Apache.org, which we are,
| | 00:41 | we need versions of PHP labeled VC6, not VC9.
| | 00:46 | As of this recording, the last version
that qualifies was 5.3.5, and it's not
| | 00:52 | listed on this screen.
| | 00:53 | So here's what you do.
| | 00:55 | Scroll all the way down to the
bottom of the page and look over on the
| | 00:57 | left, under Archives.
| | 00:59 | Click the archives link, scroll
down and locate the 5.3.5 installers.
| | 01:05 | Specifically, you're looking for
this file, php-5.3.5-Win32-VC6-x86.msi.
| | 01:15 | Now, I've already
downloaded the file to my Desktop,
| | 01:18 | so I'll close the browser and then I'll
double-click the installer to start it up.
| | 01:24 | I'll walkthrough the various prompts,
including reading through the license
| | 01:28 | agreement, and then if I accept
the terms, I'll click the appropriate
| | 01:31 | controls and click Next.
| | 01:34 | On the Destination Folder screen, I'll
indicate where I want to install PHP.
| | 01:38 | As with Apache, I recommend installing
PHP to a folder that doesn't have any
| | 01:43 | spaces or special characters in its name.
| | 01:46 | I'll change this simply to
C:\php, lowercase. Then I'll click Next again.
| | 01:53 | On the Web Server Setup screen, I'm
asked which version of the web server
| | 01:57 | connector I want to use.
| | 01:59 | I'll choose the first one,
Apache 2.2.x Module.
| | 02:04 | There are others that can work,
but this is the best for the particular version
| | 02:08 | of Apache that I installed. And I'll click Next.
| | 02:11 | Now I'll indicate where my Apache
HTTP configuration directory is.
| | 02:16 | I'll browse, I'll navigate to the C:
| | 02:19 | drive route, and I'll go to apache\conf.
| | 02:25 | That's where the httpd.conf file is stored.
| | 02:30 | I'll verify the folder name and then
click OK, and then I'll click Next again.
| | 02:36 | And now I've made all of my selections.
I'll click Next, and I'll click Install.
| | 02:41 | It will take a few minutes to copy
the files over to your hard disk and
| | 02:46 | integrate PHP with your HTTP server.
| | 02:50 | Along the way, you might see this User
Account Control dialog. If so, click Yes.
| | 02:58 | Once the wizard is complete, click Finish.
| | 03:01 | Now, the installation isn't quite done.
| | 03:03 | There is one manual
change that you have to make.
| | 03:06 | I'll show you how to make a critical
change to the Apache configuration file.
| | 03:12 | I'll go to Windows Explorer, to the
C:\apache\conf folder, and I'll open
| | 03:20 | httpd.conf in a text editor.
| | 03:24 | Now, I'll scroll all the way
down to the bottom of the file.
| | 03:27 | Down at the bottom, you should
find these four lines of text,
| | 03:31 | two comments wrapped around two declarations.
| | 03:35 | The PHPIniDir and the LoadModule
declarations need to be explicitly edited to
| | 03:41 | indicate the location of your PHP installation.
| | 03:44 | Place the cursor between the
quotes after PHPIniDir and type "c:/php."
| | 03:51 | Make sure you're using a forward
slash and not a backslash, as you might
| | 03:56 | normally do in Windows.
| | 03:58 | Now place the cursor after the opening
quote before the DLL and type "c:/php/",
| | 04:06 | once again being sure to use
forward slashes and not backslashes.
| | 04:11 | Save your changes and close the editor.
| | 04:13 | Go back to the Control
panel, to the Services console.
| | 04:16 | Locate your Apache2.2 service and
click the Restart Service button.
| | 04:22 | You'll see the Service Control dialog
pop up and indicate that it's stopping and
| | 04:27 | then restarting Apache.
| | 04:29 | Now, close all your
windows and open up a browser.
| | 04:34 | To fully test whether PHP is
working, you'll need a simple PHP file.
| | 04:39 | I've provided that file in
the Free Exercise Files folder.
| | 04:43 | Go into the Free Exercise Files
and locate this file, phpinfo.php.
| | 04:48 | I'll show you its contents.
| | 04:50 | So this file contains a very
simple PHP command, phpinfo.
| | 04:56 | It's wrapped inside the PHP
beginning and ending tokens.
| | 04:59 | When you execute phpinfo, the PHP
server dumps a whole bunch of technical
| | 05:04 | information in HTML out to the browser.
| | 05:07 | So I'm going to copy this file and then
I'll navigate my C:\apache\htdocs, and
| | 05:15 | I'll paste it into place by pressing
Ctrl+V. Now to test my HTTP server, I'll go
| | 05:21 | back to that browser, and I'll
type in http://localhost/phpinfo.php.
| | 05:32 | When I press Return, the phpinfo
command dumps all sorts of useful
| | 05:36 | information out to my browser.
| | 05:39 | Most importantly, the loaded
configuration file is listed here.
| | 05:43 | This tells you which PHP file is
being used to configure your installation.
| | 05:48 | And I'll show you one setting that
I typically use in the php.ini file.
| | 05:52 | I'll go to Windows Explorer again and
this time go to C:\php, and then I'll
| | 05:59 | open up php.ini in a text editor.
| | 06:04 | I'm going to search for the
following string, display_errors.
| | 06:10 | The first instance of that
string that I find is documentation.
| | 06:13 | That's not what I was looking for.
| | 06:15 | I'll search again, and this time I get to
this configuration, display_errors = Off.
| | 06:22 | I'm going to change that from Off to On.
| | 06:26 | That means that when errors occur in my
PHP pages, the errors will be displayed
| | 06:30 | right there in the browser, at
the place where the error occurred.
| | 06:34 | And this will mean that I don't have
to go look at the log files to diagnose
| | 06:38 | problems in my PHP pages.
| | 06:40 | This is a very important setting that you
should turn on when you're doing local development,
| | 06:45 | but you might want to turn off when you
deploy your application to a production server.
| | 06:49 | I'll save the change.
| | 06:51 | I'll once again go back to the
control panel and restart my server.
| | 06:57 | I'll go back to the browser and press
Ctrl+R to refresh and verify that PHP is
| | 07:03 | still operating correctly.
| | 07:05 | So if you've gone through all those
steps and you can see the phpinfo output,
| | 07:09 | you're in great shape to move to
the next step, installing MySQL.
| | Collapse this transcript |
| Installing MySQL on Windows| 00:00 | The native installer for MySQL is
available from the mysql.com website at
| | 00:05 | www.mysql.com/downloads.
| | 00:10 | On this screen, click MySQL Community
Server and then decide which installer
| | 00:17 | you're going to use.
| | 00:19 | You need to know whether
you're running 32 or 64 bit Windows.
| | 00:23 | You need to choose the
installer for your version of Windows.
| | 00:27 | To find out, go to the Control Panel
and from there click System and Security
| | 00:33 | and then click System.
| | 00:35 | On this screen, you will see the
System type listed as either 64 or 32 bits.
| | 00:40 | I am using the 64-bit version of Windows, so
that's the version of MySQL that I'll select.
| | 00:46 | I'll choose the x86, 64-bit MSI installer.
| | 00:53 | Now I've already downloaded that to my
desktop, so I'll double-click it to start,
| | 00:57 | then I'll click Run and
walk through the prompts.
| | 01:02 | At the License screen I'll read
through the license and if I agree with the
| | 01:05 | terms I'll check the checkbox and click Next.
| | 01:10 | I'll choose the Typical setup
type and then click Install.
| | 01:14 | Along the way, you might see a
User Account Control dialog box.
| | 01:19 | If you see it, click Yes.
| | 01:22 | You'll also see file is being copied
over to your hard disk and you might see a
| | 01:26 | couple of billboards or advertisements
for various products sold by Oracle and
| | 01:30 | MySQL. If you see these
advertisements just click Next again.
| | 01:36 | The server installation happens in two phases.
| | 01:39 | During this initial phase, the files
are copied over to your hard disk.
| | 01:44 | You'll then be asked to
configure the server in a second phase.
| | 01:49 | When you see the message that the
initial setup is done, keep this option
| | 01:53 | selected, Launch the MySQL Instance
Configuration Wizard, and click Finish.
| | 01:59 | If you see another User Account Control
dialog, click Yes and that will take you
| | 02:03 | to the Instance Configuration Wizard.
Click Next, and on this screen if this is
| | 02:10 | your only copy of MySQL choose
Standard Configuration. Click Next again.
| | 02:16 | On this screen, check the checkbox to
include the bin directory in the Windows path.
| | 02:22 | This will allow you to run the
MySQL executables from the command line,
| | 02:26 | regardless of where you are on
the hard disk. Click Next again.
| | 02:30 | On this screen select and
type in a root user password.
| | 02:35 | I'll use a very simple
password of just password.
| | 02:39 | Type it in twice and click Next
and then finally click Execute.
| | 02:46 | It'll take a few more moments
to complete the installation.
| | 02:49 | A configuration file is created called
my.ini and this screen shows you where
| | 02:54 | that file is located on disk.
| | 02:57 | Then your Windows service will be
started and the Security settings applied.
| | 03:02 | When you see this message
your installation is complete.
| | 03:05 | Click Finish and then go to
the Windows Control Panel.
| | 03:11 | From there go to the Services Panel,
I've typed in services and then clicked
| | 03:16 | View local services, and then scroll
down to the M's and you should see the new
| | 03:22 | MySQL service listed and its
Status should be set to Started.
| | 03:28 | Now if you have any trouble, try
troubleshooting using tips from MySQL.
| | 03:33 | Here is a webpage that's
provided in the MySQL documentation.
| | 03:40 | You can search for this page by going to
Google and typing in Troubleshoot MySQL Windows.
| | 03:46 | You'll find multiple versions. Make
sure that you're looking at the reference
| | 03:50 | manual for your version of MySQL.
| | 03:54 | In this document it talks about
certain problems that can occur the first
| | 03:57 | time you install MySQL.
| | 04:00 | Including security problems having to
do with the folder program data, which is
| | 04:04 | created as a hidden folder
under the C drive root on Windows 7.
| | 04:09 | If you're working on Windows Vista or
an older version of Windows, this data
| | 04:13 | folder might be located under
the Windows Installation folder.
| | 04:17 | Regardless of which version of Windows
you're working on, if you have trouble,
| | 04:20 | read through this document and follow its steps.
| | 04:23 | On a fresh version of Windows, you
should be able to troubleshoot and get your
| | 04:27 | version of MySQL started before you
start doing your local development.
| | Collapse this transcript |
| Installing phpMyAdmin on Windows| 00:00 | phpMyAdmin is a very popular free web
application that can be used to manage
| | 00:06 | your MySQL databases.
| | 00:08 | You can download the most recent version
of phpMyAdmin from this web site, www.phpmyadmin.net.
| | 00:16 | But I've included a copy of phpMyAdmin
in the exercise files that come with this
| | 00:21 | course, and I'll show you
how to install that version.
| | 00:25 | I'll go to the Free Exercise Files folder
and double-click into the phpmyadmin folder.
| | 00:31 | You'll find a zip there,
including phpMyAdmin 3.4.3.2.
| | 00:36 | And there's also a configuration file,
one for Windows and one for Mac OS X.
| | 00:41 | To install phpMyAdmin, first
extract the contents of the zip file.
| | 00:46 | I'll extract the contents of the
zip file directly to the desktop, by
| | 00:50 | right-clicking and choosing
Extract All and then Extract.
| | 00:53 | Now you can use any zip utility you like,
| | 00:57 | WinZip or anything else, because
this file is in simple zip format.
| | 01:03 | Go to the extracted folder which
has the same name as the zip file and
| | 01:07 | double-click into it.
| | 01:08 | You'll find another
folder there of the same name.
| | 01:12 | And then drag that folder
into your document root folder.
| | 01:16 | I'll open a new copy of Windows Explorer.
| | 01:19 | I'll position this one over on the
right and the original one over on the left.
| | 01:24 | In the right window, I'll go to
C:\apache\htdocs, and then I'll take this folder
| | 01:30 | and drag it over to the right one.
| | 01:33 | I'm done with that copy of
Windows Explorer, so I'll close it.
| | 01:37 | And now for this folder, I'll rename it.
| | 01:39 | I'll press F2 and call it
simply phpmyadmin, all lowercase.
| | 01:45 | That'll just make it
easier to call from the browser.
| | 01:49 | That's basically it.
| | 01:50 | phpMyAdmin has been installed,
| | 01:53 | but there are a couple of
configurations that I recommend.
| | 01:56 | Let's first test it from a browser.
| | 01:58 | I'll go to my browser and I'll
type in http://localhost/phpmyadmin.
| | 02:10 | Notice that I see a listing of files.
| | 02:12 | This is because of a configuration
that needs to be made in the Apache web
| | 02:16 | server, not in PHP or in phpMyAdmin.
| | 02:21 | So as I have before, I'm going to open
up the httpd.conf file in a text editor.
| | 02:27 | I'll go to C:\apache\conf, and I'll open the file.
| | 02:34 | Now I'm going to search
for the string index.html.
| | 02:39 | This takes me to an option named DirectoryIndex.
| | 02:43 | By default, the Apache server is
set up to default to HTML files.
| | 02:48 | I want, instead, to default to PHP
files, because that's the kind of file I'm
| | 02:53 | primarily going to be using.
| | 02:55 | So I'll change this from
index.html to index.php.
| | 03:01 | I'll save and close the file.
| | 03:04 | I'll return to my Services
control panel and restart the server.
| | 03:11 | Now I'll go back to the browser and refresh.
| | 03:14 | And this time, phpMyAdmin
appears, showing me a login screen.
| | 03:19 | I'll type my username and my password.
| | 03:22 | This is the MySQL password that you set up
when you installed MySQL in a previous video.
| | 03:30 | I'll click the Go button
and that opens up phpMyAdmin.
| | 03:36 | Now, it's also possible to configure
phpMyAdmin to open automatically, using your
| | 03:41 | username and password from a configuration file.
| | 03:45 | Here's how you do that.
| | 03:47 | I'll close all these other windows;
I'm pretty much done with those.
| | 03:50 | Then I'll go to the Free Exercise
Files, to the phpmyadmin folder again.
| | 03:56 | I've provided a file that configures
phpMyAdmin on Windows, using a minimal set
| | 04:02 | of configuration options.
| | 04:05 | I'll open the file in a text editor
and show you that there are four options.
| | 04:08 | The first three have to
do with the login option.
| | 04:12 | I put in the username and
the password explicitly.
| | 04:15 | Again, this is the
username and password for MySQL.
| | 04:19 | And I've set auth_type to a value of config.
| | 04:22 | You should change the
password setting to your password.
| | 04:25 | So if you used something else,
something more secure, change it here.
| | 04:30 | I've also added an option called
AllowUserDropDatabase and set it to a value of true.
| | 04:36 | This will make sure that you as an
administrator can drop or delete databases
| | 04:41 | from your MySQL database.
| | 04:43 | By default, phpMyAdmin doesn't let you do that.
| | 04:46 | Now here's how I'll use this file.
| | 04:49 | I'll go back to Windows Explorer,
and I'll copy this file to the clipboard.
| | 04:54 | Then I'll go to C:\apache\htdocs\
phpmyadmin, and I'll paste the file into place,
| | 05:02 | pressing Ctrl+V. Now I need to rename the file.
| | 05:06 | I'll press F2 and I'll change
the file name to config.inc.php.
| | 05:15 | That's all you have to do.
| | 05:17 | Now, I'll make sure that I've closed all
my browser windows so that I'm logging
| | 05:21 | in for the first time again.
| | 05:23 | I'll open a new browser
window, and once again I'll go to
| | 05:26 | http://localhost/phpmyadmin.
| | 05:33 | If you see the login
screen initially, that's okay;
| | 05:36 | press Ctrl+R to refresh the page,
and this will reload the application.
| | 05:41 | And this time it loads without you having
to type in your username and password again.
| | 05:45 | This sort of configuration is
great for local development.
| | 05:49 | It is, however, not particularly secure,
so I only recommend using this minimal
| | 05:53 | configuration on the local
development copy of this application.
| | 05:57 | If you want to put phpMyAdmin on
your production server, read through the
| | 06:01 | phpMyAdmin documentation for their
recommendations on the best settings to use.
| | 06:07 | There's also a file here called
config.sample.inc.php, which you can learn a lot from.
| | 06:13 | It has a lot of common configurations that
you can use in your own copy of phpMyAdmin.
| | 06:19 | But with this smaller configuration file
that I've provided, you have everything
| | 06:23 | you need to do local development
and manage your local databases.
| | Collapse this transcript |
|
|
2. Installing Separate Components on Mac OS XActivating Apache on Leopard and Snow Leopard| 00:00 | If you're working with Mac OS X and want
to use separate components for your AMP
| | 00:04 | stack, you're ahead of the game,
because Mac OS X includes both Apache and PHP
| | 00:10 | in its default installation.
| | 00:12 | You just have to know how to turn them on.
| | 00:15 | First, I'll show you how to turn on Apache.
| | 00:17 | Go to the Apple menu and choose
System Preferences. Then from there, click
| | 00:23 | Sharing, which you'll find
under Internet & Wireless.
| | 00:26 | Mac OS X refers to the Apache web
server as Web Sharing, which you can activate
| | 00:32 | by simply checking the check mark.
| | 00:35 | When you activate Web Sharing, you're
turning the built-in Apache web Server on.
| | 00:39 | On this screen it will show you
the IP address of your computer.
| | 00:44 | Assuming that your computer is
getting its IP address dynamically using an
| | 00:48 | architecture known as DHCP, this IP
address will be different on every computer.
| | 00:53 | Notice that there are two possible links.
| | 00:56 | The bottom one is a web site for the
entire computer; the top one though, is a
| | 01:01 | web site for the currently logged-in user.
| | 01:03 | I'm logged in on my Mac as a user
named LDC, for lynda.com, and so my
| | 01:09 | personal web site is under the local
IP address / then a tilde character,
| | 01:15 | and then the username.
| | 01:17 | Now you don't have to use this
dynamically generated address.
| | 01:20 | If you click it, you'll
see the default web page.
| | 01:23 | Now, I'm recording on version 10.6
of Mac OS X. That's Snow Leopard.
| | 01:29 | If you're using another version of
Mac OS X, the web page may look different,
| | 01:34 | but you should still see a confirmation
that the Apache web server is running.
| | 01:38 | But you can actually get to exactly
the same web page and exactly the same
| | 01:42 | location on your disk by using the
local IP address that's common to all
| | 01:47 | computers, 127.0.0.1.
| | 01:52 | Once again, I'm referring to the LDC
folder using the tilde as a prefix, and that
| | 01:58 | takes me to the same place.
| | 02:00 | Yet another alternative is
to use the word localhost.
| | 02:04 | The localhost DNS name always
points to the IP address 127.0.0.1.
| | 02:13 | Typically, when you're doing local
development, you should either use localhost
| | 02:18 | or the IP address, the 127.0.0.1 address.
| | 02:22 | Your instructors will typically use
these addresses, rather than anything
| | 02:25 | that's dynamically generated,
and that will make sure that you're using the
| | 02:30 | same address on your computers as
they did on theirs and that it's working
| | 02:34 | the same for everybody.
| | 02:36 | Now I'll show you where these files are stored.
| | 02:37 | I'll go to Finder, to my personal directory,
LDC. Under there, go to a folder named Sites.
| | 02:48 | You'll find this, file index.html, and an
images folder containing a few basic graphics.
| | 02:55 | I'll double-click index.html to open it
in a browser, and you'll see that it
| | 03:00 | looks exactly the same.
| | 03:02 | So this folder, the Sites folder
under your home directory, is what's known
| | 03:06 | through Apache as the document root.
| | 03:10 | Each user that's logged in to a
particular Mac has their own personal document
| | 03:14 | root, and then there is also a
computer-wide document root, which is stored on
| | 03:18 | your Mac hard disk under
/library/web server/documents.
| | 03:25 | So once you know how easy it is to
turn your Apache web server on, you'll be
| | 03:28 | ready to go onto the next step, activating PHP,
| | 03:32 | and I'll show you how to
do that in the next video.
| | Collapse this transcript |
| Activating Apache on Lion| 00:00 | Just as with older versions of the Mac
operating system, version 10.7, or Lion,
| | 00:06 | includes the Apache HTTP server.
| | 00:09 | It's up to you to activate, or turn it on.
| | 00:13 | I'll go to the Apple menu
and choose System Preferences.
| | 00:17 | You can also get here through the Dock.
| | 00:19 | On this screen, go to the Internet &
Wireless section and choose Sharing.
| | 00:23 | Mac OS X refers to the Apache
HTTP service as Web Sharing.
| | 00:29 | Go to that category, and you'll
see that it's turned off by default.
| | 00:33 | To turn it on, just check the
check box; it's that simple.
| | 00:37 | Now to test your Apache server, go
to the second link on this screen.
| | 00:42 | It will either show an IP address, as it does
here, or your computer name. Click the link.
| | 00:49 | If everything is working correctly
you should see the page, "It works!"
| | 00:53 | This is a very simple homepage
that's provided with the Apache server.
| | 00:58 | Now it might not work on your system,
especially if it's showing the computer
| | 01:01 | name instead of an IP address,
but here is the URL that always works.
| | 01:07 | Go up to the address bar and change
either the IP address or the computer name,
| | 01:11 | whichever showed up, to
this IP address, 127.0.0.1.
| | 01:19 | Then press Return and now you
should definitely see this page.
| | 01:23 | The IP address that starts with 127 is
a globally used IP address that refers
| | 01:29 | to the local computer.
| | 01:31 | It's used on Mac, Windows, Linux,
and other operating systems.
| | 01:35 | There's a name that goes with it.
| | 01:37 | Instead of 127.0.0.1, you can instead use
localhost and that should work as well.
| | 01:44 | Now let's take a look at where
these files are stored on your Mac.
| | 01:48 | Now let's return to the Sharing dialog.
| | 01:50 | Lion has added a couple of
useful buttons to this interface.
| | 01:54 | There is a button above called
Create Personal Website Folder--
| | 01:57 | I'll show you that in a moment--and
this one Open Computer Website Folder.
| | 02:02 | When you click the button it takes you to
your document root folder on your Mac hard disk.
| | 02:08 | You'll find that it has this file,
index.html, and some graphic files that might
| | 02:12 | or might not be showing up on your screen.
| | 02:15 | There's also this folder, postgresql.
This is new to Lion.
| | 02:20 | It contains documentation for the
PostgreSQL database, and it's not relevant to
| | 02:25 | what we're doing here,
so I won't talk about it anymore.
| | 02:29 | I'm going to show you exactly where
this folder is located on the disk.
| | 02:32 | I'll make sure that I've deselected
all the files and folders in this screen.
| | 02:37 | Then I'll go to the Finder menu
and choose View > Show Path Bar.
| | 02:42 | Down at the bottom of the screen,
that will show that this folder is under
| | 02:45 | Library > WebServer > Documents.
| | 02:49 | If you're using the Apache HTTP server,
this is where you put your HTML, graphics,
| | 02:55 | PHP files, and other files that you
want to be able to browse from the browser.
| | 03:00 | We call it the document root folder.
| | 03:03 | On Mac OS X there is also a concept
of a personal document root folder.
| | 03:08 | Each user can have a folder named
Sites, with an uppercase S, which is also
| | 03:13 | accessible from a browser.
| | 03:15 | I'll go back to my Sharing dialog and
show you that there's a link here with the
| | 03:18 | original URL and the syntax
ampersand and then username.
| | 03:24 | My username is simply lyndadotcom, so
this would refer to the Sites folder
| | 03:28 | under my home directory.
| | 03:31 | I'll click the link and you'll see
that there's a message saying I don't have
| | 03:34 | permission to access
that folder, and here's why.
| | 03:38 | On Lion that folder does not
exist by default for new users.
| | 03:44 | I'll go back to Finder and go to the
menu and choose Go > Home, and I'll show
| | 03:50 | you that there is no sites folder here.
| | 03:52 | There is the Desktop, the Documents, and so
on, but that folder has not been created yet.
| | 03:58 | So, going back to Sharing, this is
where this button comes into play.
| | 04:03 | I'll click Create Personal Website Folder
and then Open Personal Website Folder,
| | 04:10 | and I'll see that I have a file called
index.html and a folder named images.
| | 04:15 | And looking at the path bar at the
bottom, I'll see that I can now do have a
| | 04:19 | Sites folder in my lyndadotcom home folder.
| | 04:23 | I'll double-click lyndadotcom and show you
that that's where the folder has been created.
| | 04:28 | Going back to Sharing, I'll click that
link again, and this time I see files that
| | 04:34 | have been created for me.
| | 04:36 | Now just like the computer's own web
site, you can either use the URL that's
| | 04:41 | generated here or you can use
127.0.0.1 or you can also use localhost.
| | 04:53 | So if you're able to access both the
computer's web site, which is in that
| | 04:57 | Library > WebServer > Documents
folder, and your personal web site, which is
| | 05:02 | in the Sites folder, under your home
directory, you have Apache completely
| | 05:06 | set up and ready to use.
| | Collapse this transcript |
| Activating Apache on Mountain Lion| 00:00 | In OS X 10.8, Mountain Lion, Apple has made
a big change in how you use Apache and PHP.
| | 00:08 | Apache is still included with the
operating system, but the user interface has
| | 00:13 | changed significantly.
| | 00:15 | If you go up to System Preferences and
from there, to Sharing, you won't find Web
| | 00:20 | Sharing listed anywhere; it's been
completely removed from the user interface.
| | 00:25 | As I said, Apache is still there,
but you have to turn it on and off from the
| | 00:30 | command line, and I'll
show you how to do that here.
| | 00:32 | I'll close the System Preferences
application, and I'll go to Terminal.
| | 00:38 | Terminal is your command
line access to your Mac.
| | 00:41 | To start Apache, use this command.
| | 00:44 | Start off with sudo. R=That stands for
super user do. Then type in the name of
| | 00:50 | the Apache Control Application,
apachectl, and after a space, start.
| | 00:58 | That's saying start the Apache server.
| | 01:01 | Because you're executing the command as
a super user, you're challenged for your
| | 01:05 | administrative password.
| | 01:07 | I'll type in the password, press
Return, and that should start up the server.
| | 01:13 | To test it I'll go to a browser and
I'll type in "localhost," and I should get
| | 01:21 | back the response "It works," a very
simple HTML page that's already in the
| | 01:26 | document root of your Apache server.
| | 01:29 | Now, if you don't see
this right away, be patient.
| | 01:32 | On many initial installations of
Mountain Lion, it takes a long time to resolve
| | 01:37 | the DNS name localhost.
| | 01:39 | It equates to 127.0.0.1 if you're
using IPv4 and to another string if you're
| | 01:48 | using IPv6, but this introduction of
IPv6 in Mountain Lion has caused an issue
| | 01:55 | with how long it might take to
resolve the URL in your browser.
| | 02:00 | You can wait a minute or two and it
will almost certainly work, but that's
| | 02:05 | frustrating when you're doing development.
| | 02:07 | So I'll show you a workaround if
you're experiencing this slowness.
| | 02:12 | You can simply disable IPv6 on your
computer and as long as you don't need this
| | 02:17 | new feature for the rest of your work,
you'll be able to get to localhost
| | 02:21 | instantly, right after starting up the server.
| | 02:24 | To do this, I'll go back to Terminal.
| | 02:28 | I'll start by using a
command called networksetup.
| | 02:31 | I'll type "networksetup" and
then "-listallnetworkservices."
| | 02:38 | Make sure you spell this exactly as you
see it here: all lowercase and all one word.
| | 02:44 | That should give you a list of
the services on your computer.
| | 02:47 | Your list might be different from mine.
| | 02:50 | You're looking for a service named
Ethernet, and if you see it there, as you
| | 02:54 | should, that's the thing
that's slowing you down.
| | 02:58 | Here is how you turn off IPv6.
Just as you did when you were starting up
| | 03:03 | Apache, start with sudo.
| | 03:06 | Then once again type "networksetup" and
then "setv6off" and after another space, the
| | 03:14 | name of the service, Ethernet.
| | 03:17 | You're saying disable IPv6 completely.
| | 03:20 | Don't make it a part of my operating system.
| | 03:23 | I'll press Return, and I shouldn't get
back any response, but I also shouldn't
| | 03:28 | get back any errors.
| | 03:30 | I'm going to restart Apache.
| | 03:33 | I'll type in "clear" to clear the screen.
| | 03:36 | Then I'll once again use
sudo apachectl, then stop.
| | 03:43 | Then I'll press the up arrow, and I'll
press it a few times until I get back to
| | 03:47 | my start command, and I'll press Return again.
| | 03:50 | I can then go back to the browser and
refresh with Command+R. Regardless of
| | 03:56 | whether you were seeing the slowdown before,
you should now see the default page instantly.
| | 04:01 | The location of your document root
folder is exactly the same as it was in
| | 04:06 | previous versions of OS X.
To get to it, go to Finder.
| | 04:11 | Then go to the Menu and choose Go > Go to Folder.
| | 04:16 | From there, type in
"/Library/WebServer/Documents" and it is case-sensitive.
| | 04:27 | That should take you to the folder
that contains your HTML page and any other
| | 04:31 | assets. And if you're creating your
own website or your own PHP-based web
| | 04:36 | application, this is where
you would put your files.
| | 04:40 | These are the steps you follow to
configure the Apache server when you only need
| | 04:45 | a single web server for your entire machine.
| | 04:48 | But when you're doing development,
you'll frequently want to use a personal site
| | 04:52 | folder, and I'll show you how to
configure that in the next video.
| | Collapse this transcript |
| Configuring personal site folders on Mountain Lion| 00:00 | In versions of OS X prior to 10.8,
Mountain Lion, Apple had a feature that let
| | 00:06 | you easily create a personal website
folder, a subfolder of your home folder
| | 00:11 | named sites, and you could put your own
website assets there and address it as
| | 00:16 | its own distinct website.
| | 00:19 | As I showed previously, the user
interface for controlling Apache is gone in
| | 00:23 | Mountain Lion, but you can do the same
thing in Mountain Lion manually, by just
| | 00:28 | following a few steps in
Terminal and in a text editor.
| | 00:32 | The first step is to create the folder.
| | 00:35 | I'll go to Finder and I'll
start in the Desktop folder.
| | 00:39 | Then I'll hold down the Command key and
press the up arrow and that takes me to
| | 00:44 | my home folder, and this is where
I'll create a new sites folder.
| | 00:49 | I'll right click in the folder and
select New Folder and name it Sites, with an
| | 00:54 | uppercase S. You can name this anything
you want--it doesn't have to be sites--
| | 01:00 | but I'm going to show you how to
imitate the behavior of previous versions of
| | 01:04 | the operating system.
| | 01:05 | So the Sites folder has been created, and now
we just need to add a little bit of content.
| | 01:11 | I'm going to use TextWrangler to
create a very simple HTML file.
| | 01:16 | You can use any text editor that you
prefer, such as Dreamweaver or Coda.
| | 01:21 | I'll go to Spotlight and type in
TextWrangler and open the application.
| | 01:26 | I'll start by creating a pair of HTML
tags, then a pair of body tags, and then
| | 01:33 | within the body, a pair of h1s.
| | 01:36 | Within the h1 tags, I'll type in
"This is my personal website."
| | 01:43 | Then I'll save this file and I'll
place it in that new Sites folder.
| | 01:47 | Just as I did before, I'll go to my Home
folder, which is named lyndadotcom on my computer.
| | 01:54 | From there, I'll go down to the Sites
folder and then I'll name the file index.html.
| | 02:01 | So now I have a simple default web page.
| | 02:04 | The next step is to add a
configuration to Apache that tells Apache when the
| | 02:10 | user types in a URL that ends with
tilde and then my username, it means to
| | 02:16 | open the files in this folder.
| | 02:18 | I'll close down TextWrangler
and I'll now go to Terminal.
| | 02:23 | In Terminal, I'll switch to the
users folder underneath the Apache
| | 02:27 | installation folder.
| | 02:29 | I'll type cd /etcetera/apache2/users/.
| | 02:38 | This users folder will contain one
configuration file for each user who has
| | 02:43 | a personal website.
| | 02:45 | If this is a brand-new installation of
Mountain Lion and you list out all the
| | 02:49 | files with LS, you should see that
there aren't any configuration files there.
| | 02:54 | If you upgraded Mountain Lion from
an older version of OS X, you might see
| | 02:59 | conf files for each user on the computer.
| | 03:02 | Your job is to create a
configuration file for your user profile.
| | 03:07 | To do this, we'll use the editor
that's included with OS X. It's named pico.
| | 03:14 | Its user interface is a little clunky, but it
knows how to create system and hidden files.
| | 03:19 | Start by typing sudo for super-user do,
then pico, then your username, and this
| | 03:27 | should match the name of your home folder.
| | 03:30 | I'll type lyndadotcom.
| | 03:33 | Then follow that with the file extension .conf.
| | 03:37 | You're saying, create this file
and open it in the pico editor.
| | 03:41 | When you press Return, you might be
prompted for your administrative password.
| | 03:45 | If so, type it in and press Return,
and that opens your new file in the editor.
| | 03:51 | Now I'll type in some text.
| | 03:54 | As you will follow along,
typing in exactly as I'm doing here.
| | 03:57 | It is case-sensitive.
| | 04:00 | I'll start with the directory tag.
| | 04:02 | I start with the beginning tag token,
a less then character, then the word
| | 04:06 | Directory with an uppercase D. Next is
the physical name of your Sites folder.
| | 04:12 | That's the folder you just created.
| | 04:14 | After a double quote, start with
/Users, then after another slash
| | 04:20 | the name of your home folder.
| | 04:22 | Again, for me that will be lyndadotcom.
| | 04:25 | Then after another slash, the name of
the subfolder you created, and I created a
| | 04:30 | subfolder called Sites, then close the tag.
| | 04:35 | On the next line, you'll start adding
some keywords that tell Apache how this
| | 04:40 | folder should be treated.
| | 04:42 | Start with Options, then
Indexes, and then MultiViews.
| | 04:49 | On the next line type in
AllowOverride All. It looks like this.
| | 04:56 | On the following line type in
Order, with an uppercase O, then in all
| | 05:00 | lowercase allow,deny.
| | 05:03 | That means that when evaluating
permissions for this folder, Apache should give
| | 05:08 | precedence to allow commands.
| | 05:11 | Then on the next line type in, Allow from
all, and finally close the directory tag.
| | 05:18 | I'll press Return one more time,
and I'll review what I've typed.
| | 05:23 | Make sure that you type this in exactly right.
| | 05:26 | You can always come back and edit it
again later by executing that same pico
| | 05:30 | command in Terminal, but it's best
if you get it right the first time.
| | 05:34 | Once you have confirmed that you've
type everything correctly, press Ctrl+X to
| | 05:40 | exit pico, type in Y for Yes, and
then Return to confirm the file name.
| | 05:46 | When you come back to the command line,
type ls and once again list the files
| | 05:51 | and you should see that the
configuration file has been created.
| | 05:55 | Now restart Apache.
Type in sudo apachectl restart.
| | 06:02 | You won't see any response, but that
relaunches the Apache server, and it will
| | 06:07 | read that configuration
file and be ready to respond.
| | 06:11 | Let's review all the steps that we followed.
| | 06:14 | We created the Sites folder and
we populated it with some content.
| | 06:18 | In Terminal, we added a
configuration file for the current username and
| | 06:23 | then restarted Apache.
| | 06:25 | Now I'll test my personal folder.
| | 06:29 | I'll go to my browser, and I'll type in
the URL http://localhost and then the
| | 06:36 | tilde character and my username.
| | 06:39 | And when I press Return, I see my
personal webpage is displayed with the
| | 06:43 | content that I typed in.
| | 06:45 | You can follow this process for any
user on the computer, creating configuration
| | 06:50 | files that create exactly the same
personal website as was created more
| | 06:55 | automatically on older versions of OS X.
| | Collapse this transcript |
| Activating PHP on Mac OS X| 00:00 | Mac OS X includes PHP, along
with the Apache HTTP server.
| | 00:06 | Version 10.5 of the operating system,
Leopard, includes PHP 5.2, while versions
| | 00:13 | 10.6, Snow Leopard, and 10.7,
Lion, both include PHP 5.3.
| | 00:19 | PHP isn't enabled by default, though.
| | 00:21 | You have to activate it.
| | 00:23 | I'll show you how to do that.
| | 00:24 | First, go to your Web Sharing dialog
and for the moment, turn Web Sharing off.
| | 00:30 | Then you'll go to Terminal
and open a command window.
| | 00:33 | If you've never used Terminal before,
you can find it easily by going to
| | 00:37 | Spotlight in the upper-right corner,
typing "terminal," and pressing Return.
| | 00:42 | Now to make it easy to get to
Terminal in the future, go to your Dock,
| | 00:46 | right-click on Terminal and
choose Options > Keep in Dock.
| | 00:52 | Now, you're going to edit
the HTTP configuration file.
| | 00:56 | I'm going to use an editor that's
included with Mac OS X called pico, or P-I-C-O.
| | 01:01 | I'll start with the command "sudo."
| | 01:04 | That stands for superuser do and allows
me to do anything I want on this computer.
| | 01:10 | Then I'll type pico the name of the
editor and then the location and name of the
| | 01:14 | HTTP configuration file,
/etc/apache2/httpd.conf.
| | 01:25 | Make sure you type this in
all lowercase. Press Return.
| | 01:31 | If you're prompted for your
administrative password, type it in and press Return,
| | 01:36 | and that will open the HTTP
configuration file in pico.
| | 01:40 | Now locate the line of code that activates PHP.
| | 01:44 | Pico is completely a keyboard-oriented editor;
| | 01:48 | you won't be able to use the mouse.
| | 01:49 | You'll see keyboard
shortcuts listed at the bottom.
| | 01:52 | Press Ctrl+W for where is, or
find, type "php," and press Return.
| | 01:59 | This should take you to a
LoadModule command that references PHP 5.
| | 02:05 | Notice there's a hash mark, or pound
sign, at the beginning of the line.
| | 02:08 | That's a comment, and it's
deactivating PHP right now.
| | 02:13 | Using your arrow keys, move over to the
left and then backspace over the pound
| | 02:17 | sign, and now PHP is activated.
| | 02:20 | Exit and save the file.
| | 02:22 | Press Ctrl+X, Y for yes, and Return.
| | 02:28 | And now you've made the required
change to the configuration file.
| | 02:32 | The next step is to create
a PHP initialization file.
| | 02:36 | This goes into a folder called
/private/etc, and this file needs to be named php.ini.
| | 02:44 | It doesn't already exist on your
system, but there is a beginning file
| | 02:48 | there that you can copy.
| | 02:50 | Type the following command to
change to the right directory:
| | 02:53 | cd /private/etc. And then list all
files that start with the letters php.
| | 03:04 | Type "ls php*" and press Return.
| | 03:10 | You should see a file named php.ini.default.
| | 03:14 | You might see other files there,
depending on how your computer was configured,
| | 03:18 | but the default file is the only one you need.
| | 03:21 | Now you'll copy that and
create the new file named php.ini.
| | 03:26 | Type "sudo cp" for copy, and type the
name of the existing file, "php.ini.default"
| | 03:36 | and then after a space, the name of the file
you want to create "php.ini" and press Return.
| | 03:43 | Once again list the php files with ls php*
and you should see the new file is there.
| | 03:50 | Now, that's all you have to do, but if
you want to make any changes to the ini
| | 03:55 | file, you can again use the pico
editor or any text editor that you prefer.
| | 04:00 | I'll type "sudo pico ./php.ini."
| | 04:05 | Now I'm going to make one change that I
always make to my PHP configuration when
| | 04:10 | I'm doing local development.
| | 04:13 | If I encounter a PHP error, I want
the error to print in the HTML that's
| | 04:17 | returned to the browser.
| | 04:19 | This capability is turned off by default.
| | 04:22 | To find it, press Ctrl+W and type
"display_errors" and press Return.
| | 04:30 | The first time you search
you'll get to some documentation.
| | 04:33 | Press Ctrl+W and Return again and
now you get to the actual configuration.
| | 04:39 | Change the value of
display_errors from Off to On.
| | 04:44 | Once again, exit and save.
| | 04:46 | Press Ctrl+X, Y for yes, and Return.
| | 04:50 | Now, you'll turn Apache back on again.
| | 04:53 | Go back to your Sharing dialog and check
Web Sharing and Apache should start correctly.
| | 04:59 | Now to test PHP, I've provided a file
in the Free Exercise Files that you can
| | 05:04 | copy to your web root.
| | 05:07 | Go to the Free Exercise Files and copy
the file phpinfo.ini to the clipboard.
| | 05:13 | Then navigate to your root folder.
| | 05:16 | That's under the Macintosh root folder,
Library/WebServer/Documents, and
| | 05:25 | paste the file into that location.
| | 05:29 | To test this, go to any browser
and then type in the following URL,
| | 05:33 | "http://localhost/phpinfo.php."
| | 05:41 | If everything is working correctly,
you should see this generated HTML page,
| | 05:46 | which tells you which version of PHP
you're using and, as you scroll down, all
| | 05:50 | sorts of other important
information about your PHP environment.
| | 05:54 | One of the most important bits of
information you should see is the name and
| | 05:58 | location of your loaded configuration
file, which is /private/etc/php.ini when
| | 06:06 | you're using the versions of Apache
and PHP that are included with Mac OS X.
| | Collapse this transcript |
| Installing MySQL on Mac OS X| 00:00 | Unlike the Apache Web Server and PHP,
the MySQL database is not installed by
| | 00:06 | default with Mac OS X. So if you want
to use the database you have to download
| | 00:10 | it and install it yourself.
| | 00:12 | You can get the free Community
Server edition of MySQL by going to
| | 00:16 | www.mysql.com/downloads and
click on MySQL Community Server.
| | 00:24 | Scroll down the screen and you'll see
that there are a number of different
| | 00:27 | installers for Mac OS X. There are
different compression versions. There are
| | 00:32 | TAR Archives and DMG Archives, but there are
also 32 and 64 bit versions of the database.
| | 00:40 | You should install the version
that matches your version of Mac OS X.
| | 00:44 | Now if you have a relatively new
Mac with an Intel chip, you're almost
| | 00:49 | certainly running 64-bit Mac, but if you want
to make absolutely sure here's a little trick.
| | 00:54 | Go to Terminal and then
type in the following command.
| | 00:59 | Type it in exactly shown here.
| | 01:01 | It is case-sensitive.
| | 01:02 | ioreg -l -p IODeviceTree,
then the pipe character, which is
| | 01:13 | a character on the same key as
the backslash, then grep space and
| | 01:19 | finally firmware-abi.
| | 01:23 | You're executing a command that will tell
you which version of Mac OS X you're running.
| | 01:28 | Press Return. If the output includes the
string EFI64 then you're running 64-bit Mac.
| | 01:36 | I'm running 64-bit Mac OS X, so I'm going
to use this version of the database server.
| | 01:41 | Mac OS X version 10.6 (x86, 64-bit)
DMG archive. If you're running an older
| | 01:48 | version of Mac OS X such as Leopard
use the appropriate version of MySQL.
| | 01:54 | Now I've already downloaded this
DMG files to my desktop and I'll run
| | 01:57 | through the installation.
| | 01:58 | I double-click the DMG file to open it
and I'll find three installers, one for
| | 02:05 | the database, one for an item that will
go into the System Preferences pane, and
| | 02:10 | one for something called MySQL startup item.
| | 02:14 | I'm going to install the first two.
| | 02:16 | I'll start with the database.
| | 02:18 | I'll double-click the DMG file and
click Continue. I click Continue again I'll
| | 02:25 | review the license agreement and if I
agree with this terms I'll click Continue
| | 02:28 | and then agree. I'll click
Continue and click Install.
| | 02:35 | If prompted for a password, type
your administrative password in.
| | 02:40 | It takes just a few minutes to write
the files to your disk and execute a few
| | 02:44 | simple configurations.
| | 02:51 | After the installation is complete, close the
application and go back to your virtual disk.
| | 02:57 | Next I'll install the item for the
System Preferences. I will double-click and
| | 03:03 | then at the prompt I'll choose Install
for all users of this computer and then
| | 03:07 | click Install. When prompted out once
again typing my administrator password.
| | 03:14 | This adds an item to the System
Preferences pane that will let you easily stop
| | 03:18 | and start your MySQL server.
| | 03:21 | I'll click the Start button, once
again typing my password ,and after a few
| | 03:27 | moments MySQL server is running.
| | 03:29 | If I later want to stop the
server I just click the button again.
| | 03:35 | To get back to this panel, go to System
Preferences item on the Apple menu and
| | 03:41 | you'll find MySQL in the Other
section of the System Preferences.
| | 03:46 | So that's to look at how to determine
which version of MySQL you should install,
| | 03:50 | how to get and install the software
from MySQL, and then how to use the System
| | 03:55 | Preferences pane to stop and start the server.
| | Collapse this transcript |
| Setting the root user password| 00:00 | When you first install MySQL on Mac OS
X using the native binaries from MySQL,
| | 00:07 | the root user is created with a blank password.
| | 00:10 | You typically want to create a
password for the root user before starting on
| | 00:14 | your development work.
| | 00:16 | Here is how you can do it.
| | 00:17 | First make sure that MySQL is running.
I'll go to the System Preferences pane
| | 00:23 | and click Start MySQL Server. If
prompted type in your administrator password.
| | 00:28 | Then I'll go to Terminal.
| | 00:32 | In Terminal I'll switch to the
directory that contains the MySQL binaries.
| | 00:37 | I'll type cd /USR/local/mysql/bin.
| | 00:47 | I'll type ls and show you that
there's a list of available applications.
| | 00:52 | Now to confirm that the root user can
be used without a password, type in this
| | 00:57 | command, ./mysql -u root.
| | 01:05 | That's the name of the root user.
| | 01:07 | When you press return it should start
the MySQL monitor without prompting you
| | 01:12 | for a database password.
| | 01:14 | If you see this then you are confirming
that the root user is set up without a
| | 01:18 | password. Type exit and then
press Return to exit the monitor.
| | 01:24 | Here is the command to set a root user.
| | 01:26 | password. ./mysqladmin -u root.
| | 01:34 | That means I'm using the SQL
administrative tool as the root user.
| | 01:39 | Then I'll type password and the
string that I want to set the password to.
| | 01:45 | I'll type in the string password.
I'll press Return and now the root user
| | 01:51 | password has been set.
| | 01:53 | If you then try to enter the MySQL
monitor again, access will be denied.
| | 01:58 | I'll type in ./mysql -u root
and I get an access denied message.
| | 02:06 | So now that you've installed MySQL and
configured the root user with a password,
| | 02:10 | you're ready to start using the
database from your selected MySQL client.
| | 02:15 | In the last video of this chapter,
I'll show you how to install and use an
| | 02:19 | application from MySQL called MySQL
Workbench that will let you connect to your
| | 02:25 | server and create some simple data.
| | Collapse this transcript |
| Installing phpMyAdmin on Mac OS X| 00:00 | There are many great free tools to allow
you to manage your MySQL databases, but one
| | 00:05 | of the simplest and easiest to get
started with is phpMyAdmin, a free web
| | 00:10 | application which you can
download from www.phpmyadmin.net.
| | 00:16 | You can either go to this site and
download the most recent version, or you
| | 00:20 | can use the version that I've included in the
free exercise files that come with this course.
| | 00:25 | To use that version, go to the
Free Exercise Files, to phpMyAdmin.
| | 00:31 | The entire web application is
in this very small zip file.
| | 00:35 | Extract the zip file, then move the
resulting folder, phpMyAdmin with the version
| | 00:41 | number, to your Apache document root.
| | 00:44 | To do that, I'll press
Command+N to create a new finder window,
| | 00:49 | I'll go to the Mac hard drive root, then
to Library/WebServer/Documents, and
| | 00:55 | then I'm going to drag this
folder into the document root.
| | 01:00 | After it's been dragged into place,
I'll rename it with simply phpmyadmin.
| | 01:06 | You can name the folder anything you
want, but by naming it simply phpmyadmin
| | 01:11 | all lowercase, it will make it very
easy to access from the web browser.
| | 01:15 | Now let's check a few things
before we try to fire it up.
| | 01:18 | Go to your System Preferences dialog
and from there, to the MySQL pane, and make
| | 01:25 | sure that MySQL is running.
| | 01:26 | Then you can close that dialog.
| | 01:29 | You're done with that for now.
| | 01:31 | Then go to a browser and navigate to
the URL http://localhost/phpmyadmin.
| | 01:41 | You should see this login dialog.
| | 01:43 | If you try to log in right now, it's
not going to work, even if you type in the
| | 01:47 | correct username and password
for your MySQL Installation.
| | 01:51 | I will type in type in "root" and then my
password and click Go, and I will see an
| | 01:57 | error saying, "Cannot log in to the MySQL Server."
| | 02:00 | There's also a very obscure
message down at the bottom:
| | 02:03 | "The mcrypt extension is missing.
Please check your PHP configuration."
| | 02:07 | All of these problems can be easily
solved with a very small configuration file,
| | 02:11 | and I have provided the most minimal
version of this configuration file, again,
| | 02:15 | in the free exercise files.
| | 02:17 | I'll go to the Free Exercise Files, to
the phpmyadmin folder, and I am going to
| | 02:23 | use this file, config.inc_MAC.php.
| | 02:29 | Now I want to leave the original file
in place, so I'm going to copy that to
| | 02:33 | the clipboard, then I'll go back to my
document root folder, to phpmyadmin, and
| | 02:40 | I will paste by pressing Command+V. Now I'm
going to rename the file, taking out the _MAC.
| | 02:48 | I'll click on the file once and then
press Return and then remove _MAC, so that
| | 02:54 | the actual name of the file is config.inc.php.
| | 03:00 | Next, I am going to edit it.
| | 03:02 | You can use any text editor for this
purpose. And I'll show you that this file
| | 03:07 | has some basic settings in it.
| | 03:09 | The socket configuration on the fourth
line is referring to something called
| | 03:13 | a socket file, which is created
automatically by MySQL when it starts up on your system.
| | 03:19 | On Mac OS X, this file is in the TMP folder.
| | 03:23 | You shouldn't have to change that line at all.
| | 03:25 | The next line refers to the username.
| | 03:27 | I am using root, the administrative
user that's created automatically when you
| | 03:32 | install MySQL--and again, you
can use that for local development.
| | 03:37 | Next is the password.
| | 03:38 | I have simply password, but you should
change this to reflect your MySQL password.
| | 03:44 | The next item, auth_type, changes to
a different authentication model named
| | 03:48 | config, and this will remove that
confusing mcrypt error that you saw earlier.
| | 03:53 | And finally, there's a
configuration item named AllowUserDropDatabase.
| | 03:58 | By default, you as an individual user won't
be able to drop or delete your own databases.
| | 04:04 | I've reset that value to true.
| | 04:06 | So if you need to make changes to the
user and password, go ahead and do it
| | 04:09 | and save your changes, but leave everything
else alone and then close your text editor.
| | 04:15 | Now to test go back to your browser,
once again type localhost/admin, and when it
| | 04:21 | opens, it may show the same screen,
but press Command+R to refresh the screen
| | 04:26 | and now phpMyAdmin should open correctly.
| | 04:30 | To test and make sure that you can
create and delete databases, I have
| | 04:34 | provided an SQL file.
| | 04:36 | First click Databases and create a new database.
| | 04:40 | I'm going to name it
explorecalifornia and click Create.
| | 04:46 | Then over on the left I
will click on my new database.
| | 04:49 | Now, I'm going to import some
structure and data from an SQL file.
| | 04:55 | I'll click Import at the top,
| | 04:57 | choose File, then in my free
exercise files folder, I will choose
| | 05:02 | explorecalifornia.sql.
| | 05:04 | I will scroll down to the bottom and
click Go, and I should see the message that
| | 05:10 | the database has been imported correctly.
| | 05:13 | I can go over to the left side and
see the database in my list, and if the
| | 05:17 | database is selected, I
should be able to browse the data.
| | 05:21 | Now test that you can drop the database.
| | 05:24 | Up at the top of the screen, I will go
to the list of my pages, and I'll click
| | 05:28 | explorecalifornia, and this
takes me back to the database page.
| | 05:32 | I will go to the Operations screen.
| | 05:36 | I'll take a look over on the left, and I should
see a link that allows me to drop the database.
| | 05:42 | This is the tool that was enabled
by that additional configuration in
| | 05:45 | the configuration file.
| | 05:47 | I will click the link and
confirm and now the database is gone.
| | 05:53 | So that's how you get started with phpMyAdmin.
| | 05:56 | I should caution that the minimal
configuration that I provided is perfectly
| | 06:00 | suitable for local development.
| | 06:02 | If you want to put phpMyAdmin on your
production PHP server--that is, a server
| | 06:07 | that's available to the public--check
the phpMyAdmin documentation for the
| | 06:12 | recommended configuration
for a more secure installation.
| | Collapse this transcript |
| Uninstalling MySQL on Mac OS X| 00:00 | If you use one of the software bundles
MAMP or ZAMP on Mac OS X, the process of
| | 00:06 | uninstalling is very easy.
| | 00:07 | You just shut down the servers and
drag the application to the trash.
| | 00:11 | But if you're using the individual
MySQL installation, it's more complex.
| | 00:16 | Here are the steps.
| | 00:18 | First, make sure that MySQL is shut down.
| | 00:21 | You can go to the System Preferences pane.
| | 00:23 | You'll find the MySQL pane in the
other section at the bottom and then just
| | 00:28 | click Stop MySQL Server.
| | 00:31 | Alternatively, you can do
it from the command line.
| | 00:34 | You can go into Terminal and then
I'll change to the directory containing
| | 00:39 | the MySQL binaries.
| | 00:40 | I will type cd /usr/local/mysql/bin.
| | 00:49 | Then I'll type this command,
./mysqladmin -u root. Then if I've added an
| | 00:59 | administrator password I would type in -p.
| | 01:02 | I don't have administrator
password right now so I'll leave it out.
| | 01:05 | And then I'll type shutdown.
| | 01:09 | Then I'll go back to the System
Preferences pane and it'll show that
| | 01:12 | MySQL Server has stopped.
| | 01:15 | Now you're ready to check
the startup status of MySQL.
| | 01:19 | Notice that I have the option to
Automatically Start MySQL on Startup checked.
| | 01:24 | This will be reflected in an entry in
a text file on your system and you'll
| | 01:28 | need to edit that file manually.
| | 01:31 | You can do this through any text
editor that can handle hidden files.
| | 01:35 | As I've indicated in other
videos, I use TextWrangler.
| | 01:39 | In TextWrangler, I'll select File >
Open Hidden, then I'll navigate to a folder
| | 01:46 | named etc under the disk root.
| | 01:50 | Within that folder, I will find the
file named hostconfig and I'll open it.
| | 01:56 | If you see this
configuration line, MYSQLCOM=YES,
| | 02:01 | that's the line that's controlling the
startup setting for MySQL as your system starts up.
| | 02:07 | Delete the line manually.
| | 02:09 | I will press the Delete key.
| | 02:11 | I will be prompted by TextWrangler to unlock
the file and then the line will be removed.
| | 02:17 | Then when I try to save the
file, I'll be prompted for my
| | 02:20 | administrator password.
| | 02:23 | I'll confirm and the change is made
and then I will close the file.
| | 02:29 | Finally, you will remove all of the
elements of MySQL from the Terminal command line.
| | 02:35 | Once again go back to Terminal and I'm
going to need to execute a number of commands.
| | 02:41 | To make this a little bit easier,
I've included a text file in the free
| | 02:44 | Exercise Files folder.
| | 02:46 | It's named MySQLUninstalledOnMac.txt.
| | 02:50 | I will open this file up in my Text Editor and
then I'll copy all of the text to the clipboard.
| | 02:57 | Here is what these lines of code do.
| | 03:01 | The first two lines of code remove the
MySQL folder and all of its contents.
| | 03:05 | There are two entries because there is
both the actual physical folder, which
| | 03:10 | starts with the string MySQL, and a
symbolic link or alias that points to that folder.
| | 03:15 | You're removing both of them.
| | 03:17 | You're also removing the
Startup Item and the Preferences pane.
| | 03:21 | The Receipts folder contains various
elements of MySQL that are created as it is
| | 03:26 | running, and the my.cnf
file is the configuration file.
| | 03:30 | So I have copied all of these commands over to
the clipboard. Then I will go to Terminal again.
| | 03:38 | Before I try to execute the
commands, I'll make sure that I've been
| | 03:41 | authenticated in the current Terminal session.
| | 03:43 | I will type in sudo, the pseudo or sudo
command which stands for Super User Do.
| | 03:51 | And then I'll type in just a single dot.
| | 03:53 | If I'm prompted for my administrator
password, I'll type it in and then I'll
| | 03:57 | see the output command not found.
| | 04:00 | I didn't actually try to run a command there.
| | 04:03 | I used the dot to just
trigger the authentication request.
| | 04:07 | But now I am authenticated for this
session and I can easily execute a whole
| | 04:12 | bunch of commands without being
prompted for the password again.
| | 04:15 | I'll do this by pressing Command+V to
paste in all those commands I copied
| | 04:20 | from the text file.
| | 04:22 | The last command will hang on the line.
| | 04:24 | I will need to press
Return once to execute that.
| | 04:27 | There are certain files and
directories that might or might not exist,
| | 04:31 | depending on which elements of the
installation process you followed and how
| | 04:35 | you've used your copy of MySQL.
| | 04:37 | But once you've executed all of these
commands, MySQL will have been completely
| | 04:42 | removed from your system.
| | 04:44 | You can now safely go on and use any of
the other MySQL implementations, such as
| | 04:49 | the distributions included
in MAMP or ZAMP for Mac OS X.
| | Collapse this transcript |
|
|
3. Installing WampServer on WindowsInstalling WampServer| 00:00 | WampServer is one of the easiest and
fastest to install of the available
| | 00:05 | software bundles for windows.
| | 00:07 | You can download WampServer
from www.wampserver.com/en.
| | 00:13 | Make sure you include the en subfolder
at the end of the URL otherwise you might
| | 00:17 | be downloading the French version.
| | 00:20 | From the Home screen click Download.
| | 00:23 | You'll see five different versions available;
| | 00:25 | three for 64-bit Windows
and two for 32-bit Windows.
| | 00:30 | If you're not sure which version of
Windows you're running, you can go to the
| | 00:33 | Control panel and from there click
System and Security and then System.
| | 00:40 | Check the System type.
| | 00:42 | My computer is running 64-bit Windows.
| | 00:44 | So I'll download a
version of WampServer to match.
| | 00:48 | As of the time of this recording, there were
three different packages for 64-bit Windows.
| | 00:54 | The first listed in the top-
left has Apache 2.2 and PHP 5.3.
| | 01:00 | On the bottom-left there is a version
that includes Apache 2.2 and PHP 5.4, and
| | 01:06 | in the top-right one that
has Apache 2.4 and PHP 5.4.
| | 01:12 | If you're working with a production
environment that you'll be uploading a web
| | 01:15 | site to, you should download a version
of WampServer that most closely matches
| | 01:19 | that production environment.
| | 01:21 | And if you're not sure which version
you'll be working with, check with your
| | 01:25 | Network Administrator or ISP.
| | 01:27 | I'm going to download the latest and greatest,
64-bit Windows with Apache 2.4 and PHP 5.4.
| | 01:36 | I've already downloaded
the installer to my Desktop,
| | 01:39 | and I'll double-click to fire it up.
| | 01:42 | Along the way, if you see any security
dialogs or User Account Control dialogs,
| | 01:47 | click Yes or OK to continue.
| | 01:50 | I'll click Run from this initial
dialog box, click Yes on the User Account
| | 01:54 | Control dialog box and that
takes me to the initial Setup screen.
| | 01:59 | On this screen, I see the exact versions
of all the software that I'll be installing.
| | 02:04 | I'll click Next, read through the
License Agreement and then if I agree with
| | 02:08 | it, click Next again.
| | 02:11 | Now I'll indicate where I
want to install WampServer.
| | 02:14 | The default folder for WampServer is c:\wamp.
| | 02:19 | I'll accept that default and click Next.
| | 02:22 | I'll select Create a Desktop Icon.
| | 02:24 | This will create a Desktop icon that
I can use to restart WampServer later.
| | 02:30 | I'll click Next and then I'll click Install.
| | 02:34 | It'll take a few minutes to copy all of the
files over to your hard disk. Be patient.
| | 02:39 | There's a lot of files to copy over.
| | 02:42 | This Windows Explorer dialog is asking you
for the location of your default web browser.
| | 02:48 | You can browse and select a specific
web browser that you'll use to open
| | 02:52 | phpMyAdmin and the WampServer
homepage or you can just use your system web
| | 02:57 | browser by clicking Open.
| | 03:00 | On this screen, you are asked
for your PHP mail parameters.
| | 03:04 | If you have an SMTP server, that is an
email server, through which you want your
| | 03:08 | PHP server to send mail, you can add
the URL here and add your email address.
| | 03:15 | If you're not going to set
that up, you can just click Next.
| | 03:18 | The installation is now complete.
| | 03:20 | I'll leave the option checked to Launch
WampServer immediately and click Finish.
| | 03:25 | And then if prompted by User
Account Control, I'll click Yes again.
| | 03:30 | You get to the WampServer admin
menu by going down to the system tray.
| | 03:34 | When WampServer starts up, you
should see a system tray icon.
| | 03:38 | And if you don't see it here check
your hidden icons, it might appear there.
| | 03:43 | Click the icon and you'll see
the WampServer admin menu appear.
| | 03:48 | To test your WampServer
installation, choose Localhost.
| | 03:52 | That will open up a web browser and it
should open up the WampServer homepage.
| | 03:58 | If you have trouble opening the homepage,
click your browser's Stop button and
| | 04:02 | then your Refresh button and see if it appears.
| | 04:05 | The WampServer homepage will show
you the currently installed versions of
| | 04:09 | Apache, PHP and MySQL.
| | 04:12 | We'll have a couple of links to valuable tools.
| | 04:16 | Click phpinfo() and that will take you
to a page that shows you all the details
| | 04:22 | of your PHP installation.
| | 04:24 | It'll show you which PHP version
you're running and most importantly, the
| | 04:28 | location and name of your
Loaded Configuration File.
| | 04:32 | You might need to make
changes there, so make a note of it.
| | 04:36 | I'll click the Back button
and then I'll go to phpMyAdmin.
| | 04:41 | phpMyAdmin is the web-based application
you can use to manage your MySQL databases.
| | 04:48 | If phpMyAdmin opens, then you're
successfully running Apache, PHP and MySQL.
| | 04:56 | You can also test your database
installation by using a file that's delivered
| | 05:00 | with your WampServer installation.
| | 05:02 | I'll minimize my browser and
then go to Windows Explorer,
| | 05:06 | and go to the new folder C:wamp,
and from there to a folder named www.
| | 05:14 | This is your document root folder,
the folder where you'll place your
| | 05:18 | PHP-based web site files.
| | 05:20 | I'm going to take a look
at this file, testmysql.php.
| | 05:25 | Again, this file is delivered
automatically with WampServer.
| | 05:29 | I'll open it in a text editor.
| | 05:31 | I'm using Notepad, but
you can use any text editor.
| | 05:35 | I'll change the hostname, the
database user and the database password.
| | 05:40 | The defaults will be localhost for the
database URL, root for the username and a
| | 05:47 | blank string for the password.
| | 05:48 | These are the default settings.
| | 05:51 | You can change them if you like.
| | 05:54 | I'll save and close this file.
| | 05:56 | Then I'll go back to my
browser and I'll change the URL to
| | 06:00 | http://localhost/testmysql.php.
| | 06:07 | If you see Connection OK,
everything is working fine.
| | 06:10 | You can explore other aspects of the
WampServer interface by going again to the
| | 06:15 | Admin menu and taking a look at some of
the many options that are available, to
| | 06:20 | stop, restart and otherwise
configure your WampServer installation.
| | Collapse this transcript |
| Managing WampServer| 00:00 | The WampServer administrative menu,
which you reach from the system icon,
| | 00:04 | gives you the ability to manage your
WampServer installation, once it's up and running.
| | 00:08 | You can start and stop the services,
either all at once or individually.
| | 00:13 | To stop and start Apache, go to the
Apache folder, to Service, and then you can
| | 00:19 | stop or restart the service from here.
| | 00:22 | You can also go to MySQL, to
Service, and you can stop and start the
| | 00:26 | service from here as well.
| | 00:28 | You'll see options under both
Apache and MySQL to Install Service.
| | 00:33 | If you install these, it means that
you're allowing these services to run, even
| | 00:37 | when the WampServer application isn't running.
| | 00:40 | You might do that if you are using
WampServer for production, instead of for
| | 00:44 | local development, but I do recommend
that if you're going to do that, that you
| | 00:48 | reconfigure Apache and MySQL for
better security than is delivered in the
| | 00:53 | default installation.
| | 00:56 | You can also stop and start All services,
| | 00:59 | that is, Apache and MySQL, at the same time.
| | 01:02 | Go under Quick Admin and
make the appropriate choice.
| | 01:06 | As I showed in the earlier video,
you can get to the www directory.
| | 01:10 | That's your document root.
| | 01:12 | And in WampServer 2.1, by default, there are
two files there: index.php and testmysql.php.
| | 01:21 | And, as I already showed,
you can also go to phpMyAdmin.
| | 01:26 | This is the web application that you
can use to manage your MySQL databases.
| | 01:33 | WampServer 2.1 includes two
new tools under the Debug menu:
| | 01:38 | they're named Client XDebug and webGrind.
| | 01:42 | Learning how to use these tools is
outside the scope of this course, but they're
| | 01:45 | worth taking a look at.
| | 01:48 | So that's a look at what's available
in the WampServer administrative menu.
| | 01:52 | You can easily get to your
document root folder, to phpMyAdmin,
| | 01:56 | you can stop and start your
services, and you can open various files
| | 02:00 | directly from the menu.
| | Collapse this transcript |
| Defining directory aliases through WampServer| 00:00 | The Apache web server
supports the concept of aliases.
| | 00:04 | An alias is a virtual directory that
points to a location on disk and you can
| | 00:08 | address the alias through the web
browser and retrieve documents from the
| | 00:12 | disk in this manner.
| | 00:14 | The directories that you set up as
aliases don't need to be under the document
| | 00:17 | root folder. You can make
them independent on your disk.
| | 00:21 | To demonstrate this I've created a
folder under my CDrive root named mywebapp
| | 00:27 | and I've created a simple
file called index.php under it.
| | 00:32 | I'll open the file in Notepad and
show you that it executes a simple PHP
| | 00:36 | command, php.info, which outputs the
current PHP configuration to the screen.
| | 00:42 | Now this directory is not under my
WAMP folder, that's the document root, and I
| | 00:46 | want to make the entire
directory accessible through the browser.
| | 00:49 | So I'll go to the WampServer
administrative menu and choose Apache > Alias
| | 00:55 | directories > Add an alias.
| | 00:59 | That opens up a command-line window.
| | 01:01 | I'll type in the name of the
alias that I want to create.
| | 01:04 | It's going to appear to the browser as a
directory under the localhost or 127.0.0.1 root.
| | 01:13 | I'll name my alias webapp, then I'm
asked to type in the full location of the
| | 01:18 | physical directory, using forward slashes.
| | 01:21 | I'll type c:/mywebapp/ and press Enter.
| | 01:28 | That creates the alias.
| | 01:30 | Next, I'll go to the WampServer
administrative menu and I'll make sure that the
| | 01:35 | Apache web server is restarted by
checking the color of the gauge.
| | 01:39 | If it's not white, just open up the
menu and choose Restart All Services.
| | 01:44 | Once the gauge shows you that all the
services have restarted, you can go to a
| | 01:49 | browser and test the new alias.
| | 01:51 | I'll type in http://localhost/webapp/
index.php and if the alias is working
| | 02:03 | correctly, I should see the output of the PHP
info command, showing me my PHP configuration.
| | 02:10 | If you don't see this display, if for
example you see the actual PHP code or
| | 02:16 | you're prompted to download the PHP
file to your hard disk, that means Apache
| | 02:20 | didn't successfully restart.
| | 02:23 | You should stop Apache completely and
then restart and if all else fails reboot
| | 02:28 | your computer to continue onward.
| | 02:31 | You can add as many aliases to
your Apache configuration as you like.
| | 02:35 | The advantage of an alias is that
the folder containing your web files is
| | 02:39 | outside the WAMP document root and
therefore outside the WAMP installation root folder.
| | 02:44 | You can manage your files much more
easily, but you can also add whatever PHP files,
| | 02:49 | HTML files, image files, and other web
assets you need to construct your web site.
| | Collapse this transcript |
| Changing software versions with WampServer add-ons| 00:00 | WampServer makes it very easy to
switch between different versions of each of
| | 00:05 | its software components.
| | 00:07 | Let's say for example that you are
working with the legacy PHP and MySQL
| | 00:10 | application and the production
environment for this application uses an older
| | 00:15 | version of MySQL, MySQL 5.1.
| | 00:19 | When you installed WampServer, you got
the most recent version of MySQL, 5.5,
| | 00:24 | but you can install the two versions
side-by-side and you can do this with all
| | 00:29 | three components: Apache, PHP and MySQL.
| | 00:34 | These are called add-ons.
| | 00:36 | To get to the add-ons, go to the
WampServer Downloads Screen and scroll down a
| | 00:40 | bit and you'll see links for
PHP, Apache and MySQL add-ons.
| | 00:46 | There's also a link for Beta add-ons, but
these are actually full installers of WampServer.
| | 00:51 | There is one there, for example, that
let's you install the most recent version
| | 00:55 | of PHP 5.4 as a Beta.
| | 00:59 | I'm going to demonstrate
multiple versions of MySQL.
| | 01:02 | But again you can do this
with Apache and PHP as well.
| | 01:06 | I'll click the link, Download MySQL
Addons, and I'll see that there are versions
| | 01:12 | of MySQL going all the way back to 4.1.2.
| | 01:16 | I'll choose the most
recent 5.1 distribution, 5.1.41.
| | 01:22 | I'll click the link and
download the software to my Desktop.
| | 01:27 | Now I've already downloaded it and here it is.
| | 01:30 | To run the add-on installer, just
double-click it and run through all of the
| | 01:35 | dialogs, including any User Account
Control dialogs that might appear.
| | 01:40 | The add-on installers don't have any options.
| | 01:43 | So just follow through the
dialogs and complete the installation.
| | 01:48 | You don't have to stop
WampServer before you do the installation.
| | 01:52 | If any restarts are required, the
installer will handle it for you.
| | 01:56 | Let's see what happened.
| | 01:58 | I'll go to the system tray and click
the WampServer icon and then I'll go
| | 02:02 | to MySQL > Version.
| | 02:05 | I'll see that I have both the newest
version, the one that was originally
| | 02:09 | installed and the older version.
| | 02:12 | I'll go to the Localhost link and show
that I'm running MySQL version 5.5.2.
| | 02:19 | I'll close the browser and go back to
the system tray icon to the Admin menu to
| | 02:24 | MySQL > Version and I'll choose 5.1.41.
| | 02:30 | You'll see the color of the icon
change momentarily as the WampServer
| | 02:34 | installation restarts.
| | 02:36 | Then, I'll go to the icon and I'll
choose Localhost again and I'll see MySQL
| | 02:41 | version has changed to 5.1.
| | 02:44 | So now I can easily switch back and
forth between the versions and work with the
| | 02:48 | version of MySQL that I need
for my current application.
| | 02:52 | You can do this with Apache and PHP as well.
| | 02:56 | Switching between the different versions
of the individual components as needed,
| | 03:00 | you might find certain incompatibilities.
| | 03:03 | For example one version of PHP might
not work with another version of Apache,
| | 03:08 | but you can always return to your
original versions to get a working AMP Stack.
| | Collapse this transcript |
|
|
4. Installing MAMP on Mac OS XInstalling MAMP| 00:00 | The MAMP software bundle represents one
of the easiest ways to get started with
| | 00:04 | Apache, MySQL, and PHP on Mac OS X.
You can download the MAMP software from this
| | 00:11 | web site, www.mamp.info.
| | 00:14 | Make sure you're looking at
the English version of the page.
| | 00:18 | You'll see that there are two
versions of MAMP: one simply called MAMP and
| | 00:22 | the other, MAMP PRO.
| | 00:23 | When you download the software, you'll
actually be downloading both at the same time.
| | 00:28 | Go to the Downloads link, then click the
Download link here, and follow the rest
| | 00:33 | of the prompts to download
the software to your hard disk.
| | 00:36 | You'll see that the software is
downloaded in a zip archive file.
| | 00:40 | When you extract that archive file you end
up with this installer package, MAMP.pkg.
| | 00:46 | To run the installer, double-click,
follow through the prompts, including
| | 00:51 | reading the license agreement and if
you agree, click Continue and Agree,
| | 00:56 | and then click Install.
| | 00:58 | There are no other options
for the MAMP installation.
| | 01:02 | When prompted, type your
administrative password.
| | 01:05 | The installation should take just a few
minutes, as the files are written to your
| | 01:10 | hard disk and placed into
your Applications folder.
| | 01:14 | Once the installation is complete,
click Close. Then, in Finder, go to your
| | 01:18 | Applications folder.
| | 01:20 | You'll see in your Applications folder that
there are two folders named MAMP and MAMP PRO.
| | 01:26 | You'll be using the free edition, MAMP,
and you won't need MAMP PRO at all.
| | 01:31 | You can keep it in the Applications
folder if you want. Or, if you prefer, you can
| | 01:35 | move it to the trash.
| | 01:37 | Now before I start up MAMP, I'm going
to make sure that any copies of Apache or
| | 01:42 | MySQL that are already on my Mac are turned off.
| | 01:45 | I'll go to my System Preferences.
From there I'll go to Sharing, and I'll make
| | 01:51 | sure that Web Sharing is unchecked.
| | 01:54 | That will make sure that the version of
Apache that's included with Mac OS X is
| | 01:58 | off and won't conflict with the
version that's included with MAMP.
| | 02:03 | If you've installed a native
version of MySQL, check that as well.
| | 02:07 | I'll go to the MySQL pane
and make sure that it's stopped.
| | 02:12 | Now I'm ready to fire up MAMP.
| | 02:15 | I'll go into the MAMP folder and show
you that there is a MAMP application. And
| | 02:20 | there is also a critical folder named htdocs.
| | 02:24 | The MAMP htdocs folder is your web
document root, where you place your HTML,
| | 02:29 | graphics, PHP, and other files that
you want to call from a web browser.
| | 02:35 | I'll go back to the MAMP folder
and double-click MAMP to start it up.
| | 02:40 | When you first start up MAMP, the server
should fire up automatically, and once
| | 02:44 | they start, this homepage should appear.
| | 02:48 | Notice that this home screen tells you
that you're running MySQL on port 8889.
| | 02:54 | That's a nonstandard port, and I'll show
you how to change that in another video.
| | 02:59 | You can also see, up here in the URL bar,
that you're running Apache on port 8888,
| | 03:04 | again, a nonstandard port.
| | 03:06 | MAMP comes out of the box this way to
allow you to run these copies of Apache
| | 03:11 | and MySQL at the same time as the
versions that are included with Mac OS X, but
| | 03:16 | if you prefer, you can use
the standard settings as well.
| | 03:19 | To verify that your database is working,
click on phpMyAdmin and you should see
| | 03:24 | this listing, showing you that phpMyAdmin is
working and connecting to your MySQL database.
| | 03:30 | So that's all there is to it.
| | 03:32 | MAMP is incredibly simple to install.
| | 03:35 | There are other options that you can
use, and I'll show you some of those
| | 03:38 | options in other videos.
| | Collapse this transcript |
| Configuring Apache and MySQL server ports| 00:00 | When you install MAMP Pro, Apache and
MySQL are installed with custom ports.
| | 00:05 | You can find out what the current
ports are by going to the Start page.
| | 00:10 | If you look at the web address that's
used to open the start page, you'll see the
| | 00:13 | port number 8888 that Apache is listening on.
| | 00:17 | And down below in the MySQL section of
the homepage you'll see the port being
| | 00:21 | used by MySQL. It defaults to 8889.
| | 00:26 | Those ports are not standard and in fact
if you're going to try to use your AMP
| | 00:29 | stack with the certain products such as
Dreamweaver, they aren't going to work.
| | 00:34 | So before you continue with your
development work you should change the ports
| | 00:38 | back to the standards of port 80
for Apache and port 3306 for MySQL.
| | 00:43 | Here is how you do it.
| | 00:45 | Go to the MAMP application and
click Preferences. In the Preferences
| | 00:50 | dialog click Ports.
| | 00:52 | Click the button labeled Set to
default Apache and MySQL ports.
| | 00:56 | You'll see Apache changes to
80 and MySQL to 3306, click OK.
| | 01:03 | Both Apache and MySQL will restart
and you might be prompted for your
| | 01:07 | administrator password.
| | 01:10 | Type it in and then watch the indicators
to see whether the servers are starting
| | 01:14 | up correctly. They should be set to green.
| | 01:17 | Once the servers have
started, open the start page again.
| | 01:21 | This time you should see that the
Apache server is listening on the standard
| | 01:25 | port 80, indicated by localhost
without a port number, and MySQL should be
| | 01:30 | listening on Port 3306.
| | 01:33 | Once you've change to the standard ports
for Apache and MySQL, you'll be able to
| | 01:37 | work with your MAMP installation.
| | 01:39 | If you have any troubles changing
ports, try this. Go to the Preferences and
| | 01:44 | click Reset MAMP ports and click OK and
that will cause the service to restart
| | 01:49 | using the custom ports that MAMP sets up.
| | 01:52 | Then go back to Preferences again and once
again set to the default Apache and MySQL ports.
| | 01:58 | You sometimes have to give MAMP a
little bit of a nudge to get it to keep
| | 02:02 | the proper settings.
| | 02:04 | And once again you can always confirm
that the servers are using the correct
| | 02:07 | settings by going to the start page
and looking at the web address and the
| | 02:11 | MySQL configuration.
| | Collapse this transcript |
| Managing MAMP| 00:00 | The MAMP user interface offers a
number of options for managing your Apache,
| | 00:05 | MySQL, and PHP installation.
| | 00:07 | All of the options are
available under Preferences.
| | 00:11 | Here are some valuable tasks you can accomplish.
| | 00:14 | By default the MAMP servers, Apache
and MySQL, start when you start the MAMP
| | 00:19 | application and shutdown when you quit MAMP.
| | 00:23 | You can tell the servers to stay
alive and keep on responding to requests
| | 00:27 | even if you've closed the MAMP
application, by deselecting the option stop
| | 00:32 | servers when quitting MAMP.
| | 00:33 | I'll make that change and click OK.
| | 00:35 | You'll see that there's some
work being done in the background.
| | 00:38 | Then I'll click Open start page and show you
the URL that's used to navigate to the homepage.
| | 00:44 | localhost/MAMP/language=English.
| | 00:48 | Now, I'll close the browser and
I will quit the MAMP application.
| | 00:52 | I'll reopen the browser and using a
bookmark that I've already setup, I'll go
| | 00:57 | back to that location and you'll
see that the servers are still alive.
| | 01:02 | This feature is useful if you want to
keep your MAMP servers up and running but
| | 01:07 | don't want to keep the MAMP
administrator interface open.
| | 01:10 | To change that setting,
reopen the MAMP application.
| | 01:14 | If the start page opens, close it.
| | 01:17 | Once again go to Preferences
and reselect the option.
| | 01:22 | Another option you might want to
change is that by default when you open the
| | 01:25 | MAMP application, it
always opens the start page.
| | 01:28 | If you don't need that
feature, you can turn it off.
| | 01:32 | I've already described the
use of the ports settings,
| | 01:35 | how to change the standard
ports for Apache and MySQL.
| | 01:39 | Under PHP, you'll find that you
can switch between PHP versions.
| | 01:44 | You can choose 5.3 or 5.2.
| | 01:48 | The Apache section of the
Preferences dialog has a single option:
| | 01:52 | changing the document root folder.
| | 01:54 | The default location is a folder
named htdocs under /Applications/MAMP.
| | 02:01 | If you want to use another folder
anywhere on your hard disk, just click Select,
| | 02:05 | browse, and choose the folder you want to use.
| | 02:08 | When you're done, click OK.
| | 02:10 | Apache will restart.
| | 02:12 | You might be prompted for your
password and then the content of your new
| | 02:16 | document root folder will be served from Apache.
| | 02:20 | So that's a look at some of the
most commonly used features of the MAMP
| | 02:23 | administrative interface.
| | 02:25 | Other than these features, you're
using a basic version of Apache and MySQL,
| | 02:30 | and anything else you know how to do with those
servers can be done with the MAMP environment.
| | Collapse this transcript |
|
|
5. Installing XAMPPInstalling XAMPP for Windows| 00:00 | The software bundle spelled X-A-M-P-
P is pronounced either ZAMPP or XAMPP
| | 00:06 | depending on who is talking.
| | 00:07 | You can download XAMPP for free from
www.apachefriends.org/en/xampp.html.
| | 00:17 | There are versions available for Linux,
Windows, Mac OS X, and Solaris, and XAMPP
| | 00:23 | is completely free and does
not require any registration.
| | 00:27 | To use XAMPP for Windows, click on the
XAMPP for Windows link and then download
| | 00:32 | the software, using this link under Download.
| | 00:36 | Unlike WampServer, another software
bundle for Windows which includes both a
| | 00:40 | 32-bit and a 64-bit distribution,
XAMPP is only available in a 32-bit
| | 00:46 | installation, but that's okay.
| | 00:48 | It should work fine on any edition of
Windows XP, Windows Vista, or Windows 7.
| | 00:55 | I've downloaded the XAMPP installer
to my desktop, and I will start it
| | 00:58 | by double-clicking.
| | 01:00 | If I am prompted with a User
Account Control dialog, I will click Yes.
| | 01:04 | I will choose my language, English,
read through any informational notes that
| | 01:08 | pop up, and then continue through the prompts.
| | 01:12 | Here I am asked where I want to install XAMPP.
| | 01:15 | The default is c:\xampp.
| | 01:18 | You can choose any other folder,
but I strongly recommend choosing a folder
| | 01:22 | name without any spaces.
| | 01:24 | I will use the default and click Next.
| | 01:28 | On this screen, I accept all of the
defaults, including creating a desktop icon
| | 01:32 | to easily start XAMPP up and
creating a folder in the Start menu.
| | 01:36 | I am not going to install Apache,
MySQL, or FileZilla, which is in the FTP
| | 01:42 | server, as services.
| | 01:44 | Instead, I am going to want
to run them as applications,
| | 01:47 | so I will just leave those check
boxes unselected and I will click Install.
| | 01:52 | The extraction and copying of the files over
to your hard disk will take a few minutes.
| | 01:57 | You're getting copies of the Apache
HTTP server, the MySQL database server, the
| | 02:04 | FileZilla FTP server, phpMyAdmin--
| | 02:08 | that's a web application for managing
your MySQL databases--and many other
| | 02:13 | components which you might be interested in.
| | 02:15 | For example, WampServer also includes
an entire PERL development environment,
| | 02:20 | which is something you'd otherwise
have to install separately on Windows.
| | 02:28 | When you get to this screen,
you're finished installing XAMPP.
| | 02:32 | Click Finish and then to start up
the XAMPP control panel, click Yes.
| | 02:38 | If you see this dialog box, don't
panic; everything is still okay.
| | 02:42 | Click OK and that will open up
the control panel application.
| | 02:47 | You'll see that there are start
buttons associated with each of the major
| | 02:50 | applications we'll be using: Apache and MySQL.
| | 02:54 | To start up Apache, click the Start
button and then once it shows that it's
| | 02:58 | running, click Admin.
| | 03:01 | That should open up your browser
and show this page that says "It works!"
| | 03:06 | This is the very simple Apache
homepage that's included with your
| | 03:10 | XAMPP installation.
| | 03:12 | Now, I will show you where that file is located.
| | 03:15 | I will click the Explore button,
and that opens up Windows Explorer to the XAMPP
| | 03:20 | homepage and from there,
I will double-click into the htdocs.
| | 03:25 | This is the document root
directory for your copy of Apache.
| | 03:29 | This index.html file is the
file that you saw on the screen.
| | 03:33 | Now, I will go back to the XAMPP
control panel, and I will start MySQL.
| | 03:38 | You should see MySQL fire up very quickly.
| | 03:41 | If you try to click the Admin button,
in this version of XAMPP you will see
| | 03:45 | that it doesn't do anything.
That is, to put it bluntly, a bug.
| | 03:49 | Here is the workaround.
| | 03:52 | What you're trying to do is to get into
the phpMyAdmin application, and you can
| | 03:57 | get to it through the
browser if you know the steps.
| | 04:00 | Click the Admin button for Apache,
instead of the button for MySQL,
| | 04:03 | go to the URL, localhost,
and append simply XAMPP to it.
| | 04:11 | When you press Enter, that will
change the URL and display a splash screen.
| | 04:16 | And from there, click on English, or
whatever language you want to read the page
| | 04:21 | in, and that will take you to the
homepage for the XAMPP installation.
| | 04:26 | In some other videos in this chapter,
I will show you some other tools that
| | 04:29 | you can get to through this page, so
you might want to bookmark, or set this
| | 04:33 | page as a favorite.
| | 04:35 | But here's the thing I wanted to show you.
| | 04:38 | From this page, you can click on phpinfo.
| | 04:41 | That will show you which version of
PHP you're currently using. But most
| | 04:45 | importantly, you can get to the
phpMyAdmin web tool for managing your databases.
| | 04:51 | Go down to Tools and click on phpMyAdmin.
| | 04:55 | If this screen opens correctly, it
means that both Apache and MySQL are
| | 05:00 | operating correctly, and you're ready
to start creating your own databases and
| | 05:04 | managing your data through this web interface.
| | 05:07 | XAMPP is installed by
default with minimal security.
| | 05:11 | It's designed to be used for local
development only, and not as a production server.
| | 05:17 | But there are certain security
considerations you want to pay attention to, and
| | 05:21 | I will show you how to deal with those
security considerations in another video.
| | Collapse this transcript |
| Managing XAMPP for Windows| 00:00 | Once you've installed XAMPP on Windows,
you can manage it through the XAMPP
| | 00:04 | Control Panel and through a variety
of PHP based applications that you can
| | 00:09 | access through the Control Panel.
| | 00:11 | To get to the main homepage,
click the Admin button next to Apache.
| | 00:16 | That will take you to a page that
has a number of links to various
| | 00:18 | administrative apps.
| | 00:21 | For example, the phpinfo link takes you
to a simple PHP page nested within the
| | 00:25 | homepage that reports your PHP configuration.
| | 00:29 | Similarly, under the Tools section of
the menu, you can click on phpMyAdmin.
| | 00:34 | That takes you to the web-based
interface where you can create databases and
| | 00:38 | create tables and data.
| | 00:40 | Click the Back button from there
to return to the XAMPP homepage.
| | 00:44 | You can also click on pearinfo.
| | 00:45 | PEAR is a package of extensions
included with PHP and once again this page
| | 00:52 | simply reports your configuration.
| | 00:55 | There are also some demo apps you can explore.
| | 00:58 | For example the Phone Book is a PHP-
based application that incorporates SQLite,
| | 01:04 | a very lightweight SQL
database that doesn't need a server.
| | 01:07 | You can add data through the Phone Book.
| | 01:10 | I'll add John Smith, and give him a
fictional phone number, and then click Add,
| | 01:18 | and you'll see that the data is correctly added.
| | 01:21 | You can click Show the source code and
you'll be able to explore the PHP page
| | 01:25 | that's executing all of the functionality.
| | 01:28 | So you can use all of these
applications to learn a little bit more about PHP.
| | 01:33 | Some of the other tools available
here apply to applications that I
| | 01:36 | haven't started yet.
| | 01:37 | For example FileZilla FTP is an FTP
server that's included with XAMPP for Windows.
| | 01:45 | To start it up, go back
to the XAMPP Control Panel.
| | 01:48 | You will see FileZilla listed there
along with the Mercury email server.
| | 01:53 | Those applications are
outside the scope of this course.
| | 01:56 | That is, our focus is on Apache, MySQL, and PHP.
| | 02:00 | But if you need those servers, you
have them already as part of your
| | 02:03 | XAMPP installation.
| | 02:06 | Finally, I'll show you a very
valuable tool that's included with the
| | 02:09 | XAMPP Control Panel,
the Port-Check tool.
| | 02:11 | When you click Port-Check, the XAMPP
Control Panel opens a command line window
| | 02:17 | and reports all of the ports that are
being used by various server applications.
| | 02:21 | So for example, it shows that ports 80
and 81 and 443 are being used by Apache,
| | 02:27 | 3306 by MySQL, and all the other ports
that are listed here are reserved for
| | 02:33 | these installed applications.
| | 02:35 | But because the applications aren't
currently running, they're reported as
| | 02:38 | free at the moment.
| | 02:40 | You can use this tool to
diagnose port conflicts.
| | 02:43 | That is, when you have more than one
server application that are trying to
| | 02:47 | listen on the same port. After
exploring the list of ports, press Enter to
| | 02:52 | continue and close that window.
| | 02:55 | Finally, a few more things about
the XAMPP Control Panel application.
| | 02:59 | if you try to close the Control Panel
application by clicking the X in the
| | 03:03 | upper-right corner, it actually
just minimizes the application.
| | 03:06 | It doesn't really close it.
| | 03:08 | To return to the application, go to
your system tray and you'll find the system
| | 03:13 | tray icon for XAMPP listed there.
| | 03:16 | Click and it reopens the
Control Panel application.
| | 03:20 | When you're done with your servers, click
the Stop button for both Apache and for MySQL.
| | 03:26 | Make sure the buttons show the strings Start.
| | 03:28 | That means all of your servers are
shut down. Then click Exit and the XAMPP
| | 03:33 | Control Panel will be completely shut down.
| | 03:36 | To return to the XAMPP Control Panel,
go to your Start menu, and if you're
| | 03:40 | working in Windows 7 or Windows Vista,
you can simply type XAMPP and you'll find
| | 03:46 | the XAMPP Control Panel listed there,
and you'll be ready to start over again.
| | 03:50 | So that's a look at some of the
administrative options available in XAMPP for Windows.
| | 03:55 | The Windows version of the XAMPP
software bundle is completely free and gives
| | 03:59 | you a very easy way to get
started with Apache, MySQL, and PHP.
| | Collapse this transcript |
| Managing MySQL security through XAMPP for Windows| 00:00 | When you install XAMPP on Windows,
your MySQL database server is installed
| | 00:04 | without a root user password.
| | 00:07 | On a production server this would be a disaster.
| | 00:10 | But even on a local development system
it's a good idea to set a database password.
| | 00:16 | To accomplish this, go to
the Admin page for Apache.
| | 00:21 | This will open the XAMPP homepage.
| | 00:24 | Then in the menu click on Security.
| | 00:26 | It's the third item from the top.
| | 00:29 | That opens a separate browser window.
| | 00:32 | I'll maximize that window and show
you that it displays a summary of
| | 00:35 | your security settings.
| | 00:38 | This is the setting that I'm concerned about.
| | 00:40 | The MySQL admin user root has no
password and then it has a note that every
| | 00:45 | local user on a Windows machine
can access the MySQL database with
| | 00:49 | administrator rights.
| | 00:51 | You should set a password.
| | 00:53 | Here's how you set it.
| | 00:54 | It's incredibly simple using XAMPP.
| | 00:56 | Go to the bottom of the page and click the link
localhost/security/xamppsecurity.php.
| | 01:03 | That opens a little PHP page
that lets you set the password.
| | 01:06 | I'll click into the new
password entry and type in my password.
| | 01:11 | I'll use the simple string
password and then I'll type it in again.
| | 01:17 | You can also set random passwords for
your PHP my admin user- I won't do that-
| | 01:22 | and then you can click the
button Password changing.
| | 01:26 | You should get a message that the
root password was successfully changed.
| | 01:31 | Close all browser windows, then go to
the MySQL item in your Control Panel
| | 01:36 | application, stop MySQL, and then restart it.
| | 01:43 | Then click the Admin button for MySQL.
| | 01:48 | When phpMyAdmin opens, it
should now open to a login screen.
| | 01:52 | Type-in the username as root and type-in
the password that you set and then click Go.
| | 01:57 | I'll tell Internet Explorer
not to remember the password.
| | 02:02 | If you typed-in your username and
password correctly, you should open
| | 02:05 | phpMyAdmin successfully.
| | 02:08 | You can now create new databases,
manage existing databases' table structures,
| | 02:13 | and add data to your databases all
through the phpMyAdmin interface.
| | 02:18 | As you start using content management
systems such as WordPress or Drupal or
| | 02:23 | working with PHP from other clients such
as Dreamweaver, you'll need to use that
| | 02:27 | password to connect to your MySQL database.
| | 02:31 | This is just one of the useful tools that
are included with the XAMPP software bundle:
| | 02:35 | the ability to manage your MySQL
database without having to work from
| | 02:39 | the command line.
| | Collapse this transcript |
| Installing XAMPP for Mac OS X| 00:00 | There are four versions of
the XAMPP software bundle:
| | 00:04 | for Linux, Windows, Mac OS X, and Solaris.
| | 00:08 | They're all available from the web
site www.apachefriends.org/en/xampp.html.
| | 00:17 | To get started with XAMPP for Mac,
go down to XAMPP for Mac OS X and click the
| | 00:22 | link and then download the application.
| | 00:24 | You will find that it's completely
free and does not require registration.
| | 00:29 | The application is delivered to you as
a DMG file. Double-click the DMG file,
| | 00:36 | and then to install XAMPP, simply drag
the folder into the Applications folder.
| | 00:40 | That will take just a few moments to
copy the application over to your
| | 00:44 | Applications folder.
| | 00:46 | Once the copying process is complete,
close the Finder window and eject the
| | 00:51 | virtual disk named XAMPP for Mac.
| | 00:55 | Before you start up XAMPP, check to
make sure that you don't have any other
| | 00:59 | copies of Apache or MySQL running.
| | 01:01 | I will go to my System Preferences and
from there to Sharing, and I'll make sure
| | 01:07 | that my Web Sharing option is deselected.
| | 01:10 | If you've installed MySQL separately,
also make sure that it's stopped. Warning:
| | 01:16 | if you've had MySQL or Apache running
in that same session, you might want to
| | 01:21 | shut them down and then reboot
your Mac and only then start up XAMPP.
| | 01:26 | Now I've currently got both
servers stopped, so I am ready to roll.
| | 01:29 | I will go to my Applications folder,
| | 01:32 | I will go to Finder,
and select Go > Applications.
| | 01:36 | From there, I will scroll down to the
bottom and locate the XAMPP folder, and
| | 01:41 | here I will find an
application called XAMPP Control.
| | 01:44 | Just as with MAMP and other servers,
the web document root where you put your
| | 01:49 | HTML, PHP, and other web files is named
htdocs, and you'll find that the folder
| | 01:55 | already has some files
that are seeded there for you.
| | 01:59 | Now, I will go back to the XAMPP root
folder, and I will start up the Control panel.
| | 02:05 | If prompted, click Open.
| | 02:07 | You'll see that XAMPP opens as two windows:
| | 02:10 | there's a small control panel on the
right and an informational screen at the left.
| | 02:16 | I'll click the Start button for Apache,
and if prompted, type my password.
| | 02:22 | I'll click the Start button for MySQL as well.
| | 02:25 | If you see green indicators on Apache
and MySQL then you're ready to start
| | 02:30 | using your XAMPP server.
| | 02:32 | There's also an option for
starting up an FTP server.
| | 02:35 | I won't use that here.
| | 02:37 | Now, to test my web site, I'll click localhost.
| | 02:41 | That takes me to localhost/xampp/splash.php.
| | 02:46 | I will click English and
now I'm on the XAMPP homepage.
| | 02:51 | From here, you'll be able to set
status, control security, look at
| | 02:55 | documentation, and execute a
lot of other functionality.
| | 02:59 | The phpinfo command which I've used
in some other videos in this course is
| | 03:03 | available from this screen already.
| | 03:06 | When I click phpinfo, I'm shown
the version of PHP that I'm running.
| | 03:12 | Now to make sure that MySQL is running,
I'll click on phpMyAdmin, which is
| | 03:17 | right here under tools.
| | 03:19 | If you're able to open
phpMyAdmin, you're good to go.
| | 03:23 | Your Apache server is running, your
MySQL database server is running, and you're
| | 03:27 | ready to create your own databases.
| | 03:29 | Now again, there are many more options
available in XAMPP, and I'll show you
| | 03:33 | some of these in other videos.
| | Collapse this transcript |
| Managing XAMPP for Mac OS X| 00:01 | The XAMPP installation includes a
couple of useful management tools that will
| | 00:05 | help you administer your servers.
| | 00:08 | First, make sure that your servers are
running through the Controls dialog and
| | 00:12 | then go to your Getting Started
window and click the localhost link.
| | 00:16 | That will take you to the homepage.
| | 00:19 | On the homepage take a look at
phpinfo(). This is a simple page that outputs the
| | 00:25 | configuration of your PHP server.
| | 00:28 | The most important bit of information on
this screen is the Loaded Configuration File.
| | 00:33 | That's the location of the php.ini file
that's managing your PHP installation.
| | 00:38 | The default location is
/Applications/XAMPP/xamppfiles/etc/php.ini.
| | 00:48 | You can also open phpMyAdmin.
| | 00:51 | Click phpMyAdmin under Tools.
| | 00:54 | If you see the Prompt screen just click Go.
| | 00:58 | Assuming you haven't set up a root user
password on your MySQL installation, you
| | 01:02 | should be able to go to phpMyAdmin instantly.
| | 01:06 | You'll see over on the left that the
installation of MySQL with XAMPP for Mac
| | 01:11 | includes a number of databases,
including the test database, a simple beginning
| | 01:16 | database where you can add new
tables and do some testing of some data.
| | 01:21 | I'll go back to the main window and
also show you that there are some
| | 01:25 | sample applications that you might find useful.
| | 01:27 | For example, the Phonebook
application lists three names.
| | 01:33 | This is an application that's built
with PHP and SQLite, a very simple
| | 01:37 | database much simpler and lighter
than MySQL that's included with the XAMPP
| | 01:42 | installation as well.
| | 01:44 | I'll type in a value of Smith for the
Last name, John for the First name, and
| | 01:48 | then a fake phone number.
| | 01:50 | Then I'll click Add and it'll show that
the data has been added to the database.
| | 01:57 | Click Show source code down toward the
bottom and you will be able to scroll
| | 02:00 | down and take a look at the PHP code
that's executing this little application.
| | 02:06 | There are some other useful sample
applications you can explore as well.
| | 02:10 | So that's a look at the sample
applications and administrative tools that are
| | 02:14 | included with XAMPP for Mac OS X.
One other important application is used to
| | 02:20 | manage the security of your XAMPP installation.
| | 02:23 | I'll describe how to use
this feature in the next video.
| | Collapse this transcript |
| Managing MySQL security through XAMPP| 00:00 | When you install XAMPP for Mac OS X, a lot of
the security options are left in an open state.
| | 00:06 | That is your installation of
both Apache and MySQL is insecure.
| | 00:12 | There are some fundamental security things
you should take care of after the installation.
| | 00:16 | In the Getting Started window click
localhost, then if prompted select your language.
| | 00:23 | When you get to the homepage you can
click the Security item under the XAMPP menu.
| | 00:28 | On this screen you'll see a
summary of your security settings.
| | 00:31 | For example, your XAMPP pages by default
are accessible over the network for everybody.
| | 00:36 | MySQL is also accessible over the
network, as opposed to only being available
| | 00:42 | on your local system.
| | 00:43 | There are also passwords for the
phpMyAdmin user and for the MySQL root user.
| | 00:49 | To change these settings you'll need to
run an application called XAMPP Security.
| | 00:55 | You can run this application from Terminal.
| | 00:57 | Here is a quick and easy way to start it up.
| | 01:01 | Go to the bottom of the page and select
the command to open the application and
| | 01:06 | then copy that command to the clipboard.
| | 01:09 | Now open Terminal and then on the command line
I'll start by typing sudo, for super user do.
| | 01:18 | Then I'll type in a space character and then
I'll press Command+V to Paste in the command.
| | 01:23 | I'll press Return and that
starts up the security application.
| | 01:28 | Depending on your most previous actions
and your computer's configuration,
| | 01:33 | you might be prompted at this point
for your administrator password.
| | 01:36 | That's your Mac user password.
| | 01:39 | Type it in and press Return if
necessary and then paste in the command again.
| | 01:45 | First I'm asked whether I
want to secure my XAMPP pages.
| | 01:48 | If I type Y for Yes, that means that
I'll be securing the pages when they
| | 01:53 | requested through the browser.
| | 01:55 | For local development that's a bit of a
pain, so I'll type in N and press return.
| | 02:01 | Next, I'm asked whether MySQL
should be accessible via the network.
| | 02:05 | Once again, I'll type in N. Next, I'm
asked for a phpMyAdmin root user password.
| | 02:12 | I don't want to set that password
because it's going to slow down my development work,
| | 02:15 | so I'll type in N. But
here's a password I do want to set.
| | 02:21 | The MySQL root password typically
should be set, because even for local
| | 02:25 | development it's a good idea to
test a user with a secured account.
| | 02:30 | So I'll type in Y for yes and press Return,
then I'll type in a password that I want to use.
| | 02:35 | I'll use this simple string password.
| | 02:37 | I'll type it in once and press Return,
then type it again and press Return.
| | 02:44 | Finally, I'm asked about my
FTP server, which I'm not using.
| | 02:48 | So I'll just press Return and that
completes the security application.
| | 02:53 | To test the security settings I'll click
back on the browser and then refresh the page.
| | 03:01 | I'll click Security again
and I'll see my new settings.
| | 03:05 | I'll go to phpMyAdmin and I'll see
that I'm prompted for a username.
| | 03:10 | I'll type in root and password.
| | 03:14 | I've successfully opened phpMyAdmin
and I can now manage my MySQL Server.
| | 03:20 | So that's how you can reset
your security settings through the
| | 03:22 | Security application.
| | 03:25 | On Mac, once again, it's a command line
application that you use through Terminal
| | 03:29 | and you can control whether your MySQL
and Apache servers can be accessed over
| | 03:34 | the network and you can reset
your administrator passwords.
| | Collapse this transcript |
|
|
6. Installing BitNamiInstalling BitNami for Windows| 00:00 | BitNami is an organization that creates
open source distributions of the AMP stack.
| | 00:06 | It creates both simple AMP stack
distributions including just Apache, MySQL and
| | 00:11 | PHP, but really specialized in
creating distributions that include common
| | 00:16 | content management systems
or other web applications.
| | 00:20 | I've gone to the web page bitnami.org/stacks.
| | 00:25 | Under the BitNami Application Stacks
caption, you'll icons for many popular web
| | 00:31 | applications, including content
management systems like WordPress, Drupal and
| | 00:35 | Joomla!, contact management systems
like SugarCRM and many other applications.
| | 00:42 | Each of these icons will take you to
a distribution of the AMP stack that
| | 00:47 | includes the particular
application already installed.
| | 00:50 | But if all you want is a simple
AMP stack, BitNami has that too.
| | 00:55 | Scroll down toward the bottom of the
page to the section captioned BitNami
| | 01:00 | Infrastructure Stacks.
| | 01:02 | At the top, you'll see icons for
WAMPStack for Windows, LAMPStack for Linux and
| | 01:08 | MAMPStack for Mac and a number of other stacks.
| | 01:12 | I'll be using WAMPStack in this video.
| | 01:15 | I'll click the link and you'll see that
there's an installer for the most recent
| | 01:19 | stable version 5.3.13.
| | 01:23 | If you want an installer that
includes 5.4, you can scroll further down and
| | 01:28 | you'll find a Development stack available here.
| | 01:31 | Notice that this is for development
purposes only and is not to be used in
| | 01:35 | production environments.
| | 01:37 | So I'll be using this version WAMPStack 5.3.13,
which I've already downloaded to my Desktop.
| | 01:44 | I'll double-click to start up the
application and if prompted with the User
| | 01:49 | Account Control dialog, I'll click Yes.
| | 01:52 | I'll step through the options and on
this screen I'm allowed to select the
| | 01:57 | components I want to install.
| | 01:59 | In addition to phpMyAdmin which you
will definitely want to install, you can
| | 02:03 | also select one or more of the common
MVC frameworks that are supported in PHP,
| | 02:10 | Zend Framework, Symfony,
CodeIgniter and CakePHP.
| | 02:15 | Each of these options will
take additional time to install.
| | 02:19 | I'm not going to be using most of them.
| | 02:21 | I'm going to deselect Symfony,
CodeIgniter and CakePHP and I'll keep Zend
| | 02:25 | Framework and then I'll click Next.
| | 02:29 | I'll accept the default installation
location, make a note of that and click
| | 02:33 | Next again and here I'm asked for the
password that will be applied for the
| | 02:38 | MySQL database root user.
| | 02:42 | The installer requires a
password of at least six characters.
| | 02:46 | I'll type a simple password in, make
sure you remember whatever you type here
| | 02:51 | and I'll click Next.
| | 02:53 | On this screen, you are asked if you
want to view a little bit of advertising
| | 02:57 | about BitNami's Cloud Hosting offerings.
| | 03:00 | I'll deselect that option and click Next.
| | 03:03 | I'll click Next again to
launch the installation.
| | 03:07 | Depending on how many of those MVC
frameworks you installed, the installer will
| | 03:11 | take a certain amount of time to
copy the files over to your hard disk.
| | 03:16 | All other things being equal, the
BitNami WAMPStack will take quite a bit longer
| | 03:20 | to install than say, WampServer, because
it's including more software especially
| | 03:26 | if you selected one or more of the frameworks.
| | 03:30 | When you get to this screen, your
WAMPStack installation is complete, leave the
| | 03:34 | option checked to Launch the
WAMPStack and click Finish.
| | 03:39 | That should result in opening your
browser and taking you to the Home page.
| | 03:44 | Notice that the WAMPStack is running on 127.0.0.1
and can also be reached at localhost.
| | 03:53 | There're two tabs in the homepage, a
Welcome screen and an Applications screen
| | 03:58 | which you will see is empty.
| | 04:00 | Here's how you can stop and restart WAMPStack.
| | 04:03 | There are two ways;
| | 04:04 | one is through the Control Panel.
| | 04:07 | WAMPStack installs both
Apache and MySQL as services.
| | 04:12 | So you can control them
through the Windows Services console.
| | 04:16 | In the Control Panel, type in
services into the Search Box and click View
| | 04:21 | local services, scroll down toward the
bottom and look for the services that
| | 04:27 | start with WAMPStack.
| | 04:29 | You'll see both wampstackApache and
wampstackMySQL and you can stop and start
| | 04:34 | these services from this screen
just as with any other services.
| | 04:39 | But there's also a special graphical user
interface that's installed with the WAMPStack.
| | 04:44 | To find that, go to the folder
where the WAMPStack is installed.
| | 04:49 | I'll go to Windows Explorer.
| | 04:51 | I'll go to the C drive to Program Files,
to the folder BitNami WAMPStack. Look
| | 04:58 | for the application manager-
windows and double-click to open it.
| | 05:04 | If you see a User Account
Control dialog, click Yes.
| | 05:08 | This screen has two tabs labeled
Manage Servers and Application log.
| | 05:14 | I'll click Manage Servers and go to
Apache Web Server and stop it, and then I'll
| | 05:19 | do the same thing for the MySQL Database.
| | 05:22 | Over in the Application log, I'll see
messages indicating the stopping of the two services.
| | 05:28 | I'll come back to Manage Servers tab
and click Restart All, and now both my
| | 05:33 | Apache Web Server and
MySQL Database are running.
| | 05:37 | Finally I'll test the Database.
| | 05:40 | I'll go back to the browser and I'll
change the URL to localhost/phpmyadmin and
| | 05:47 | that takes me to the phpMyAdmin web application.
| | 05:51 | I'll set the username to root, that's
the default name of the root user, and then
| | 05:56 | the password to the password
I set during the installation.
| | 06:00 | I'll click Go and that opens up
phpMyAdmin and shows the default tables,
| | 06:07 | information_schema, mysql, and so on.
| | 06:10 | If you have this much working, then
you're BitNami installation is complete
| | 06:14 | and operational and you can get
started developing and testing your PHP-based
| | 06:19 | web applications.
| | Collapse this transcript |
| Installing BitNami for Mac OS X| 00:00 | As I've previously described, BitNami
creates and distributes free installer
| | 00:05 | packages that include Apache, MySQL
and PHP, but optionally can also bundle
| | 00:11 | common PHP-based open source
applications, such as popular content management
| | 00:17 | systems like WordPress, Joomla! and Drupal.
| | 00:20 | You can find all of these
distributions at bitnami.org/stacks.
| | 00:25 | Under BitNami Application Stacks you
will find the distributions that include
| | 00:30 | these applications, but if you're
just looking for a simple AMP installer,
| | 00:35 | scroll down toward the bottom of the
page to BitNami Infrastructure Stacks.
| | 00:40 | I'll be using this one, MAMPStack, the
AMP Stack for Mac OS X. As of the date of
| | 00:46 | this recording, the most recent
stable installer was MAMPStack 5.3.13.
| | 00:52 | If you're looking for PHP 5.4, it's not
part of this installer, but there is a
| | 00:58 | Beta distribution available.
| | 01:00 | Scroll down toward the bottom of the
page and look for the Development section.
| | 01:05 | As the message reads, this
distribution 5.4.0 is intended for development
| | 01:11 | purposes only and shouldn't be
used in production environments.
| | 01:15 | But if you are trying to get started
with PHP 5.4, this is an easy way to do it.
| | 01:19 | I'll scroll back up toward the top and
this is the installer that I'll be using.
| | 01:25 | I've already downloaded it to my Desktop.
| | 01:28 | Now my goal is to install Apache,
so that it's listening on port 80.
| | 01:33 | Before I start the installer, I'm going
to make sure that the included copy of
| | 01:38 | Apache, that comes with
Mac OS X, isn't activated.
| | 01:41 | I will go to my System Preferences
and I'll click on Sharing and I'll check
| | 01:46 | that Web Sharing is off.
| | 01:49 | Once I have verified that, I'm
ready to start the installer.
| | 01:52 | There are two ways of
starting the BitNami installer.
| | 01:56 | You can double-click on the
icon to start the installer.
| | 02:00 | You'll be able to install MAMPStack this
way, but you might be forced to install
| | 02:04 | Apache with a port other than port 80.
| | 02:07 | So instead of starting the installer
application this way, I instead recommend
| | 02:12 | starting it from Terminal where you
can start it up as the super user.
| | 02:16 | I will cancel this and I'll open up Terminal.
| | 02:19 | I will go to the Spotlight and type
in terminal and then press Return.
| | 02:25 | I'm going to switch to the
folder that contains my installer.
| | 02:28 | I will type cd ./Desktop.
| | 02:32 | Now I'm in the Desktop folder.
| | 02:35 | I'm going to be starting up as the super user.
| | 02:37 | So I will type sudo, which stands
for super user do and then a space.
| | 02:43 | Now I'm going to run a script
that's a part of the installer package.
| | 02:47 | I will type ./bit for BitNami and I
will press Tab, Terminal completes the
| | 02:54 | application package name.
| | 02:56 | Now I'll drill down a little bit further,
I will type in Con with an uppercase C
| | 03:01 | and press Tab, that takes me to the
Contents folder, and then Mac with an
| | 03:06 | uppercase M and Tab again and
that takes me to the MacOS folder.
| | 03:11 | Now I'll type inst for install.
| | 03:15 | I will press Tab and Terminal
completes the beginning of the file name
| | 03:19 | installbuilder, then I'll type .sh
and that's the actual complete name of
| | 03:25 | the startup script.
| | 03:27 | When I press Return, I'll be prompted for my
administrator password, which I'll type in.
| | 03:33 | When I press Return, I'll now be
running the MAMPStack installer as the super
| | 03:37 | user and that will ensure that I have rights to
install Apache using port 80. I will click Next.
| | 03:45 | On the Select Component screen,
deselect any components you won't be using.
| | 03:50 | For example, I sometimes use Zend
Framework, but I typically don't use Symfony,
| | 03:55 | CodeIgniter or CakePHP, which
are popular MVC frameworks for PHP.
| | 04:01 | If you don't need the components,
you can save time and disk space by
| | 04:05 | not installing them.
| | 04:07 | You will want to make
sure you include PhpMyAdmin.
| | 04:10 | Click Next and then select the folder
where you want to install the MAMPStack.
| | 04:16 | The default folder name will
include the version number as shown here.
| | 04:19 | I will accept the default and click Next.
| | 04:22 | On this screen I'm asked for
MySQL root account password.
| | 04:27 | The BitNami installer requires a
password of at least six characters.
| | 04:31 | I will type in a password.
| | 04:35 | I will make sure I type it the same
way twice and I will also make sure I'm
| | 04:39 | typing in the password I can remember
easily later on. I will click Next.
| | 04:43 | And on this screen, I'm asked whether I
want to see information about BitNami's
| | 04:47 | Cloud Hosting services.
| | 04:48 | I will deselect the option and click
Next again and I'll click Next and now the
| | 04:54 | installation begins.
| | 04:56 | The BitNami installer will take a few minutes
to copy all of its files over to your hard disk.
| | 05:02 | When you come to this screen, the
installation is complete, leave the option
| | 05:06 | checked to Launch the
MAMPStack and click Finish.
| | 05:10 | When the installation is complete, a
browser should open and you should be taken
| | 05:15 | to 127.0.0.1, the IP
address for the local system.
| | 05:21 | You can also reach the BitNami
homepage from http://localhost.
| | 05:28 | Now I'm going to close all of my
browsers and I'm also going to close Terminal
| | 05:33 | to finish up the installation process.
| | 05:36 | I'll open up a browser again and
then to get to phpMyAdmin, I'll type in
| | 05:41 | http://localhost/phpmyadmin.
| | 05:48 | That takes me to the phpMyAdmin login screen.
| | 05:52 | I'll type in the username which will
be root and the password which is the
| | 05:56 | password I entered during
the installation process.
| | 05:59 | Then I will press Return or click Go,
and I'll be taken to the phpMyAdmin screen.
| | 06:06 | If this screen appears correctly, then
BitNami is fully installed and working
| | 06:11 | with Apache, MySQL and PHP.
| | 06:15 | In order to stop and start the BitNami
services, go to Finder, go to the folder
| | 06:20 | where you installed BitNami,
I'll go to Applications > MAMPStack.
| | 06:26 | From there, look for an application
named manager-osx, double-click to open it.
| | 06:33 | If prompted for your
administrator password, type it in.
| | 06:37 | The MAMPStack manager is a
simple graphical user interface.
| | 06:41 | I will click on it to bring it into the
foreground and show you that there are
| | 06:45 | items for starting and
stopping MySQL and Apache.
| | 06:49 | There are two tabs: Manage
Servers and Application log.
| | 06:53 | I will all start on the Managed
Servers tab and I'll stop both servers
| | 06:58 | by clicking Stop All.
| | 06:59 | I will look at the Application log
and watch the log messages go by.
| | 07:05 | I'll come back to the Manage Servers
tab and once I see the indication that the
| | 07:09 | servers have stopped, I will click Start All.
| | 07:13 | And once again I'll go back to the
Application log and watch the messages.
| | 07:18 | Once I see the running message for
both MySQL and Apache, I'll know that my
| | 07:23 | services have started again.
| | 07:25 | But the real task is to make
sure that you can get to phpMyAdmin.
| | 07:29 | So once again, I'll go to a browser, and I
will type in localhost/phpmyadmin and I'll log in.
| | 07:37 | And there is phpMyAdmin running correctly.
| | 07:41 | So that's how you can install BitNami
on Mac OS X and manage it stopping and
| | 07:47 | starting it from the graphical user interface.
| | Collapse this transcript |
|
|
7. TroubleshootingHandling port conflicts with Skype on Windows| 00:00 | If you use Skype to make phone calls on
Windows, you might find that there is a
| | 00:04 | port conflict between
Apache and the Skype client.
| | 00:09 | I'll show you what it looks
like and then how to resolve it.
| | 00:12 | I have the Skype client open on my
desktop, and now I'm going to go to the
| | 00:16 | Windows Services Console, which is
available through the control panel.
| | 00:21 | I'll go to the Apache2.2 service,
which currently isn't running, and I'll try
| | 00:26 | to start this service.
| | 00:28 | I see this error message. It's a very
mysterious message, but essentially it's
| | 00:32 | telling me that Windows
couldn't start the service.
| | 00:34 | The reason is because Apache is trying
to use port 80 and the Skype client has
| | 00:40 | already reserved that port.
| | 00:42 | Now one way of solving this is to
close Skype, then start up Apache, and then
| | 00:46 | start Skype up again.
| | 00:48 | Apache will have reserved the port for that
session and then Skype won't be able to use it.
| | 00:54 | But a better way is to reconfigure
Skype not to use that port at all, so I'll
| | 00:58 | show you how to do that.
| | 01:01 | In the Skype client, I'll go to
Tools > Options. In the Options dialog, I'll click
| | 01:07 | Advanced > Connection, and I'll
deselect this option, Use port 80 and 443 as
| | 01:14 | alternatives for incoming connections.
| | 01:18 | When that option is deselected, the
Skype client will no longer try to reserve
| | 01:22 | the ports for its use and
Apache will be able to get started.
| | 01:25 | I'll click Save, and I'll see this
message indicating that the changes will only
| | 01:30 | be applied the next time I start Skype.
| | 01:33 | I'll click OK, I'll close this Skype
window, then I'll go down to the taskbar,
| | 01:40 | right-click, and choose Quit Skype.
| | 01:43 | That makes sure that the Skype client is
completely shut down, and if I see this
| | 01:47 | confirmation dialog, I'll click Quit.
| | 01:50 | To make absolutely sure that Skype is
out of the system, I'll go to my system
| | 01:54 | tray and I'll check for any Skype
indicators that might still be here.
| | 01:59 | I don't see any there and so I'm good to go.
| | 02:02 | Now I'll restart Skype. So now Skype is
running, and I can make phone calls, but
| | 02:09 | because I didn't reserve port 80, I
should also be able to start Apache.
| | 02:13 | I'll go back to the Services
panel, which I have in the background.
| | 02:17 | I'll choose the Apache Server and click
the Start button, and now Apache starts
| | 02:22 | up quickly and cleanly.
| | 02:24 | So you can have both Apache and Skype
running on the same system, but only one
| | 02:28 | of them can be using port 80 at the same time.
| | 02:31 | My recommendation is to turn port 80
off in Skype and let Apache use it.
| | Collapse this transcript |
| Handling other port conflicts on Windows| 00:00 | You can only have one copy of
MySQL and one copy of the Apache HTTP
| | 00:05 | Server running at a time.
| | 00:07 | If you try to install and run more
than one, you'll get a port conflict.
| | 00:12 | MySQL listens on Port 3306 and Apache
on Port 80, and only one process can
| | 00:17 | listen on each port at a time.
| | 00:20 | I'll show you how to recognize and
then how to resolve port conflicts
| | 00:23 | on Microsoft Windows.
| | 00:25 | I currently have the Local Services
control panel opened, and it shows that
| | 00:29 | Apache 2.2 is started and then I'll go down
to MySQL and show that has started as well.
| | 00:36 | I've also installed XAMPP and WampServer.
| | 00:40 | I'll start at the XAMPP Control Panel.
This Control Panel shows that both Apache
| | 00:45 | and MySQL are running, but notice
that the Service checkboxes are selected.
| | 00:51 | These reflect the native services that
were installed, not the versions that
| | 00:55 | were installed with XAMPP.
| | 00:57 | Now I'll click the Admin button for
Apache and instead of going to the XAMPP
| | 01:02 | homepage as expected, I get a Not Found 404
error, indicating that the XAMPP URL wasn't found.
| | 01:09 | That's because I'm trying to navigate
to the homepage on XAMPP, but instead I'm
| | 01:14 | sending a request to the
Apache HTTP native server.
| | 01:18 | I'll prove that by going to
http://localhost without the XAMPP directory and
| | 01:23 | I'll get the native homepage saying, "it works!"
| | 01:27 | Now, here is how you can recognize the same
circumstance when trying to use WampServer.
| | 01:31 | I'll double-click the WampServer
icon to start up the server and then in
| | 01:35 | the system tray the gauge shows red
and then perhaps some other color, but
| | 01:40 | it doesn't go all the way to white as it would
to indicate that the servers ran successfully.
| | 01:46 | I'll click the icon and try to click
Start All Services, and once again the
| | 01:50 | gauge just doesn't change color.
| | 01:53 | Now I'll go to the WampServer
homepage and click Localhost and once again
| | 01:58 | instead of getting the WampServer
homepage I get the native Apache homepage.
| | 02:03 | Now you can resolve this fairly easily
by going into the Services control panel
| | 02:08 | and stopping the services, and then
you should be able to run the other
| | 02:11 | versions of the services.
| | 02:14 | So in the control panel I'll select
Apache 2.2 and click the Stop button.
| | 02:20 | Then I'll go down to MySQL and once
again I'll click Stop. Then I'll go to the
| | 02:26 | WampServer icon in the system tray and
choose Start All Services and now the
| | 02:32 | gauge goes to all white.
| | 02:35 | To show that both services that
are a part of WampServer are running
| | 02:38 | successfully, I'll open up phpMyAdmin.
| | 02:42 | If you can get to phpMyAdmin you
know that both MySQL and Apache are
| | 02:46 | running successfully.
| | 02:48 | Now here's another way that you can
find out what's running on your system.
| | 02:52 | I'm going to stop the WampServer
services and then go back to the control panel
| | 02:58 | and restart both MySQL and Apache.
| | 03:02 | It doesn't matter what order I start them in.
| | 03:07 | Then I'll show you a trick you can do
on the command line to find out whether
| | 03:10 | certain ports are in use.
| | 03:12 | I'll click the Windows Start
button and type in cmd and open the
| | 03:17 | Command application.
| | 03:20 | In the Command application I'll
use an application called netstat.
| | 03:24 | This is an application that's
included with Microsoft Windows.
| | 03:28 | It should be available on all
versions of Windows including XP, Windows
| | 03:32 | Vista, and Windows 7.
| | 03:35 | I'll use the netstat application with a
parameter of -a, which means show me all
| | 03:40 | server applications
listening on the TCP/IP Stack.
| | 03:45 | And then after netstat -a, I'll type in a
pipe character and then the Find application.
| | 03:51 | This allows me to take the output of
the netstat application and filter it
| | 03:56 | looking for a particular string.
| | 03:58 | I'll type in the string LISTENING, in
all uppercase and wrapped in quotes.
| | 04:04 | Here is the result.
| | 04:05 | It lists all of the ports that are
currently in use on your computer.
| | 04:10 | Notice port 80 is on the first
line and port 3306 appears below.
| | 04:15 | The exact order of the ports displayed will
depend on the configuration of your computer.
| | 04:20 | Now to demonstrate what happens when
you shut the applications down, I'll go
| | 04:24 | back to the Services panel
and I'll stop Apache and MySQL.
| | 04:28 | I'll come back to the Command line window.
| | 04:38 | I'll press the Up Arrow to repeat
the last command and press Enter, then
| | 04:43 | scroll up a bit and show that both port 80
and port 3306 have disappeared from the list.
| | 04:49 | The netstat application lets you verify
that those ports have been released by
| | 04:53 | whatever application was using them.
| | 04:56 | So that's a look at how you can
recognize and then resolve port conflicts.
| | 05:01 | Port conflicts occur when you install
more than one copy of a server application
| | 05:06 | and try to run them all at the same time.
| | 05:09 | You can easily find out what's
happening and then fix the situation by knowing
| | 05:13 | how to recognize the symptoms in both
the server bundled applications and in
| | 05:18 | the command line.
| | Collapse this transcript |
| Detecting and handling port conflicts on Mac OS X| 00:00 | When you install more than one copy of
a particular server application, such as
| | 00:04 | Apache or MySQL, and then try to run both at
the same time, you will run into a port conflict.
| | 00:11 | Apache, for example, listens on port 80
and only one application at a time can
| | 00:16 | listen on that port.
| | 00:18 | To demonstrate this, I have installed
both the individual components, Apache and
| | 00:24 | MySQL, and XAMPP represented by the
XAMPP Controls panel, and MAMP represented by
| | 00:29 | the MAMP application.
| | 00:31 | Now, I'll go into the System
Preferences and show you that both MySQL and
| | 00:35 | Apache are running.
| | 00:36 | I'll go into MySQL and show that the
MySQL Server instance is running and then
| | 00:42 | I'll go to Sharing and show
you that Web Sharing is selected.
| | 00:47 | Now, I'll show you what happens in XAMPP and
MAMP when you try to run the same applications.
| | 00:52 | XAMPP gives you a lot of help.
| | 00:55 | I'll click the Start button for Apache and I
get a really clear message. Web Sharing is on!
| | 01:00 | And it tells me exactly how to fix the problem.
| | 01:04 | I can do the same thing for MySQL and
once again I get a great error message.
| | 01:09 | If you're working with MAMP
though, this symptom is less clear.
| | 01:13 | I'll click Start Servers in the MAMP
application and simply nothing happens.
| | 01:19 | Both the Apache Server red light and
the MySQL Server red light stay lit.
| | 01:23 | They don't switch to green.
| | 01:25 | That's an indicator that the
applications weren't able to start.
| | 01:29 | Now the simplest thing to do is to
go back to System Preferences and turn
| | 01:33 | off the applications.
| | 01:35 | So I'll go to Sharing and deselect
Web Sharing and then go back to the main
| | 01:40 | System Preferences pane and go into
MySQL and click Stop MySQL Server.
| | 01:47 | If I'm prompted at any point for my
Administrator password I'll type it in.
| | 01:52 | Once the applications are stopped, I
should be able to start Apache and MySQL
| | 01:57 | for my selected server bundle.
| | 02:00 | So I'll go to XAMPP and click Start on
Apache. Once again I'm prompted for the
| | 02:04 | Password, and I'll click Start for MySQL,
and this time both start successfully.
| | 02:10 | Now I can't have XAMPP's versions of these
servers and MAMP's running at the same time.
| | 02:16 | So if I click Start Servers here
I'll run into the same problem.
| | 02:20 | Now I'm going to turn off the
XAMPP versions and restart the
| | 02:25 | individual components.
| | 02:27 | I'll restart MySQL Server and
restart Apache and I'll show you a way of
| | 02:33 | finding out which versions of these
servers are actually running, using some
| | 02:37 | commands in Terminal.
| | 02:40 | I'll go to Terminal by going to
Spotlight, typing terminal, and choosing the
| | 02:45 | application Terminal.
| | 02:49 | Within the application I am going to
use a command called lsof, which stands
| | 02:53 | for List Open Files.
| | 02:55 | I'll run this command as the superuser.
| | 02:57 | So I'll start with superuser do, or sudo,
then a space, then lsof and then I'll
| | 03:04 | add a couple of parameters, -i and -P.
| | 03:10 | Then I'm going to filter the result of
this command and look for applications
| | 03:15 | that are running on a particular port.
| | 03:17 | MySQL runs on Port 3306.
| | 03:21 | To do the filtering I'll type in the
pipe character then grep, which searches text,
| | 03:26 | and then the string I'm looking for, 3306.
| | 03:31 | If I'm prompted for my
Administrator password I'll type it in.
| | 03:36 | This process might take a few seconds
the first time you run it so be patient.
| | 03:41 | So this shows me that MySQL is in fact running.
| | 03:44 | It tells me that the name of the
process is mysqld and it assigns a Process ID,
| | 03:50 | which is random, of 29585.
| | 03:54 | Now, to stop the process I could go
back to my System Preferences pane. I'll go
| | 04:00 | to MySQL and I could click Stop MySQL Server.
| | 04:05 | But another way of doing this is to
kill the process from the command line,
| | 04:09 | using the UNIX command Kill.
| | 04:12 | You do this by the Process ID. So
I'll double-click the Process ID and copy
| | 04:17 | it to the clipboard.
| | 04:18 | And then I'll type sudo, for superuser do,
then kill and then I'll paste in the Process ID.
| | 04:27 | I'll go back to the System
Preferences pane and show that the MySQL Server
| | 04:31 | instance has stopped.
| | 04:34 | You can do the same thing for the Apache server.
| | 04:37 | So I'll type in sudo lsof -i -P,
then the pipe character, grep, and then
| | 04:47 | I'll search for port 80.
| | 04:49 | Now make sure that you don't have
any web browsers currently running.
| | 04:53 | If you have browsers running
you'll to get back a whole bunch of more
| | 04:56 | information than you expect.
| | 04:57 | So I'll just go down to my Dock and
make sure I don't have Firefox or Google
| | 05:01 | Chrome or Safari running, then I'll
come back to Terminal and press Return.
| | 05:06 | Once again, it might take a few seconds
for the process and the search to complete.
| | 05:12 | Here is the response.
| | 05:13 | Notice I'm getting back more
information than I am expecting.
| | 05:16 | What I'm really looking for is this
string, :80, and I see that there are two
| | 05:21 | processes running with httpd, the actual
name of the Apache HTPP Server process.
| | 05:28 | If I wanted to kill these processes
from the command line I could once again
| | 05:32 | select and copy the Process IDs and
kill them, but this time I'll stop the
| | 05:37 | process from the System Preferences pane.
| | 05:40 | I'll go back to the Sharing pane.
| | 05:42 | I'll deselect Web Sharing.
| | 05:45 | I'll come back to Terminal and press the
up arrow key to restore the last command.
| | 05:50 | I'll press Return and once again it'll
take a few seconds to run the process.
| | 05:57 | And when the response comes back,
the httpd processes are not there anymore.
| | 06:02 | So that's a look in various ways of
how to diagnose and then solve port
| | 06:07 | conflict situations.
| | 06:09 | Again, you can only have one copy of
Apache and one copy of MySQL running at a time,
| | 06:14 | and if you're not sure where the
ports are being used you can use both the
| | 06:19 | applications that come with these
products and some commands in the Terminal
| | 06:23 | application to diagnose and solve your issues.
| | Collapse this transcript |
| Configuring Apache to work with IPv6 on Windows 8| 00:00 | If you are a particularly adventurous
developer, you might try installing an AMP
| | 00:04 | stack on Windows 8 and you
might run into some issues.
| | 00:08 | Windows 8 has switched to the IPv6
system of assigning IP addresses and that
| | 00:15 | changes how the localhost or the
local machine's requests are interpreted.
| | 00:21 | I'm going to show you how the
issue appears and then how to fix it.
| | 00:26 | I've installed the latest version of the
WampServer on Windows 8 Consumer Preview.
| | 00:31 | I'll go to the system tray icon and
I'll open the Administrative menu for
| | 00:35 | WampServer and I'll select Localhost.
| | 00:39 | The browser opens, but shows an error.
| | 00:42 | The web site declined to show this web page.
| | 00:45 | And I'll click More information
link to show the detailed error.
| | 00:49 | It's an HTTP 403 Forbidden error, which
means that the server has not recognized
| | 00:55 | the browser as having
permission to view the web page.
| | 00:58 | The issue here is that WampServer is
configured by default to only accept
| | 01:03 | requests from the local system and for some
reason, it thinks this browser is on another system.
| | 01:11 | There's a very simple way of fixing
this small error, the inability to get to
| | 01:15 | localhost or the homepage.
| | 01:17 | I'll go back to that Administrative menu and
I'll choose the bottom menu choice; Put Online.
| | 01:24 | The WampServer being online means
that it can now receive and respond to
| | 01:29 | requests from other computers.
| | 01:31 | I'll close the browser, then I'll
come back to my Administrative menu and
| | 01:35 | choose Localhost again, and now I can
get to the WampServer homepage and you
| | 01:40 | might think it's all solved, but then
I'll try to get to phpMyAdmin and I'll
| | 01:45 | get that same error again.
| | 01:48 | It turns out that putting WampServer
online fixes part of the problem, but not
| | 01:52 | the whole thing, and it's also good to
understand the underlying issue which is how
| | 01:58 | Apache is configured in a
default WampServer installation.
| | 02:02 | I'll close the browser and I'll
switch WampServer back to being offline.
| | 02:07 | Now let's take a look at the
Apache configuration files.
| | 02:12 | I'll go to Windows Explorer and I'll
open up the wamp installation folder,
| | 02:15 | C:\wamp and from there, I'll go to the
bin folder to apache to Apache2.2.21,
| | 02:25 | the version I'm working with, and from there to
the conf folder which stands for configuration.
| | 02:31 | I'll open the file httpd.conf.
| | 02:35 | You can open this file in any text editor.
| | 02:38 | I'm going to search for the string 127.0.0.1
and I get down to this section.
| | 02:45 | This is the section that manages
security for the wamp/www/ directory, the
| | 02:51 | document root folder.
| | 02:53 | Notice that there are three lines here:
| | 02:55 | Order Deny, Allow, Deny from
all and Allow from 127.0.0.1.
| | 03:03 | This configuration file is designed for
a local computer that's running on IPv4,
| | 03:10 | the system for assigning IP addresses
that was used in previous versions of
| | 03:14 | Windows and that's also installed in
current versions of Mac OS X. It turns out
| | 03:20 | that IPv6 assigns a different IP address.
| | 03:24 | Here's how you can
discover the correct IP address.
| | 03:27 | I'll open up the Command Prompt.
| | 03:30 | I'll move the cursor down to the
lower left-hot corner and right-click and
| | 03:34 | choose Command Prompt.
| | 03:36 | I'll type ping localhost and it shows
me that the IP address of localhost under
| | 03:44 | IPv6 is something called ::1.
| | 03:50 | ::1 in IPv6 is the
equivalent of 127.0.0.1 in IPv4.
| | 03:59 | So here's how I'll allow my local
computer to get to the homepage of WampServer.
| | 04:05 | I'll go back to the configuration file,
I'll make a copy of this line and then
| | 04:10 | paste it right underneath and in the
second line, I'll change 127.0.0.1 to ::1,
| | 04:19 | I'll save my changes by pressing Ctrl+S,
I'll go back to my Administrative menu
| | 04:24 | for WampServer and I'll restart all services.
| | 04:28 | I'll wait until the icon changes colors
a couple of times then I'll go back and
| | 04:33 | choose Localhost and now I'm able to
get to the homepage again and to any other
| | 04:39 | files that are within my document root folder.
| | 04:42 | But I'm still going to have trouble
getting into phpMyAdmin and that's because
| | 04:46 | the phpMyAdmin files are not
placed within the www folder.
| | 04:52 | The security rule, I just applied,
applies to my main document root, but not to
| | 04:57 | files that are outside that folder.
| | 05:00 | These files are managed
through something called an alias.
| | 05:02 | So I'm going to close that browser and
close Notepad for a moment, and I'll close
| | 05:08 | everything except for Windows Explorer.
| | 05:11 | I'll go back to the wamp home folder C:\wamp
and I'll go to the alias folder.
| | 05:17 | The alias folder contains small
configuration files that are included for each
| | 05:23 | of the web applications
that's installed with WampServer;
| | 05:25 | phpmyadmin, sqlbuddy and webgrind.
| | 05:31 | I'll open phpmyadmin.conf and I'll maximize,
it and I'll see that the same issue is here.
| | 05:38 | There's an Allow from for 127.0.0.1,
but I'm not being allowed to make requests
| | 05:44 | from the IPv6 version of localhost.
| | 05:48 | So I'll copy and paste that line
and once again I'll change to ::1.
| | 05:55 | I'll save the change, I'll restart my services.
| | 05:59 | I'll once again wait until that icon
changes colors a couple of times. I'll
| | 06:03 | go back to Localhost and I'll go to
phpmyadmin and now I have access to that application.
| | 06:11 | I can repeat the process for the other
two web applications, and if you create
| | 06:15 | your own new aliases, you'll need to go in
and modify those configuration files as well.
| | 06:21 | The important part of this, in Windows 8,
is that Windows 8 now uses IPv6 to
| | 06:27 | assign IP addresses and that
changes what localhost means.
| | 06:32 | We've been accustomed for many years
to knowing that localhost means the IP
| | 06:37 | address 127.0.0.1 and an IPv6
that IP address has changed to ::1.
| | 06:46 | WampServer is affected by this
especially because its default configuration
| | 06:51 | files have this rule built-in.
| | 06:54 | But when you know the rules and you
know how to change the rules, you'll know
| | 06:58 | how to get AMP server stacks
installed and working correctly on Windows 8.
| | Collapse this transcript |
|
|
ConclusionGoodbye | 00:00 | Hi, David Gassner here again.
| | 00:02 | Thanks for joining me on this tour of
the various options for installing a local
| | 00:06 | AMP stack with Apache, MySQL and PHP.
| | 00:10 | You should now have a reliable local
installation that you can use for your
| | 00:14 | development and testing.
| | 00:16 | Whether you watched the whole course or
just used a single chapter, I hope that
| | 00:20 | this content made it easier to get
started with these free software products.
| | 00:24 | If you came here from another lynda.com
course, I hope this video series made it
| | 00:28 | easier to get started.
| | 00:29 | Happy learning!
| | Collapse this transcript |
|
|