Monday, January 16, 2023

How to start XAMPP and localhost project with one click

 


Let's clear basic idea first what is XAMPP and localhost in terms of computer and non computer knowledge.


XAMPP is a software package that contains Apache, MySQL, PHP, and Perl. It is commonly used to run web servers on a local machine for development and testing purposes.


Apache is a web server that is responsible for handling and routing incoming HTTP requests. It listens on a specific port (by default, port 80) and when it receives a request, it routes the request to the appropriate location on the local machine.


MySQL is a relational database management system (RDBMS) that is used to store and manage data for web applications. It runs on a separate port (by default, port 3306) and can be accessed by the web server (in this case Apache) to retrieve and store data.


PHP is a server-side scripting language that is used to create dynamic web pages. It is integrated with Apache and can be used to create web applications that interact with the MySQL database.


"localhost" is the domain name that refers to the localhost IP address (127.0.0.1) that is used to access the local machine. When you type "http://localhost" in a web browser, the browser sends a request to the local web server (Apache) on port 80. The web server then looks for the appropriate content to return to the browser.


When you set up a project on localhost, it means you're making that project available on your local machine for testing and development purposes. Instead of having to upload the files to a remote web server to test them, you can test the project on your local machine by accessing it through "http://localhost/<project_name>" in the browser.


In summary, XAMPP is a software package that allows you to run a web server on your local machine, with Apache handling incoming requests, MySQL managing data and PHP handling the dynamic content, when you access localhost, your browser sends request to Apache which then uses PHP and SQL to retrieve the data and display it on your browser.

 

So, Now Here comes the main deal of how we can run this project.


If we follow the above steps we have to whenever we need to run the project we have to start XAMPP as well since provides the main services to for the project.


So for window users there is one language which can be use to make this process more automated and easy to use on regular basis.


This will allow you to make project who don't want to run this on public hosting instead run only in local machine like you personalized application most of people might already know about the BATCH files.

 

A batch file is a type of script file that contains a series of commands that are executed in a specific order by the command prompt (cmd.exe) in Windows. The commands are typically used to automate repetitive or complex tasks, such as starting or stopping services, copying or moving files, and running other programs.

  • "Automating XAMPP and localhost launch with batch file"
  • "Creating a shortcut to start XAMPP and localhost project with one click"
  • "Batch file for starting XAMPP and launching localhost project"
  • "Scripting XAMPP and localhost project start with batch file"
  • "Easy way to open XAMPP and localhost project using batch file"
  • "Batch file automation for XAMPP and localhost project launch"
  • "One-click start for XAMPP and localhost project with batch file"
  • "Simplifying XAMPP and localhost launch with batch file script"
  • "Efficiently starting XAMPP and localhost project with batch file"
  • "Streamlining XAMPP and localhost project launch with batch file automation"

 

Batch files have the file extension .bat or .cmd and can be created using a text editor such as Notepad. The commands in a batch file are written in a specific syntax, and each command is executed one after the other, in the order in which they appear in the file.

Some common commands used in batch files include:

  • echo: displays a message on the screen
  • dir: displays the contents of a directory
  • copy: copies one or more files
  • xcopy: copies files and directories, including subdirectories
  • del: deletes one or more files
  • start: starts a new program or opens a new window to run a program
  • netstat: displays active network connections and their status
  • tasklist and taskkill: displays or kills running tasks or processes
  • if and goto: used for conditional statements and branching

 

Batch files can be used to automate a wide variety of tasks and can be scheduled to run at specific times using the Windows Task Scheduler. They are commonly used in system administration and can be used to perform repetitive tasks, such as backups, data processing and automated software installations. 

So, Following code and instruction may help you in this type of solutions which answers these following problems :

 

To do that follow these steps:- 

1.    Open a text editor (e.g. Notepad) and create a new file.

2.    At the top of the file, add the following line: @echo off. This will prevent the command prompt from displaying the commands as they are executed.

3.    Next, add a line to check if the XAMPP control panel is already running. You can use the tasklist command to check if the xampp-control.exe process is running, and the find command to check if the process is listed in the output of tasklist

Copy code

tasklist /fi "imagename eq xampp-control.exe" 2>NUL | find /I /N "xampp-control.exe">NUL

 

4.    If the XAMPP control panel is already running, you can stop all the XAMPP services using the xampp_stop.exe utility that comes with XAMPP by adding the following line:

Copy code

start /B "C:\xampp\xampp_stop.exe"

 

5.    Now you need to start the XAMPP control panel in a new window by adding the following line:

Copy code

start "" "C:\xampp\xampp-control.exe"

 

6.    If you want to open a browser with your localhost project you can use the start command again and add the url you want to open

Copy code

start "" "http://localhost/<project_name>"

 

7.    To close the command prompt window after the batch file has finished executing, you can add the following line:

Copy code

start /B exit

 

8.    Save the file with a .bat file extension, for example "startxampp.bat"

9.    Now you can double-click on the batch file to execute it. It will check if the XAMPP control panel is running and stop it if it is running, then it will start the XAMPP control panel and open the specified localhost project in the browser.

 

Note: Please keep in mind that this is just a basic example, and you can customize it to fit your specific needs.

 

To make it more usable I have created one sample below with more customizable.


Keep in mind the <rem > at what ever line you find that is just comment use in batch.


@echo off

rem Check if XAMPP control panel is already running
tasklist /fi "imagename eq xampp-control.exe" 2>NUL | find /I /N "xampp-control.exe">NUL
if "%ERRORLEVEL%"=="0" (
    echo XAMPP control panel is already running
    rem Stop the running XAMPP control panel
    TASKKILL /F /IM xampp-control.exe
) else (
    echo XAMPP control panel is not running
)

