top of page
ehkidrotocross

Php Apache Install On Windows: Everything You Need to Know



These are instructions for installing on Windows 7 desktop (they may also be useful for a server install with some thought to security) using individual components rather than a one click installer. This is intended only as a testing/evaluation install via 'localhost'. Proper server configuration and security is not considered.


NOTE: This assumes that you are comfortable with administering a Windows system and can use the command line. I never use Windows and I managed, but this may not be the quickest or most efficient way to do things. Make sure your Windows installation is in good shape, you clear out all the junk and stuff making it run slower (because installing all this server software certainly isn't going to make it run faster!) and that you have installed any outstanding updates.




Php Apache Install On Windows



We will use the Git version control system for loading and updating the Moodle software. If you really don't want to do this you can just download the latest Moodle zip file and unzip it in c:\Apache24\htdocs but Git makes updates MUCH easier. We need to install Git first...


To configure Apache to install PHP as a module, use an ASCII text editor to open the Apache configuration file, "httpd.conf". If you use Apache 1.x, the file is found in "c:\Program Files\Apache Group\Apache\conf\". Apache 2.0.x users can find it in "C:\Program Files\Apache Group\Apache2\conf\" while Apache 2.2.x users can find it in "C:\Program Files\Apache Software Foundation\Apache2.2\conf\". Basically, it's in the "conf" folder of wherever you installed Apache.


If you are using Apache 1, you will have already placed your php.ini file in either the Windows directory or somewhere in your PATH, so PHP should be able to find it by itself. You can, of course, do the same if you are using Apache 2, but I find modifying the Apache configuration file a better solution than cluttering your c:\windows directory or your PATH variable.


Note that if you installed PHP elsewhere, such as "c:\Program Files\php\", you should substitute the appropriate path in place of "c:/php/" (for example, "c:/Program Files/php/"). Observe carefully that I used forward slashes ("/") instead of the usual Windows backslashes ("\") below. You will need to do the same.


Note: the "/php/" portion will be recognized as a ScriptAlias, a sort of macro which will be expanded to "c:/php/" (or "c:/Program Files/php/" if you installed PHP there) by Apache. In other words, don't put "c:/php/php.exe" or "c:/Program Files/php/php.exe" in that directive, put "/php/php-cgi.exe".


Apache Friends is a non-profit project to promote the Apache web server and is home to the XAMPP project. XAMPP is an easy to install Apache distribution containing MariaDB, PHP, and Perl. Read more


Got no idea where to start to get PHP on your server? Depending on your unique setup, there are many ways to do it. Where do you download PHP, which version, what do you need to make it work, and how do you install PHP on various OSes?


This operating system is a little different from other Linux distributions. On CentOS, the apt and apt-get commands are not the ideal ways to install the software. Instead, it uses yum, Yellowdog Updater Modified, a better package manager for RHEL-based operating systems.


An easy way to install PHP from here is to enable IIS and then use WebPI to install PHP. After launching WebPI, you can find it under the Products tab. Click Add on the version you want, then click Install.


All you need to do is uncomment a few lines of code in the Apache configuration file httpd.conf, which you can usually find at /private/etc/apache2/httpd.conf. Uncomment these two lines by removing the hashtag symbol:


PHP already comes with dozens of built-in extensions, some of which you must enable manually, and others you can start using right away. You can also install PHP extensions through sites like PECL, which hosts hundreds of third-party packages.


Now that you have a web server up and running, you need to install the database system to be able to store and manage data for your site. MySQL is a popular database management system used within PHP environments.


Your Mysql install section is copy/pasted from the ubuntu 18 article. But if you follow your instrctions you will notice there is my mysql-server package and instead is mariadb-server. In 20.04 they changed mysql to mariadb as default, this guide like many other guides around the internet need to be updated.


MAMP installs a local server environment in a matter of seconds on your Windows or macOS computer. MAMP comes free of charge, and is easily installed. MAMP will not compromise any existing Apache installation already running on your system. You can install Apache, Nginx, PHP and MySQL without starting a script or having to change any configuration files!


In some cases, we need to develop or test our application against a specific version of PHP or to install it separately. In such cases, we can download it from the official site instead of using a bundled package in the form of XAMPP or WAMP. Once installed, we can configure the latest PHP to work with the web servers including Apache and NGINX.


Go to the official download link and download the required version of PHP 8 for Windows. The distributions are provided as tar and windows binaries. While writing this tutorial, PHP 8.0.3 is the most recent one, hence we will discuss the installation steps specific to PHP 8.0.3. Click the Windows Download Link and it will open the page having Binaries and Sources packaged for Windows.


Now click the Environment Variables Button, select Path under either User variables or System Variables based on your preference, and click the Edit Button. We need to add/update the path of the installed PHP to the system Path.


Click the New/Edit Button and add/update the path to the PHP bin which is E:\tools\php\php-7.3.1 in my case. Press the OK Button 3 times to close all the windows. This sets the PHP 8 on system environment variables to access the same from the console.


You might have installed the Apache Web Server either independently or installed it as part of the bundled packages including WAMP, XAMPP, etc. In this step, we will simply configure the Apache Web Server to use the PHP installed by us in the previous steps.


Open the httpd.conf file of your Apache Web Server installation and search for the line having LoadModule php7_module or LoadModule php_module. Now comment on the line and add the path to your PHP as shown below.


You might not find the php7_module or php_module in case the Apache HTTP Server is installed without using any bundled software. If Apache 2 is installed directly as shown in How To Install Apache 2 On Windows, you just need to add the module to the httpd.conf as highlighted below.


In this tutorial, we have installed the latest PHP on Windows i.e. PHP 8 on Windows 10, and also configured the system path to use it from the console. We have also executed our first program in PHP to print Hello World on the console. In the last section, we have configured the PHP installation to work with the Apache Web Server and saw how to enable PHP extensions using the PDO extension example.


Composer is not a package manager in the same sense as Yum or Apt are. Yes,it deals with "packages" or libraries, but it manages them on a per-projectbasis, installing them in a directory (e.g. vendor) inside your project. Bydefault, it does not install anything globally. Thus, it is a dependencymanager. It does however support a "global" project for convenience via theglobal command.


Composer in its latest version requires PHP 7.2.5 to run. A long-term-supportversion (2.2.x) still offers support for PHP 5.3.2+ in case you are stuck witha legacy PHP version. A few sensitive php settings and compile flags are alsorequired, but when using the installer you will be warned about anyincompatibilities.


Composer offers a convenient installer that you can execute directly from thecommand line. Feel free to download this fileor review it on GitHubif you wish to know more about the inner workings of the installer. The sourceis plain PHP.


The installer will check a few PHP settings and then download composer.pharto your working directory. This file is the Composer binary. It is a PHAR(PHP archive), which is an archive format for PHP which can be run onthe command line, amongst other things.


You can install Composer to a specific directory by using the --install-diroption and additionally (re)name it as well using the --filename option. Whenrunning the installer when followingthe Download page instructions add thefollowing parameters:


Fret no more, distraught Windows developers. Today I'm going to show you how to install Apache and PHP on your very own Windows 98/NT machine, eliminating the need for constant FTPing when testing your scripts! The process is actually rather simple, and takes less than 15 minutes to complete.


Okay, I assume that the downloads have completed, and you're ready to continue. The Apache distribution is an executable installation format, so just go ahead and click on the icon. A few things will load, and the installation process will begin. I'll guide you through this process, step-by-step:


Now it's time to configure the freshly-installed Apache server. Start your favorite text-editor and open up the file named httpd.conf, found in the conf folder, which is located within the Apache installation directory. If you used the default installation directory in Step 4 of the process, that directory would be "C:\Program Files\Apache Group\Apache\conf\". For testing purposes, there is really only one modification you need to make:


If you see that picture, your installation was successfully completed! If by some unknown act of nature you don't see this page, then something has gone awry. I would suggest repeating the process. Check out the Apache documentation for the Windows platform. Also take a moment to read through the general Apache documentation. If you still can't get it working, email me. 2ff7e9595c


0 views0 comments

Recent Posts

See All

Comments


!
Widget Didn’t Load
Check your internet and refresh this page.
If that doesn’t work, contact us.
bottom of page