I'll choose Custom and click…. Watch courses on your mobile device without an internet connection. This article was written in and remains one of our most popular posts. Starting web development is easy: you create a file called something.
Simple sites can be built using this process but, to really explore the possibilities, you need a web server. Skip to the next section if necessary… A web server is software that listens for requests and returns data usually a file. The browser might then make further requests based on the HTML content, e. CSS, JavaScript, and graphic files. Since the web server sits between your browser and the requested file, it can perform processing that is not possible by opening an HTML file directly.
For example, it can parse PHP code which connects to a database and returns data. What you need is a local web server installation. In general, I would recommend using the web server software that your web host uses. Unless you are creating ASP. It is open-source project so it does not cost anything to download or install. The following instructions describe how to install Apache on Windows. Most Linux users will have Apache pre-installed or available in the base repositories.
There is nothing wrong with using these packages, although manually installing Apache will help you learn more about the system and its configuration options.
An excellent official. This option is certainly recommended for novice users or perhaps those installing Apache for the first time.
The default installation of Skype also listens on this port and will cause conflicts. We are going to use the unofficial Windows binary from Apache Lounge.
This version has performance and stability improvements over the official Apache distribution, although I am yet to notice a significant difference. However, it is provided as a manually installable ZIP file from www. You may have this installed already, but there is no harm installing it again. Apache can be installed anywhere on your system, but you will need to change the configuration file paths accordingly….
Apache is configured with the text file confhttpd. Open it with your favourite text editor. By default, Apache return files found in its htdocs folder. I would recommend using a folder on an another drive or partition to make backups and re-installation easier. For the purposes of this example, we will create a folder called D:WebPages and change httpd. Your Apache configuration can now be tested.
As mentioned in these platform specific notes, Apache doesn't provide binaries for Windows, however they have links to several third-party sites that provide binaries, for example Apache Lounge. From that website, we can download either the Bit version win32 or the Bit one Win64 - if your OS is Bit you should always try to install Bit versions of software, but note that you'll need to use Bit modules as well, that means if you only have a Bit module then download the Bit Apache.
Here's the version that I used when writing this : Apache 2. The latest version when this answer was last updated: Apache 2. Once downloaded, just extract the Apache24 folder to the root of your hard drive, so that you have a path like C:Apache24bin. If you get an error saying that it can't bind to port 80, check if another application uses that port - also Skype is known to use ports 80 and by default; uncheck 'Use port 80 and as alternatives for incoming connections' in its advanced connection settings, restart Skype to apply the changes, and then you should be able to start Apache without issues.
A warning like Could not reliably determine the server's fully qualified domain name can be ignored for now. If you got a warning about not being able to determine the system's fully qualified domain name, fix it by editing C:Apache24confhttpd.
Finally, if you want to run the server automatically when the system starts even if nobody logs in , you'll need to run it as a service - in a new elevated as an administrator command prompt, type :.
If you're setting this up for development purposes you want to make sure that no one except you can access it, your firewall should already take care of that but let's add another layer of security to it by telling Apache to accept requests from the local machine only. Open Apache's configuration file C:Apache24confhttpd. At the end if it, there should be a line Require all granted , this means that anyone can access this server. Let's make that Require local which only allows access from the local machine.
Also, you can tell Apache to only bind to the loopback interface, that way even if both your firewall and the access control directives mentioned above fail, the server still won't be open to the whole internet.
For this, locate the Listen directive by default it's set to 80 and change it to the following :. The first line is self explanatory, the second one is the first one's IPv6 equivalent, the brackets are used in the IPv6 notation to separate the address and the port. Save the file, if you're already running the server then restart it in order to take our changes into account, and now only localhost has access, everyone else will get a Forbidden. Download the latest PHP binaries from the official PHP for Windows download page, choose the thread-safe version that matches your Apache installation's bit-version x86 for Bit, x64 for Bit.
The version I used is this : PHP 5. The latest version when this answer was last updated: PHP 7. Create an empty PHP folder at the root of your hard drive, and extract the previously downloaded archive there, you should have a path like C:PHPext , otherwise you did something wrong.
In C:PHP , rename the php. Open that php. Now try to start Apache manually by opening a command prompt in C:Apache24bin and running httpd.
0コメント