Jesus 'n Jim

A mainly PC (some Mac) site w/Software, Computer Repair Info, How-To's on Using Computers
Technical Support 1-360-521-2060 (my business line cell)

how to setup a development/testing Web server using Apache httpd, mysql, phpmyadmin

 

Overview

It is always best to avoid doing development work on a production server. if you get a forever loop in there, it basically slows down the server or takes it down and there's a possibility of your hosting account getting in trouble with the admins. here's how to install a development server. sorry folks, I was wrong about servers. don't install one. they only transmit over the internet, even on 127.0.0.1 I found out (took me a long time to figure out how to find out, checking router outgoing logs) - I had thought that localhost kept everything on localhost local. it doesn't.I was wrong about what I thought I found out. as long as the server is configured for "promiscuous mode" or * (meaning transmit on all network adapters it finds), or a NIC, will transmit over the internet, which is what you DON'T want. but with testing I found out that 127.0.0.1 is not visible beyond the local machine. you want that for your IP address.

just be careful about avoiding forever loops and infinite recursion in your php files when you upload to the hosting, because it can take slow down the production server or down your site and a bunch of other people's sites too. outages are not fun.

I have had trouble with getting bitnami servers to work out of the box and WAMP is just too simple and contains things I don't want and don't need.

you should know:

  • phpmyadmin is a database administration web application that comes with most server packages. I am thinking of installing it separately. get familiar with it. you submit your .sql files through this as well and backup your databases with it.
  • Filezilla FTP Client is only needed to get your files from your local machien to the production hosting server.
  • if you are trying to set up a Virtual Learning Environment thing or a Course Management System, there's Moodle. it has the whole server already canned and configured pretty much, just copy to your hard drive, and customize, xampp is included. I am not as into xampp as I was.
  • Apache is the http/https server. https is the SSL (secure) version of http. the certificates you will may need to purchase yourself from a cert authority(?). I have not done certs before, but I know that they can expire on you without you knowing. this is the reason why some vendors have certs which are "untrusted" according to your browser, but are yet still valid. but beware, some certs are not. better to be safe than sorry when visiting an https site.

basic lockdown

  • if you choose another server package, don't install the ftp server or mail server. or the other stuff. only install apache, php, and mysql. if you have a choice, don't install them as services yet. it's better to have them start up manually now.
  • sorry, the mysql databases are NOT portable when you are upgrading - you will have to make an SQL dump of the databases first. I would suggest having create tables if exists, drop tables.
  • an FTP server is a security risk. if you point it to your hard disk and it has write access, someone will start deleting your files. unless you can keep it corralled in with a firewall like sonicwall, but I still would avoid that. expensive anyway.
  • if you ARE trying to serve over the internet (such as in india or whatever, or webcam for training or classes and you are an instructor, or you are a business) then this video about port forwarding applies. it allows you to serve over the internet. some ISPs in the USA don't allow this in their TOS.

1st step: your hosts file

Your %windir%\sysnative\drivers\etc\hosts (sysnative or system32 depending on whether you have a 6-bit or 32-bit system) file needs at least these 2 adresses in it for IPV6 Support, like below. If you are on windows 2000 (NT4 does not have IPV6 support), it's c:\winnt\system32\drivers\etc\hosts