rem Check if Apache is already running
netstat -ano | find ":80" > nul
if not errorlevel 1 (
    echo Apache is already running, Stopping the process
    TASKKILL /F /IM apache.exe
) else (
    echo Apache is not running
)

rem Check if MySQL is already running
netstat -ano | find ":3306" > nul
if not errorlevel 1 (
    echo MySQL is already running, Stopping the process
    TASKKILL /F /IM mysqld.exe
) else (
    echo MySQL is not running
)

rem Start the XAMPP control panel in silent mode
start "" "C:\xampp\xampp-control.exe"

rem Open the project URL in the browser
start "" "http://localhost/myproject"

rem Add a delay of 3 seconds to allow Apache to start
timeout /T 3


rem Close the command prompt window
start /B exit


That's all Now you can make any launchable file in offline either user know what software to run or not just like any other apps you can click and run the project as your personalized tool in offline server.

Follow the steps and create many other automation ideas using batch of your own.

Ex.

1.    Backup files and folders: Create a batch file that copies important files and folders to a backup location on a regular schedule. The batch file could include commands to compress the files and encrypt them for added security.

2.    Automate software installations: Create a batch file that installs a list of software programs on a new computer. This can include silent installations and configuration of the software.

3.    Shut down or restart the computer: Create a batch file that automatically shuts down or restarts the computer after a certain period of time. This can be useful for scheduling overnight maintenance tasks or for remote shutdown of computers in a network.

4.    Creating a shortcut for frequently used commands: Create a batch file that contains a set of frequently used commands and then create a shortcut to it on the desktop for easy access.

-Thank you for reading.

Friday, May 22, 2020

Self Learning


    Knowing yourself is an important step towards Self Learning. Identify the qualities that make you unique to learn your true self. As time goes on, you can build on these discoveries to build a deep and meaningful relationship with yourself. 

There are Many ways to learn about yourself one of them is Create a good work-life balance. 

    Don't just define yourself by your work or your career advancement. While it's good to take pride in your work, try to make room for yourself outside your work. Do not bring work stress to home with you.

    But as we all know about the pandemic situation in over the world we from IT sectors are bound to work from home here. Which is kind of stressful than before.

Pros

  • You 're totally free. It's a lot more than just getting to work in your pajamas. Working at home includes an understanding to rely on self-motivation , self-discipline, focus, and concentration. 
  • You can do more task. As long as you don't sneak off the TV Show or Series, you can actually be more productive when you work from home. 
  • Most of the people will become a communications expert at this time. Because it's not possible to get a quick meeting with in staff room, clients must get up to speed upon where methods of communication are available. From texting, Skyping, emailing, web meetings — you have to be really skilled in all of them to be a communications expert.

Cons

  • You might forget to watch out time. While people seem to think that working from home means doing less, the flip side might be true for half of the employees. "When you never get that separation from rushing to / from office, your workday is just blurring your personal life together,"Thought like you're every time "at work" could result in stress." 
  • You can feel it off the loop. Those who might not always fully understand it until you're in there, but there's still a large number of comfortable collaboration happening on inside the office. Unless its climbing on top of ones teammates' quality standards or getting an outdoor team building meal session, it's impossible to match it from home. 
  • You may never have full access to internet forums. By the most part, virtualization technology has made it possible for remote members to work anywhere on now than before. However, there are still cases where concerns about information security or data protection may prevent internet providers from having easy access.


    At this point we have to be more capable on learning ourself.

    Gathering more knowledge is now as easy as striking Google, also doing experiments, studying in the best way, and trying to force yourself through the hill. While having this incredible information access, there are several people who are taking full advantage of the opportunity they had in self-directed learning.

    We ’re assuming in the false notion that if you want to learn something you'll have to be trained about, you 're entirely capable of teaching yourself. It was no longer an issue to get a higher level of education to be eligible to apply to do something, and while big, companies haven't realized that its mainstream opinion in smaller, on forward-looking entrepreneurs. A lot of talented normal people have grown how they are today by teaching self capabilities, so there's no way you can't do the same thing. 

    Self-education can free you from a work which you don't like, from a college major you aren’t excited about, and it will be a core skill for our time. You can take full advantage of the knowledge available to you to grow your skill set.

Here I have given you Some Links To learn new things on your own....





Friday, August 30, 2019

First Step


First Step -Try and Error. .😕 😓 😆

Hi everyone this is my first blog as I m starting to write blog to share my knowledge over my work.


It’s not just going to be blog but a life experience of everyday life about working as freelancing, Job or Entrepreneur.


 I am here to tell what’s going on in our daily life of web world technologies, unique websites, helpful tricks, development and many more...

 It’s not just me but about every fresher who want to do job or want to be entrepreneur who know how to take risks in the hope of profit?

 I completed my first phase of being a fresher, being a fresher mean not only that you have to go through only job or work free for some one...

         It’s about learning like in coding language nothing compiles in first attempt it’s a phase which is called try and error whereas in freshers life most of the time learning something new is trial-and-error system here we learn new things a great things which is not taught by any schools and colleges, if you know what I mean you are already on a verge of understanding what you desire for your future..

        In many ways, trial-and-error is the only form of learning what we really know. When we make wrong decisions, or fail at something, we give ourselves an opportunity to resolve that failure, make changes and do it again. It repeated over time is the only real, effective way what we have to learn more about our field and solve problems in our life. It is called self improvement.

 Like today I have tried to do something different its a trial-and-error for me to express me as well as every newbee like us . . . Hopping to continue my journey to next Phase whatever it holds, one thing never change in this is I still have to try....

Recently Searched