WAMP Up Your Open Source Development on Windows for Free

WAMP Up Your Open Source Development on Windows for Free

first got interested in running PHP using the Windows operating system during a business trip to Toronto. I was staying with my cousin who, like many people, uses Windows exclusively. My dilemma: I wanted to test out some PHP code but didn’t want to upload it to my FreeBSD box until I knew it was working. This article explains how to set up Apache, PHP, and MySQL on a Windows desktop to create a testing environment for PHP code.

A look into the Windows world revealed that PHP, Apache, and MySQL have made some serious progress in Windows compatibility. The MySQL, PHP, and Apache teams have done an excellent job of producing a Windows installer for each of these applications. What’s more, the PHP team has branched out to make PHP compatible with a number of servers, including Microsoft PWS, IIS, Apache, and Xitami.

Both Apache and PHP work well with a number of databases. I choose to use MySQL (foremost) because it is free and (second) because it is stable. The combination of Apache, MySQL, and PHP empowers a developer to set up a robust, database-driven Web site testing area for nothing more than the cost of a computer. To ease this install, you can download the Windows Apache, PHP and MySQL files.

Installing the Trio
Part of the trick to installing this power trio is to do so in the correct order:

  1. MySQL
  2. Apache
  3. PHP

MySQL
Decide where you want to insert the MySQL directories. The default location is C:mysql, which is perfectly fine. Unless you have a specific reason for installing them to different locations, install each of these three applications to its default directory.

Apache
Windows 95/98 users should use Apache 1.3.31. All other Windows users should be fine with Apache 2.0.49. If you have IIS or another server installed already, you don’t need to uninstall it. Your other server(s), however, will have to be shut down while Apache is running. Simply choose where you want to install Apache. I recommend C:apache2. When prompted, set your domain name to localdomain and your host address to localhost (see Figure 1).

Figure 1: Configuring for localdomain and localhost with Apache 2

PHP
As you install PHP, you will be prompted to choose a server with which to work. In this case, choose Apache (see Figure 2).

Figure 2: Choose Apache as the Server Type
  1. Navigate to the folder where you installed PHP (the default is C:PHP).
  2. Copy the file php4ts.dll to your system directory (e.g., winnt/system32 or windows/system).
  3. Navigate to C:PHPBACKUP (or wherever you installed PHP) and copy the file php.ini or php.ini-dist to C:windows for Windows 95/98 users or to C:winnt or C:winnt40 for Windows 2000/NT/XP users.
  4. After you have copied the php.ini-dist file, rename it to php.ini. The php.ini file is integral to manipulating the PHP language. To extend the capabilities of the default PHP installation, you must edit the php.ini file.

Almost there… now restart your machine to put the Apache options into your start menu.

Configuring Apache
Apache needs to be configured to recognize calls to PHP. Go to your start menu ?> Programs ?> Apache HTTP Server 2.0.50 ?> Configure Apache Server ?> Edit the Apache HTTP Configuration File, and add the following to the very bottom of the httpd.conf file:

ScriptAlias /php/ "c:/php/"AddType application/x-httpd-PHP .phpAction application/x-httpd-PHP "/php/php.exe"AddType application/x-httpd-php3 .php3AddType application/x-httpd-php3-source .php3sAddType application/x-httpd-PHP .phpAddType application/x-httpd-php-source .phps

This tells Apache both where to find the php.exe file and how to handle .php calls. Close httpd.conf and save the changes.

Configuring MySQL
To configure and start MySQL, open a DOS console in one of the two following ways:

  1. start menu ?> run ?> and type cmd
  2. start menu ?> programs ?> accessories ?> Command Prompt

MySQL DOS Commands
Those of you who want to install MySQL as a service that starts every time you boot up:

TYPE C:mysqlinmysqld –install 

To stop using MySQL as a service:

TYPE C:mysqlinmysqld –remove

To manually start MySQL:

TYPE C:mysqlinmysqld --console

To manually stop MySQL:

TYPE C:mysqlinmysqladmin -u root shutdown

