Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6
This is the forum to discuss the Wrox book Beginning PHP, Apache, MySQLWeb Development by Michael K. Glass, Yann Le Scouarnec, Elizabeth Naramore, Gary Mailer, Jeremy Stolz, Jason Gerner; ISBN: 9780764557446
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old December 31st, 2004, 06:17 PM
Authorized User
 
Join Date: Dec 2004
Location: Dallas, TX, USA.
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to ababb
Default http://localhost:8080/ (Why??)

In the book, the examples are given as:

http://localhost/

Yet, to make the examples work I must append the port number, in my case :8080.

Why is that?

__________________
ABabb
Dallas TX
Reply With Quote
  #2 (permalink)  
Old December 31st, 2004, 08:56 PM
Authorized User
 
Join Date: Dec 2004
Location: , , .
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Default

if you open up your httpd.conf file, look for the line around 112 for the following:

#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses (0.0.0.0)
#
#Listen 12.34.56.78:80
Listen 8080

The directive, Listen 8080, defines what port Apache is to listen on. If you change it to Listen 80, then you'll be able to access your local websever as the book indicates: http://localhost.

To expand a little further, the default port number for the http protocol is port 80, hence the reason you never have to type in the port number for a website. However, when you change the Listen directive to anything but port 80, then you have to specifically tell your browser which port to access the server on. In your case, it's port 8080. But the truth is, you can pick just about any number. Be careful, though, because there are many well known port numbers assigned to specific services. Check out the following link:

http://www.iana.org/assignments/port-numbers

Now the reason your server is on Port 8080 and not Port 80 is probably because of the type of installation you chose. During the install proccess, there is a section that asks you, For whom to install Apache. Most likely you selected, only for the Current User, on Port 8080, when started Manually . This option is available for security reasons or if you already have another webserver running on port 80.

I hope this helps.

Reply With Quote
  #3 (permalink)  
Old January 1st, 2005, 09:32 AM
Authorized User
 
Join Date: Dec 2004
Location: Dallas, TX, USA.
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to ababb
Default

A clear explanation.

Thanks for the help.

So I can configure my apache server this way as long as I don't have another webserver running on my machine (which I don't).

Will it affect my ability to use the internet? To access other webservers as a user?
Reply With Quote
  #4 (permalink)  
Old January 1st, 2005, 02:07 PM
Authorized User
 
Join Date: Dec 2004
Location: , , .
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Default

No...it won't affect your use of the internet. But I advise that you have a firewall setup so that the people on the internet cannot get into your computer. You see, Apache Listens on the port that you have defined, whether it be port 80 or port 8080. So, if you don't have a firewall set up, then people will be able to access your computer and Apache will respond. Now if a hacker who has the brains finds any security holes in your setup of Apache, then they may be able to get past your document root and do malicious things.

Of course, the likelyhood of someone hacking into your computer as a resident and not some major ecommerce site is pretty low, but you just can't be too careful. Especially if you're using a wireless router. If you are using a wireless router, MAKE SURE YOU USE ENCRYPTION!!!!

Happy New Year!!!!!

Reply With Quote
  #5 (permalink)  
Old January 1st, 2005, 08:46 PM
Authorized User
 
Join Date: Dec 2004
Location: Dallas, TX, USA.
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to ababb
Default

I'm sitting behind a router(no wireless here), I know that.   I have to tell you I don't know if I'm behind a firewall or not.
Reply With Quote
  #6 (permalink)  
Old January 2nd, 2005, 01:14 AM
Authorized User
 
Join Date: Dec 2004
Location: , , .
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Most likely, if the router was supplied by your ISP and is one of those combination modem/router deals, then it has a built in firewall and the default is to not letting in any new connections. If this is the type of hardware you have, you should be able to access the settings via your browser. Typically, they're accessed with 192.168.1.1 and then you have to enter in a username/password. The defaults are usually Admin/password. Try that unless you've already changed things. Once you have access, click around until you have a firewall page and you'll probably noticed that all services/ports are blocked for incoming yet all outgoing is accepted. If none of this works, check your manual for the router or call your ISP to be sure.

The other thing is that if you're using Windows XP with Service Pack 2, there's now a firewall with the OS. I personally don't use it because I have a dedicated Linux router/firewall computer. But hey! If that's all you have, it's better than nothing.

Happy computing!!!

Reply With Quote
  #7 (permalink)  
Old January 2nd, 2005, 05:45 AM
Authorized User
 
Join Date: Dec 2004
Location: Dallas, TX, USA.
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to ababb
Default

Yes, it is one of the ISP combo router/modem deals.

By the way, I may have figured out my own problem...

I have learned how to start and stop services from the command line. And, through the XP services applet I was able to set the two services we're using, APACHE and MYSQL, as 'manual' start-up.

Because I'm working on a notebook from my job, I just leave the two services 'off' until I'm ready to work on this stuff. Then I turn them on from the command line using the NET commands.

As long as I turn off APACHE (and mysql) after I'm finished working with it I should be fine, right? The bad guys can't look around if the light switch is turned off, right?

I'm now working on a new setup issue. I downloaded phpmyadmin and I cannot seem to make it work. I just want to see the app come up in the browser.

AMP is my first experience with open source software. My heart is in the movement, but this stuff could drive you crazy. All the issues surrounding version and compatibility... Wild.

