I have a 3-step process for developing and deploying my website. It’s intended to assure code integrity while having adequate testing. It consists of a DEV_Environment where all files are created and changed; a localhost integration testing environment created by a batch file that copies selected files and folders from the DEV_Enviroment onto a different drive; and finally the webhost environment.
Code migrates from DEV to localhost to webhost. All final testing and acceptance is done in the localhost environment, therefore, files placed there are read-only, forcing me to maintain base code in the DEV environment. Files are only ever uploaded to the web host from the localhost environment after testing to acceptance. The protocol: base code starts in the DEV_Environment; code is integration tested in the localhost environment but not created or changed there; code is uploaded to the web host from a single localhost folder that contains all files that have been tested to acceptance. (Is that clear? Seems hard to describe.)
Recently I’ve tested and made changes in the localhost environment, breaking my discipline for the sake of the convenience of not having to copy files from DEV to localhost. I want to create a test environment on my DEV environment drive. I asked Claude.ai how to do that and was told that I should install a portable XAMPP environment on by DEV drive. To me, portable implies using a portable device such as a smartphone or ipad or USB dongle. I’m confused by the ‘portable’ terminology.
I’m not proficient in setting up servers. I managed to get a localhost set up on a drive, but it’s been too long for me to remember the details. What I want (I think) is to have a server running in my DEV environment so I can test and recursively make changes until my code works. This server is in addition to the localhost server that lives on a different drive.
So . . . with the knowledge of my planned progression and technique for maintaining code integrity, can anyone suggest where and how to find a ‘portable’ XAMPP and how to install it in my DEV environment? I’ve not been able to find a reference to a portable version. I think I’ll have to use a different port but, as I said, I’m too new at this to know for sure.
What is a portable XAMPP? How is it different from a regular XAMPP? Why should I install portable XAMPP and not XAMPP?
I downloaded XAMPP and ran the install to my G: drive, where my DEV_Environment is and where I want to be able to do some testing. I edited the httpd.conf file to use port 3308 at bothe LISTEN spec and the localhost naming spec. I changed the MySQL my.ini file to set port=3308. I could not find the value $cfg[‘Servers’][$i][‘port’] = ’ '; in config.inc.php as installed; so I didn’t change it. Should I insert that line using 3308 as the value in the single quotes?
WRT to MySQL, I have only one database. It is already accessible from the xampp localhost on my testing environment. It uses a different port number. Is it possible to have the database accessible from both xampp environments? If so, how? What I read seems to indicate that each xampp environment wants its own port and only one can be set.
I don’t trust the ai because it has had me chasing my tail before. I need some solid advice.
I think by portable it means it can run from a usb stick. I use to walk around with a usb stick with some of those applications just in case were I work didn’t have an app that I needed.
Maybe this is not what you want.
If you want isolation perhaps using Docker is the way to go.
A portable app is an application that you can simply move from system to system and run. That might be by having it on a USB stick, or just copying a folder or a .exe file.
Basically the app doesn’t require a setup process to integrate it into the system. It doesn’t require files to be installed in a specific place. It doesn’t require registry entries to be created. It doesn’t require a driver to be installed or services to be installed. It just runs and does what it needs to do.
Based on the information provided above, I don’t need a portable version. I don’t intend to do any development or testing on any system other than this one.
Is something such as testing (development), staging and production environments be essentially the same as you are describing? If all sites are in the same computer then you should be able to use one Apache server.
Or perhaps webhost is a different computer. I think that is worth mentioning if it is true.
I think yes but a portable setup would work essentially anywhere. Previous replies have said that you do not need a portable setup. I think you need one XAMPP installation with one Apache server and one MySQL server running. There is much to learn but I think you will feel good and powerful when you have it figured out. Perhaps I am wrong about using only one MySQL server, it is possible but you might want separate MySQL servers.
I have 3 environments in which my code needs to run:
the development environment
the integration testing environment
the web host environment
I create all code and change all code in the development environment. By having only one place where code is created and maintained, I can more easily ensure code integrity. I do some testing in this environment.
I have a separate environment - on the same computer but different disk partition - where I do integration testing to ensure the code is ready to be hosted to the Internet. No code is changed or created in this environment. This is where I run XAMPP that provides my Apache server
My third environment is the Internet where my web host serves my files to users. No code is changed or created in this environment.
Having 3 environments means that code has to move from one to the other (but never back, to maintain integrity). I have batch files that automate the movement of code from the development environment to the integration/final testing environment on my computer. I use an FTP app (Filezilla) to move code from the integration/final testing environment to my web host’s systems. I patterned this setup on the way I used to manage mainframe programming where business demands required extensive testing which included individual component testing, testing of all components in an integrated environment (which is where testers and user subject matter experts participated in testing and sign off), and finally implementation into the production environment (equivalent to Internet hosting). I have no idea how code is created, tested, and implemented in today’s non-mainframe world.
Note that I do not make changes in the test environments but make them only in the development environment. If - more assuredly, when - problems arise in testing that must be resolved, the code is modified and must be, again, moved to the testing environment. This is necessary to maintain code integrity because if I changed code in the testing enviroment, there is no assurance that those changes would be replicated in the core code that is accessed only in the dev environment. Having to move the code after changes becomes onerous as the system becomes more complex and testing reveals the need for more changes. It is to save the time required to move the code from dev to test that I plan to create a second XAMPP, ie, a second Apache server. Because I’m a single developer in this process, there will never be a time when both servers will run simultaneously.
If you’re not already doing so, I recommend you start using a version control system like GIT or SVN to manage your changes. You can also use it to help move your code between environments.
What I do is have three separate branches in my version control system (SVN, because its an old project).
trunk - This is where development work happens.
staging - This is where testing occurs before release to production.
production - This is where the production code ends up
During development, work is done in the trunk branch. When I get a feature or fix ready for release, I merge the changes from trunk into staging, then in my staging environment update the code. When I’m happy with the results in staging, I merge the changes into the production branch and update the production code base.
Moving the files between environments using version control makes it easy (simple update command), gives you a record of the changes, and minimizes the risk of a mistake (ie, missing or extra files).
For my dev and staging environments, I just have two separate host configurations in apache pointing to different folders on the disk. Each has it’s own host name (ie, project.home.arpa vs project.staging.home.arpa) so I can access either one by just loading the appropriate URL in the browser.
I use git and github as an ultimate backup. I’m very inexperienced with it, to say the least.
I’ve tried to create your trunk > staging > production protocol without the ability to merge code from trunk to staging. I need to delve into git a good deal further. This might work for me if I understand it better.
IME git and github are very interactive which does not lend their use to automation. IOW, I’m not sure that I could create a Task Scheduler event that would backup my files and databases using git/github. Do you know if this is possible? My goal for backups is to automate the task but confirm daily that it executed correctly.
FWIW: I only use git to update my repo when I upload a ‘version’ to my web host. Maybe I should be doing more commits while in development, but I’ll have to understand the process better to be sure I don’t shoot myself in the foot.
It’s probably possible, but git isn’t for backups really. You should have a separate backup solution and just leave git to do what it’s supposed to do which is revision management.
Common wisdom is “Commit early, commit often”. During development, you should be committing your code often rather than just when everything is done. I’ll usually do a commit whenever some smaller component of the overall task is done (some function/class is implemented, one page is done, etc). Sometimes though I’ll just make a commit with a [WIP] message just to “save” my progress then keep going.
Git in particular is designed to make this easy by allowing you to easily create a new branch, do some work and then either trash it or merge it back. I create a new branch for each feature/task I want to do and in the branch I will commit the code quite frequently. If I like the code when I finally finish it I will do a rebase to reduce the number of commits then merge it into the master branch. If I don’t like it, I’ll go back to the original master, start a new branch and try again.
I consider Git to be quite difficult to learn. I think it would be relatively easy to understand but everything I read provides the details with few concepts. I wish authors would learn how to express concepts first then details.
Definitely you need to learn more. Git itself is commands (shell, command-line, console or whatever you want to call it).
Yes it is. I am not sure how the database backup would work but it is possible.
Probably more commits would be appropriate. I am not sue how you deploy to your web host but when we use GitHub we usually use GitHub Actions to do the deployment. Source code can be compiled in GitHub in a GitHub Action and the output copied to production. The process is often called Continuous Integration/Continuous Delivery (CI/CD).
I learned more than 75 years ago that the shortest distance between 2 points is the way you know.
I don’t know (yet) how to use git / github very effectively. Based on what I know, I see those tools more as version control and multi person team development tools than as back up tools. While they can, possibly, be used for backups, so can a screwdriver be used to clean fish (I’ve done it); however it ain’t the best tool for the job.
For now, I will continue to use batch files and task scheduler (the way I know) for backing up my environments and databases and use git / github for version control and documentation. That could change if I learn more and become more proficient.