Setting the MySQL Root Password
You now should have MySQL running in a DOS console. Open another console window using one of the two methods described above. You need to change the default root password on your MySQL Windows install. Write your password down somewhere so you don’t forget it.

TYPE c:TYPE cd mysqlinTYPE mysql -u root

At the MySQL prompt:

TYPE SET PASSWORD FOR 'root'@'localhost' = PASSWORD('yourpasswordhere');TYPE DELETE FROM mysql.user WHERE Host='localhost' AND User='""';TYPE FLUSH PRIVILEGES;

These commands change your root password and remove another out-of-the-box root user to improve your security.

Testing Time
Now that Apache, MySQL, and PHP are installed and configured, it is time to test your installation. Leave MySQL running. Apache should already be running, and the changes to the httpd.conf file are enough for Apache to know where to go when it receives .php files. Create a simple script to ensure that Apache and PHP are working together. Copy the following PHP test script to your WordPad or Notepad text editor:

PHP_TESTER

Save this file as phptester.php to the folder C:apache2Apache2htdocs. Open your favorite Web browser and enter http://localhost/phptester.php. If this is working properly, you should see the details of the PHP installation you just performed.

Using PHP to Access MySQL via Apache
Now, connect to the MySQL database using PHP code. Copy the following into your favorite text editor:

PHP_MySQL_ConnectionCongratulations! You are ready to build dynamic database-driven Web sites";} else {echo "

Back to the lab again*****Something went wrong

";}// closing the connection is considered good formmysql_close ($Connection);// close the php?>

And that is that. If you made it this far you now have the MySQL database, the Apache Server, and the PHP language working with each other. The Apache, PHP, and MySQL developers certainly have made high-quality products. Good luck with all your coding.

devx-admin

devx-admin

Share the Post:
Malyasian Networks

Malaysia’s Dual 5G Network Growth

On Wednesday, Malaysia’s Prime Minister Anwar Ibrahim announced the country’s plan to implement a dual 5G network strategy. This move is designed to achieve a

Advanced Drones Race

Pentagon’s Bold Race for Advanced Drones

The Pentagon has recently unveiled its ambitious strategy to acquire thousands of sophisticated drones within the next two years. This decision comes in response to

Important Updates

You Need to See the New Microsoft Updates

Microsoft has recently announced a series of new features and updates across their applications, including Outlook, Microsoft Teams, and SharePoint. These new developments are centered

Price Wars

Inside Hyundai and Kia’s Price Wars

South Korean automakers Hyundai and Kia are cutting the prices on a number of their electric vehicles (EVs) in response to growing price competition within

Solar Frenzy Surprises

Solar Subsidy in Germany Causes Frenzy

In a shocking turn of events, the German national KfW bank was forced to discontinue its home solar power subsidy program for charging electric vehicles

Malyasian Networks

Malaysia’s Dual 5G Network Growth

On Wednesday, Malaysia’s Prime Minister Anwar Ibrahim announced the country’s plan to implement a dual 5G network strategy. This move is designed to achieve a more equitable incorporation of both

Advanced Drones Race

Pentagon’s Bold Race for Advanced Drones

The Pentagon has recently unveiled its ambitious strategy to acquire thousands of sophisticated drones within the next two years. This decision comes in response to Russia’s rapid utilization of airborne

Important Updates

You Need to See the New Microsoft Updates

Microsoft has recently announced a series of new features and updates across their applications, including Outlook, Microsoft Teams, and SharePoint. These new developments are centered around improving user experience, streamlining

Price Wars

Inside Hyundai and Kia’s Price Wars

South Korean automakers Hyundai and Kia are cutting the prices on a number of their electric vehicles (EVs) in response to growing price competition within the South Korean market. Many

Solar Frenzy Surprises

Solar Subsidy in Germany Causes Frenzy

In a shocking turn of events, the German national KfW bank was forced to discontinue its home solar power subsidy program for charging electric vehicles (EVs) after just one day,

Electric Spare

Electric Cars Ditch Spare Tires for Efficiency