I put the phpmyadmin files in the document root and set the config file with the path, user and password. Keep it simple, right? Wrong. It doesn't work.

I think I'm just going to blow off myphpadmin for now and move on with the wrox book. I really wanted to see my tables and their records, but I think I'm just going to have to do that from the mysql command line.



Reply With Quote
  #8 (permalink)  
Old January 2nd, 2005, 02:28 PM
Authorized User
 
Join Date: Dec 2004
Location: , , .
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by ababb
 As long as I turn off APACHE (and mysql) after I'm finished working with it I should be fine, right?  The bad guys can't look around if the light switch is turned off, right?

Yes and no. I still recommend using a firewall no matter what. It's the safest thing to do. Even though you have those services turned off, there are other services that may be running on Windows that can still be exploited. Go to the following link and run a security test on your computer. This will scan your ports and tell you which ports are open.

http://www.dslreports.com/scan

Quote:
quote:
I put the phpmyadmin files in the document root and set the config file with the path, user and password.  Keep it simple, right?  Wrong.  It doesn't work.

I think I'm just going to blow off myphpadmin for now and move on with the wrox book.  I really wanted to see my tables and their records, but I think I'm just going to have to do that from the mysql command line.
Installing phpMyAdmin is pretty easy The following steps are for setting it up and running your server as localhost.
  • Download the zip file to your desktop.
  • Unzip the files into your document root. This should automatically create a new folder in your document root with the files in it. The folder that was created on my system was named: phpMyAdmin-2.6.1-rc1
  • Then open up config.ini.php in your favorite text editor. This file is located in the folder that was just created and is one of the extracted files.
  • Around line 39, there is the following line:
    $cfg['PmaAbsoluteUri'] = '';

    Change it to the following for port 80:
    $cfg['PmaAbsoluteUri'] = 'http://localhost/phpMyAdmin-2.6.1-rc1/';

    Or the following for port 8080:
    $cfg['PmaAbsoluteUri'] = 'http://localhost:8080/phpMyAdmin-2.6.1-rc1/';

    (Of course, if your phpMyAdmin folder is named differently, then make the necessary adjustments.)
  • Around line 69, check the following line:
    $cfg['Servers'][$i]['host']   = 'localhost';
    You should leave this alone if it's printed as above.
  • Around line 83, check the following line:
    $cfg['Servers'][$i]['auth_type']  = 'config';
    I left this as is so that authoriztion is via this config file.
  • Around line 84, check the following two lines:
    $cfg['Servers'][$i]['user']   = 'root';
    $cfg['Servers'][$i]['password']   = '';

    Adjust as nessary for your username and password that you have set to access your MySQL database. I have left mine as is, because I'm using it simply as a testing server. If you want to use MySQL and phpMyAdmin over the internet, then I strongly suggest you have a much more secure username and password.
  • And that's it!!! Now make sure you have the Apache service and MySQL service running, and enter the following URL into your browser:

    For port 80:
    http://localhost/phpMyAdmin-2.6.1-rc1/index.php
    For port 8080:
    http://localhost:8080/phpMyAdmin-2.6.1-rc1/index.php

Everything should work just fine. Good luck!
Reply With Quote
  #9 (permalink)  
Old January 2nd, 2005, 06:51 PM
Authorized User
 
Join Date: Dec 2004
Location: Dallas, TX, USA.
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to ababb
Default

okay, here's inadequate...

I did everything you prescribed above 10 times didn't work.  Hours of my mortal life down the drain.

I started over from scratch, doing everything you said and I'll be darned if it didn't work!  Five minutes and I had the GUI up and running.  The only thing I did differently from before (that I know of) was to use 2.6.0-pl3 because I thought it more reliable.

To borrow a line from Paul Vitti (Analyze This), "you've got a gift - you do!.  Yes you do!"

(a short time elapses...)

phpMyAdmin is pretty cool. This is going to be helpful.

Thanks a million,

ababb
Talk with again soon I'm sure!
Reply With Quote
  #10 (permalink)  
Old January 2nd, 2005, 07:23 PM
Authorized User
 
Join Date: Dec 2004
Location: , , .
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Glad to hear you got it working. Not exactly sure why you were still having problems, but se la vi. It's working now.

I'm sure we'll talk more as time passes. I'm currently in Chapter 14 working on the ecommerce stuff. This is pretty exciting stuff, because this is one of the main reasons I wanted to learn PHP.

Anyway, word to the wise...there are quite a number of typos throughtout the book and downloadable code. So...keep your thinking cap on and if something doesn't look right, question it.

Also, I've submitted at least a half dozen code corrections thus far, yet none have shown up on the errata page. I've been thinking about starting a thread dedicated to keeping track of errata. Perhaps when I'm done with the book, I'll go back and submit them in a post all together.

Cheers!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't access http://localhost... with Firefox Mikael71 Internet Information Services 0 December 22nd, 2007 06:17 AM
http://ip address:8080 is not working in Linux tehte Apache Tomcat 1 January 5th, 2007 04:22 AM
http://localhost:8080 asks me user name? mukarram J2EE 0 January 24th, 2006 01:21 AM
http://localhost/5040/punctual.aspx SniffenLik BOOK: Beginning ASP.NET 1.0 10 July 21st, 2004 01:09 PM
http://localhost not working yllw98stng Beginning PHP 4 October 19th, 2003 06:43 AM



All times are GMT -4. The time now is 06:01 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.