the hosts file can be edited with notepad, but I prefer Notepad++ (programmer's editor) since it does not try to forcefully turn it into a .txt file like Notepad does. you should edit this file from a cmd shell you have run as administrator.

#Example hosts file
#anything with a # in front is a comment and is ignored, 
# and blank lines are ignored

127.0.0.1 localhost
::1 localhost

I generally comment out the ::1 localhost because it causes problems.

save the file and close. after changing this, from a cmd shell, do ipconfig /flushdns and then reboot after changing this. there is a stickiness problem in windows 7 where it doesn't pay attention to the hosts file.

security you need to know about default httpd.conf

for a development/testing server, you should edit c:\apache24\conf\httpd.conf with dreamweaver or notepad++ and set Listen 127.0.0.1:80 or Listen [::1]:80 or both. this is localhost.

Otherwise, you will be broadcasting everywhere on every network card you've got and leaving ports open where you don't want them open - on the internet side.

this is taken care of if you use my config.zip's files.

won't my router's NAT block the server stuff?

I just asked linksys about my E4200 router the following question: "If I install a web server (something that transmits http over port 80) via a network card to the LAN side of my router, will it stay [locally] in the LAN or will it go out to the internet? I want it to stay in the LAN." my router is fairly recent and high end for an off-the-shelf product. The support person asked their supervisor and said "it will go out to the internet. you can't stop it."

I only have 1 option (see list of things to do):

  • serve up http (Apache) only over 127.0.0.1 (localhost) to my local pc. I use vhosts (virtual hosts). from my testing, this is not accessable even to other computers on the same LAN. 127.0.0.1 and [::1] appear to be quite local.
  • disable the startup for FTP (and don't install it) or other services in the Services button or via [windows-logo-flag-key]-R services.msc [Enter] for startup type!
  • I can still use named virtual hosts if I enter them in my hosts file (which is really convenient, I can have nice local test domains like abc, myjunk, blah, joespizza-com, etc and still have acess to the interenet just fine).
  • I use apache httpd from apachelounge. it's the most simplistic (doesn't come with perl), but it comes unsecured, transmitting over every NIC on the machine - so you have to configure the listen address (and any ports you want changed) in \apache24\conf\httpd.conf and \apache24\conf\extra\httpd-ssl.conf files to use 127.0.0.1 or [::1] instead of * (or a blank) to lock it down.
  • I verified with www.canyouseeme.org that it does not go out over the internet. (either that, or my ISP is unbeknownst to me blocking server traffic). in fact, my ISP is blocking traffic. I checked my router's logs when refreshing a page over the server on 127.0.0.1 (localhost), and at that time consistently I got results that showed it was going outside.

making a portable server?

hosts files are not quite portable. you are either using the whole thing or you are not, you still need an admin cmd shell to change a hosts file.

as for apache httpd is portable and you can simply exztract it. in fact, if you wanted, you might be able to put your whole site on a cdrom and serve it up from there, as long as you make sure you put your logs and database on c: and not on the cd in your vhosts... (well, it's not entirely portable...)

but you could copy the cd contents to the root directory of a hard drive to install the site. so if you need to set up a lot of test servers for say, a web development group or group of developers, you can. so if you need to rubber-stamp copies of a particular server config, you can.

serve it up over 127.0.0.1 for IPV4 (such is the case with most home routers) and it will stay local to the machine. if you are on ipv6, use ::1

appending doesn't work 100% of the time either.

also, you have to edit the hosts file using a cmd shell that's been run as Administrator. I usually make a shortcut for that. unlike a folder, deleting a shortcut to a file like c:\windows\system32\cmd.exe won't delete the target file.

a portable server can be useful, but it doesn't work if you are intending to do mysql since the data dir is a filesystem in itself and it's position within NTFS is sensitive, so it gets ruined if moved.

you COULD put your mysql dumps onto a separate cd/dvd and execute those with mysql.exe when needed to import to mysql on a hard disk.

for HTML+CSS+JS only, this would be great.

it would be interesting if you could use SQLITE for a database with PHP. it's more static and file-based, and would be portable. but it's not very multi-user.

virtual hosts/virtual servers

apache article on name-based vhosts. also note that you should make changes to DNS to do this. for our development/testing server, we are simply going to make changes to our c:\windows\system32\drivers\etc\hosts file. If you are on windows 2000 or NT4 (NT4 does not have IPV6 support), it's c:\winnt\system32\drivers\etc\hosts

PLEASE NOTE: using name-based virtual hosts means you can't use .com or .org or .net etc. domain names in your test server domain name, because this will block out YOUR access to the real production one on the internet (because now access to that domain name's priority goes to your local machine's hosts file first for name lookups, then DNS - whichever is found first wins).

most

use single-word-based names or names with dashes in them. (I think you can use names with dashes in them). the following names would be good hosts file examples (to edit your hosts file, you need right click and to run the cmd shell as admin):

  1. install notepad++, make sure when you do you run it as administrator so it works right.
  2. [windows-logo-flag-key]-[pause/break], advanced, environment variables, System variables, pick Path, Edit..., hit the [End] key. type C:\Program Files (x86)\Notepad++; and hit [Enter]
  3. click OK, OK. this will make Notepad++ easily accessible from the cmd shell or from the start menu search box.
  4. right [agghh - win8 doesn't have the ability to right click the cmd shell and run as admin! no start menu! have to do it the hard way folks (but actually makes things easier in the long run)...] right click on the desktop and pick new, shortcut. put in c:\windows\system32.exe or %windir%\system32\cmd.exe for the path to the executable.
  5. for the working directory, put in c:\windows\system32\drivers\etc or %windir%\system32\drivers\etc
  6. click advanced, make sure run as administrator is checked
  7. rename the shortcut (general tab) to admin cmd shell.
  8. click OK. I don't fully remember corretly, but if you delete this shortcut, you may not be able to use a cmd shell again without a windows reinstall/repair/refresh and some programs may not install or uninstall right which use the cmd shell, because sometimes deleting the shortcut can delete the file (at least it's that way with folders - I don't like that, there should be a safe unlink). keep that admin shell around, it will come in handy lots of times. things run from it will not have to be run as administrator. for instance, you can do a memory speed test by doing winsat memformal from the admin cmd shell or run chkdsk c: /f /r to fix the filesystem and refresh a hard drive (/r shortens the life of ssd's and flash so don't use on those).
  9. right click the shortcut and pick pin to taskbar.
  10. click the admin cmd shell you just created on the taskbar
  11. type notepad++ hosts and hit [Enter]. you should already be in %windir%\sysnative\drivers\etc (if you are on 32-bit, replace sysnative with system32) where the hosts file is located. it is a protected file and is readonly except when accessed from an admin cmd shell.
  12. do ctrl-[End] [Enter] to get to the end of file, and add a blank line.
  13. add your desired server info, in this basic format:
    127.0.0.1 joes-diner-com
    127.0.0.1 joes_diner
    127.0.0.1 flakypetesrestaurant
    127.0.0.1 fpr
    127.0.0.1 gonow-com
    127.0.0.1 vlk
            
  14. switch to notepad++ and hit ctrl-s to save.
  15. close notepad++.
  16. switch back to the admin cmd shell and do explorer .
  17. switch to the new windows explorer and then right click on the hosts file and pick unblock if the button is there.
  18. close the new windows explorer.
  19. switch back to the admin cmd shell and do
    ipconfig /flushdns
    nbtstat -R
    
    to flush all the network name caches. not sure if the 2nd one is actually necessary, but included it just in case.
  20. close the admin cmd shell
  21. reboot. for some reason, windows 7 doesn't pay attention to hosts file changes until you do, wasn't this way in windows xp. even then, it may not take. bugs in win7 dns cache? XP just seems to need a reboot now, wasn't this way before.

now saved, when you try to access these domains TCP/IP will resolve the domain to your local machine rather than doing through DNS over the internet. they are now local to your machine. the hosts file doesn't mean that your domains are on the internet, they are only local to your machine.

If you want to make this portable, there is a portable version of notepad++, or you can use edit instead. to exit rom edit, use alt-x

add this to php.ini:

log_errors=On
engine = On
expose_php = On
display_errors = On
display_startup_errors = On
log_errors = On
html_errors = On
default_charset = "UTF-8"
extension_dir = "ext"
extension=php_mysql.dll#deprecated
extension=php_mysqli.dll
extension=php_pdo_mysql.dll

you want to add this to your httpd.conf file (except the listen command, it should be replaced!):

#change the Listen entry in \apache24\conf\extra\http-ssl.conf 
#and \apache24\conf\httpd.conf to Listen 127.0.0.1:80 or Listen [::1]:80
Listen 127.0.0.1:80

LoadModule authn_alias_module modules/mod_authn_alias.so
#-----probably don't need this, but I included it anyway just to be sure.
LoadModule vhost_alias_module modules/mod_vhost_alias.so

LoadModule php5_module "C:/php-5.5.10/php5apache2_4.dll"
AddHandler application/x-httpd-php .php
# configure the path to php.ini
PHPIniDir "C:/php-5.5.10"
# Indexes+Document Root
#change the DirectoryIndex line to index.html index.php
#comment out Directory / section which causes 403 errors
#http://httpd.apache.org/docs/2.2/mod/mod_so.html
<FilesMatch \.php$>
      SetHandler application/x-httpd-php
</FilesMatch>

<VirtualHost 127.0.0.1:80>
    #-----this is a test domain named simply, http://test
    #-----its directory is c:\www\somewebsite\ 
    #-----use this like your test for your web site.  
    #-----hopefully there are no http://somewebsite.com 
    #-----type of absolute outside url's in your site.
    #-----your hosts entry will be 127.0.0.1 phpma
    ServerName phpma
    DocumentRoot d:/www/phpmyadmin
    <Directory "/www/phpmyadmin/">
    #    AllowOverride None
    #    Require all granted
        Options +Indexes +FollowSymLinks
        AllowOverride all
        Order Deny,Allow
        Deny from all
        Allow from 127.0.0.1
    </Directory>
    ServerAdmin nobody@phpma
    ErrorLog logs/phpma-error.log
    CustomLog logs/phpma-access.log common
</VirtualHost>



<VirtualHost 127.0.0.1:80>
    #-----http://gonow.com and http://www.gonow.com
    #-----(but these are local)
    #-----your hosts entry will be 127.0.0.1 gonow-com
    ServerName gonow-com
    DocumentRoot d:/www/gonow-com
    <Directory "d:/www/gonow-com/">
    #    AllowOverride None
    #    Require all granted
        Options +Indexes +FollowSymLinks
        AllowOverride all
        Order Deny,Allow
        Deny from all
        Allow from 127.0.0.1
    </Directory>
   	#ServerAlias www.gonow.com
    #-----you need entries in your hosts file for both 
    #-----gonow.com and www.gonow.com for testing/development
    ServerAdmin nobody@nowhere.com
    ErrorLog logs/gonow-com-error.log
    CustomLog logs/gonow-com-access.log common
</VirtualHost>

<VirtualHost 127.0.0.1:80>
    #-----http://vlk (but this is local)
    #-----your hosts entry will be 127.0.0.1 vlk
    ServerName vlk
    DocumentRoot d:/www/vlk
    <Directory "d:/www/vlk/">
    #    AllowOverride None
    #    Require all granted
        Options +Indexes +FollowSymLinks
        AllowOverride all
        Order Deny,Allow
        Deny from all
        Allow from 127.0.0.1
    </Directory>
   	#ServerAlias vancouverlocknkey-com
    ServerAdmin nobody@nowhere.com
    ErrorLog logs/vlk-error.log
    CustomLog logs/vlk-access.log common
</VirtualHost>

<VirtualHost 127.0.0.1:80>
    #-----http://flakypetesrestaurant.com and http://www.flakypetesrestaurant.com
    #-----(but these are local)
    #-----your hosts entry will be 127.0.0.1 flakypetesrestaurant-com
    #-----and 127.0.0.1 flakypetesrestaurant
    ServerName flakypetesrestaurant-com
    DocumentRoot d:/www/flakypetesrestaurant-com
    <Directory "d:/www/flakypetesrestaurant-com/">
    #    AllowOverride None
    #    Require all granted
        Options +Indexes +FollowSymLinks
        AllowOverride all
        Order Deny,Allow
        Deny from all
        Allow from 127.0.0.1
    </Directory>
    #ServerAlias www.flakypetesrestaurant.com
    ServerAlias flakypetesrestaurant
    ServerAdmin nobody@nowhere.com
    ErrorLog logs/fpr-com-error.log
    CustomLog logs/fpr-com-access.log common
</VirtualHost>

<VirtualHost 127.0.0.1:80>
    #-----http://joesdiner.com and http://www.joesdiner.com 
    #-----(but these are local)
    #-----your hosts entry will be 127.0.0.1 joesdiner-com
    ServerName joesdiner-com
    DocumentRoot d:/www/joes-diner-com
    <Directory "d:/www/joes-diner-com/">
    #    AllowOverride None
    #    Require all granted
        Options +Indexes +FollowSymLinks
        AllowOverride all
        Order Deny,Allow
        Deny from all
        Allow from 127.0.0.1
    </Directory>
   	#ServerAlias www.joesdiner.com
   	ServerAlias www-joesdiner-com
   	ServerAlias jd
    ServerAdmin nobody@nowhere.com
    ErrorLog logs/joes-diner-com-error.log
    CustomLog logs/joes-diner-com-access.log common
</VirtualHost>

        

The way things work is, your local computer will look up the domain name first in the c:\windows\system32\drivers\etc\hosts file, if it doesn't find it there it looks it up in c:\windows\system32\drivers\etc\lmhosts, if it doesn't find it there, it looks it up on the via DNS (Domain Name Service), and if it doesn't find it there, then the browser gives an error.

this means if you put in something.com in your hosts file, it will not be accessible from the internet. thatcan be used to block ads, but it can also unfortunately block other useful things, like your intended web site you want to host.

firewall

most firewalls will block by default all incoming stuff. you need to at least allow incoming (server) HTTP and HTTPS (port 80 unless you choose something like 8080, port 443) if you are serving up http, or incoming FTP (port 21 I think, could be 20) and FTPS. again, it violates the Terms Of Service agreement for most ISPs for any servers to be coming over their network. you would have to check your ISP's TOS when you signed up or the current TOS on their web site. look before you leap.

XHTML support

you can also put this in your httpd.conf or .htaccess file on your hosting.

by default, XHTML will be served up as HTML. what you will get is "tag soup" and improper rendering. you must modify httpd.conf .htaccess according to this article:

comment out a certain set of mod rewrite rules:

#RewriteEngine on
#RewriteCond %{HTTP_USER_AGENT} ((.*MSIE.*)|(Lynx.*))
#RewriteCond %{REQUEST_URI} \.xhtml$
#RewriteRule .* - [T=text/html]
        

add this:

#handle XHTML properly
AddType application/xhtml+xml;q=0.8 .xhtml
DirectoryIndex index.xhtml index.html
<IfModule mod_rewrite.c>
  RewriteEngine on
  # Uncomment RewriteBase line if adding inside per-directory 
  # configuration files (e.g., .htaccess):
  # RewriteBase /
  RewriteCond %{REQUEST_URI} \.xhtml$
  RewriteCond %{HTTP_USER_AGENT} MSIE [OR]
  RewriteCond %{HTTP_ACCEPT} application/xhtml\+xml\s*;\s*q=0\.?0*(\s|,|$)
  RewriteRule .* - [T=text/html]
</IfModule>

this stuff is in the httpd.conf in the config.zip above.

gotchas

know that this virtual hosts configuration ONLY works on YOUR machine due to lack of DNS support. anything more than this configuration requires a DNS or DDNS service (which you pay for) at least, and that that DNS server be interfaced to the internet's DNS servers. some or most of ISPs TOS agreements state no servers allowed, and/or they do not support DDNS (Dynamic DNS) Service, which would enable a DHCP to have DNS basically.

some technical support folk will want to reset your hosts file, so keep a backup somewhere where you can find it!

403 access denied errors

instructions for xp/vista/7/8 and up machines

in windows vista/7/8 and above, because the c:\windows\system32\drivers\etc\hosts file is under the c:\windows\ directory, it is a protected file just like c:\program files\. this means in order to change the hosts file, you umust run Notepad++ as Administrator.

  1. [windows-logo-flag-key]-E to bring up Windows Explorer, or start, my computer.
  2. change the options for viewing folders so that you can view file extensions for known file types and view hidden folders. be careful when using this feature! know what you are doing. file extensions have certain uses to different programs. .exe's are executables, and .html is a web document that's essentially a renamed .txt file, but the text is in a certain format.
  3. download apache (see resources) and extract to c:\
  4. use windows explorer to browse into the directory structure of c:\apache24 or whatever it is, go into \apache24\bin\ and right click on each exe and pin them to the taskbar. really, you only need the httpd.exe, you can ignore the monitor program.
  5. download notepad++ and run notepad++ installer as administrator to install it.
  6. copy and paste the vhosts info into the \apache24\conf\httpd.conf and possibly \apache24\conf\extra\http-ssl.conf the virtual TLD (top-level-domain) domain names MUST match your ServerName and ServerAlias in httpd.conf
  7. edit to suit your needs.
  8. download winmerge and run as administrator to install it. turn on plugins.
  9. download 7-zip and run as administrator to install it. choose to integrate into Windows Explorer. this step is optional, since windows has a limited (and in the past, broken) built-in zip and unzip utility into Windows Explorer.
  10. download mysql GA server and and right click and run as administrator and install it with bind-address to 127.0.0.1 and default port 3306. latin-1 is fine. you can use utf-8 if you need to, but this may require extra steps when writing php code.
  11. download and extract phpmyadmin to \www\phpmyadmin and make a vhost for it and make a hosts entry for it like 127.0.0.1 phpma
  12. configure phpmyadmin
  13. make a copy of your changes into a separate file as a backup. if you upgrade your server because you need a newer PHP, your httpd.conf file will be overwritten and you will need the backup. an alternative is to extract into a directory name with a dashed date or version as a suffix to \Apache24
  14. type [windows-logo-flag-key]-R services.msc[Enter]
  15. right click on Apache service, properties, and set to login as system (doesn't seem to like anything else, I was told .\yourUserName if you have admin rights).
  16. create the directory structure you outlined in httpd.conf in the virtual hosts.
  17. turn on the setting in winmerge in edit, options, editor: automatic rescan, character level, break at whitespace, preserve original EOL chars, tab size 4
  18. when you upgrade server software, in winmerge, you merge changes by right clicking on lines and copying them to right or left, whichever is appropriate. if you need to. it works as an editor also. it does not save on exit, so be sure to save with ctrl-s if you want to keep your changes!
  19. if apache httpd or a service doesn't start, check the event viewer's application log for error messages and clues and system in event viewer. to get to event viewer fast, [windows-logo-flag-key]-R eventvwr[Enter]
  20. run notepad++ and open your c:\Apache24\conf\httpd.conf and make any required change and save with ctrl-s. leave it running until the debugging process is over, then close it - remotting will close it too.
  21. attempt to start the apache service. if it works, go to next step else go to step 25.
  22. if you do not get a green light for Apache, or service control manager does not show "started", alt-tab back to event viewer, refresh the application log, and look at the latest Apache error to see what chanbges you need to make. note the line number of any syntax error.
  23. alt-tab or otherwise switch back to notepad++ and do ctrl-g and type in the line number you want to go to and hit [Enter]. make any changes necessary.
  24. repeat to step 19 as necessary.

the server root directory is located at c:\apache24\ and the htdocs directory where apache normally serves up localhost from is located at in c:\apache24\htdocs\ you can delete the contents of htdocs and replace this with your web site.

getting mysql running

mysql data files in the data directory are not to be touched. they are a filesystem in themselves and their position within NTFS MAKES A DIFFERENCE. this means that you cannot copy or move it, the copy will not work, and renaming or moving will break the database. this is why you have database tools, including replication for copying, load balancing, hot backup, etc.

mysql:

  1. install mysql with IP address 127.0.0.1 over default port 3306.
  2. edit \mysql\bin\my.ini using notepad++
  3. change username, password if you want, port, bind-address in [client], [mysqld], [mysqldump], [mysql]. passwords can be generated from my pwdgen page
  4. in [client], [mysqld], socket = "C:/mysql/mysql.sock"
  5. upgrade: edit and merge in the my.ini
  6. set your time zone appropriately. users of big tables like GeoIP will want to tune their database, since GeoIP has between 100K-1M inserts and takes about a day!
  7. use services.msc to stop mysql if it has been started
  8. [windows-logo-flag-key]-R cmd[Enter] or start a cmd shell
  9. cd into the mysql directory
  10. resetroot (this changes the root password on the database to what's in my.ini) - you can also double-click on this batch file, but I want to see the error messages, if any! it lets me know if I did something wrong and I need to fix something.
  11. [windows-logo-flag-key]-R services.msc[Enter] start mysql.
  12. if a service doesn't start, check [windows-logo-flag-key]-R eventvwr[Enter] the event viewer which is available in control panel, adminstration tools in the application log for error messages and clues and system in event viewer.
  13. repeat to step 4 as necessary.
  14. stop mysql
  15. until you right click on mysql service and configure for automatic start (meaning "at boot"), from now on you will need to start using services.msc to start/stop mysql.
  16. your web sites like c:\www should really be on a different drive than what windows is on if possible, so if you have to reinstall windows, you don't lose your data, at least I have been told.
  17. to create and edit databases and database data, extract into its own virtual host, and configure phpmyadmin in a subdir under c:\www\ like c:\www\phpmyadmin web site. you should make a hosts entry for this also and you should have vhosts entry in httpd.conf pointing to the directory c:/www/phpmyadmin
software resources
get all of these and install them and configure where necessary, you will need them all at one tijme or another.
Apache+PHP (Apache Lounge - httpd web server and php server-side scripting engine), available from ApacheFriends.org free, open source
\Apache24\conf\httpd.conf and \Apache24\conf\http-ssl.conf are set to listen on ALL interfaces, which is NOT secure, and they tell you this up front, so don't start the server immediately. for a development server, you should set Listen 127.0.0.1:80 or Listen [::1]:80 and save it, right away. this is localhost, and you should have those 2 IP addresses in your hosts file as I show you above for future IPV6 support.
MySQL (SQL database server - free for development and web use like with PHP but costs like $600 for embedded c/c++ etc), available from mysql.com GA server download free - open source version is mariadb.com
you configure my.ini with your server settings. default server port is 3306. bind-address=127.0.0.1 in most .ini sections. installs as a windows service and so is available via services.msc. commonly used with PHP for developing database-driven sites. a client is not provided, so you typically install phpmyadmin.
phpmyadmin free database administration program written in PHP.
I have not configured this yet. maybe soon. you configure thia according to these install instructions. looks like you will need 7-zip to extract the tarball (.tar.gz)
7-zip archive compression/extraction (zip+unzip), free, open source
I use this for just about everything. extracts tarballs like phpmyadmin. makes good (and large) zip files, overcomes XP's built-in limitations and bugs with its zip format. has 7z.exe commandline tool that can make self-extracting archives that have an icon. can also make backups that span multiple volumes (split archives) using -v4300m for DVDs.
I add the 7-zip directory to my PATH (an environment variable in [windows-logo-flag-key]-[pause/break], advanced, environment variables, system, Path, edit (click inside and hit the End key or Home key before editing or you lose it all and you have to reinstall windows if you blank out some of the stuff and you click OK! - there's cancel if you want to back out...).
Notepad++, available from notepad-plus-plus.org free
excellent and simple programmer's editor. can edit column blocks. has problems with lining up columns of characters, even with monospace fonts like courier new and OCR A Std. has FTP
winmerge, available from sf.net/projects/winmerge free,open source
for merging text files with differences. great for merging 2 different httpd.conf files or my.ini files during a server software upgrade (install server to different directory, like version number with name without spaces).
optional apache modules
mod_cband, available from dembol.org free, open source
makes a good dialup simulator. per-user, per-vhost, etc. bandwidth limiting. dialup goes no faster than 26400bps (3300bytes/sec) due to fiber multiplexing - you are NOT going to get the full 56K these days due to the phone company. yes, there ARE dialup users out there trying to visit your site. and big images can lock up a single-core win98 machine with NetZero, so don't design your entire page with photoshop. I think it requires apache source code to compile it.

SQL commands to create user accounts to simulate prod[uction]

here is the SQL Syntax straight from the MySQL 5.7 User Manual on the CEATE USER command and the MySQL 5.7 User Manual on the GRANT command.

example:
CREATE USER 'joe_bits'@'localhost' IDENTIFIED BY PASSWORD 'somepassword'

then you give permission for the user to have access to the database tables, or the database.

examples:
GRANT ALL ON somedb.sometable TO 'joe_bits'@'localhost'
or
GRANT ALL ON somedb.* TO 'joe_bits'@'localhost'

I suggest you create your table using phpmyadmin if you don't know the syntax or you just don't want to do the typing. I have some SQL examples in my code library. you can also see the MySQL 5.7 syntax for CREATE TABLE.

If you are doing PHP, chances are you are going to need a database server too.