Ira Newlander from West Los Angeles is thinking about trading in his old Ford Explorer for a contemporary hybrid or electric vehicle. However, he has observed that the majority of

Solar Geoengineering Impacts

Unraveling Solar Geoengineering’s Hidden Impacts

As we continue to face the repercussions of climate change, scientists and experts seek innovative ways to mitigate its impacts. Solar geoengineering (SG), a technique involving the distribution of aerosols

Razer Discount

Unbelievable Razer Blade 17 Discount

On September 24, 2023, it was reported that Razer, a popular brand in the premium gaming laptop industry, is offering an exceptional deal on their Razer Blade 17 model. Typically

Innovation Ignition

New Fintech Innovation Ignites Change

The fintech sector continues to attract substantial interest, as demonstrated by a dedicated fintech stage at a recent event featuring panel discussions and informal conversations with industry professionals. The gathering,

Import Easing

Easing Import Rules for Big Tech

India has chosen to ease its proposed restrictions on imports of laptops, tablets, and other IT hardware, allowing manufacturers like Apple Inc., HP Inc., and Dell Technologies Inc. more time

Semiconductor Stock Plummet

Dramatic Downturn in Semiconductor Stocks Looms

Recent events show that the S&P Semiconductors Select Industry Index seems to be experiencing a downturn, which could result in a decline in semiconductor stocks. Known as a key indicator

Anthropic Investment

Amazon’s Bold Anthropic Investment

On Monday, Amazon announced its plan to invest up to $4 billion in the AI firm Anthropic, acquiring a minority stake in the process. This decision demonstrates Amazon’s commitment to

AI Experts Get Hired

Tech Industry Rehiring Wave: AI Experts Wanted

A few months ago, Big Tech companies were downsizing their workforce, but currently, many are considering rehiring some of these employees, especially in popular fields such as artificial intelligence. The

Lagos Migration

Middle-Class Migration: Undermining Democracy?

As the middle class in Lagos, Nigeria, increasingly migrates to private communities, a PhD scholar from a leading technology institute has been investigating the impact of this development on democratic

AI Software Development

ChatGPT is Now Making Video Games

Pietro Schirano’s foray into using ChatGPT, an AI tool for programming, has opened up new vistas in game and software development. As design lead at business finance firm Brex, Schirano

Llama Codebot

Developers! Here’s Your Chatbot

Meta Platforms has recently unveiled Code Llama, a free chatbot designed to aid developers in crafting coding scripts. This large language model (LLM), developed using Meta’s Llama 2 model, serves

Tech Layoffs

Unraveling the Tech Sector’s Historic Job Losses

Throughout 2023, the tech sector has experienced a record-breaking number of job losses, impacting tens of thousands of workers across various companies, including well-established corporations and emerging startups in areas

Chinese 5G Limitation

Germany Considers Limiting Chinese 5G Tech

A recent report has put forth the possibility that Germany’s Federal Ministry of the Interior and Community may consider limiting the use of Chinese 5G technology by local network providers

Modern Warfare

The Barak Tank is Transforming Modern Warfare

The Barak tank is a groundbreaking addition to the Israeli Defense Forces’ arsenal, significantly enhancing their combat capabilities. This AI-powered military vehicle is expected to transform the way modern warfare

AI Cheating Growth

AI Plagiarism Challenges Shake Academic Integrity

As generative AI technologies like ChatGPT become increasingly prevalent among students and raise concerns about widespread cheating, prominent universities have halted their use of AI detection software, such as Turnitin’s

US Commitment

US Approves Sustainable Battery Research

The US Department of Energy has revealed a $325 million commitment in the research of innovative battery types, designed to enable solar and wind power as continuous, 24-hour energy sources.

Netanyahu Musk AI

Netanyahu and Musk Discuss AI Future

On September 22, 2023, Israeli Prime Minister Benjamin Netanyahu met with entrepreneur Elon Musk in San Francisco prior to attending the United Nations. In a live-streamed discussion, Netanyahu lauded Musk