Install Apache Php Mysql Manually Change
This tutorial exists for these OS versions
- Install Apache Php Mysql Manually Change Ip
- Install Apache Php Mysql Manually Change Location
- Ubuntu Install Apache Php Mysql
- CentOS 7.6
Need to setup WAMP server or Manually install Apache PHP MySQL Windows a detailed guide on how to install Apache 2.4.x, PHP 5.x or PHP 7.x & MySQL on Any version of windows (Windows 7-8-10). The guide also includes steps for x64 bit Apache & PHP on x64 bit Windows machine. You can take full. As soon as you make any change to any of php.ini or httpd.conf or any other configuration files you need to restart Apache to see the actual effect of the changes. So lets now restart Apache by using the Apache Monitor tool you can find in your Windows status bar. I have seen some people say it is good to install Apache/MySQL/PHP manually, rather than installing them using a package like XAMPP or WAMP. Is this really true? When I viewed phpinfo(), it was not showing that MySQL was part of the install. My first thought was to restart Apache - this did not change anything. So, then I restarted the machine, viewed phpinfo() again and it was now there. It is a good practice to install mysql and a free php forum like bb2 to test how well your php IIS and mysql is.
On this page
Install Apache Php Mysql Manually Change Ip
- 4 Installing PHP
This tutorial shows how to install an Apache web server on CentOS 7 server with PHP (mod_php) and MySQL database. The acronym LAMP is short for Linux, Apache, MySQL, PHP.
This updated tutorial shows the installation of the latest PHP versions (7.0, 7.1, 7.2 and 7.3) on CentOS 7.6.
1 Preliminary Note
In this tutorial, I use the hostname server1.example.com with the IP p 192.168.0.100. These settings might differ for you, so you have to replace them where appropriate.
I will add the EPEL repo here to install latest phpMyAdmin as follows:
To edit files on the shell, I'll install the nano editor. If you prefer vi for file editing, then skip this step.
2 Installing MySQL / MariaDB
MariaDB is a MySQL fork of the original MySQL developer Monty Widenius. MariaDB is compatible with MySQL and I've chosen to use MariaDB here instead of MySQL. Run this command to install MariaDB with yum:
Then we create the system startup links for MySQL (so that MySQL starts automatically whenever the system boots) and start the MySQL server:
Set passwords for the MySQL root account:
3 Installing Apache
CentOS 7 ships with Apache 2.4. Apache is directly available as a CentOS 7 package, therefore we can install it like this:
Here a screenshot of the installation process.
Now configure your system to start Apache at boot time..
To be able to access the webserver from outside, we have to open the HTTP (80) and HTTPS (443) ports in the firewall. The default firewall on CentOS is firewalld which can be configured with the firewalld-cmd command.
Now direct your browser to the IP address of your server, in my case http://192.168.0.100, and you should see the Apache placeholder page:
4 Installing PHP
The PHP version that ships with CentOS as default is quite old (PHP 5.4). Therefore I will show you in this chapter some options to install newer PHP versions like PHP 7.0 to 7.3 from Remi repository.
Add the Remi CentOS repository.
Install yum-utils as we need the yum-config-manager utility.
and run yum update
Now you have to chose which PHP version you want to use on the server. If you like to use PHP 5.4, then proceed to chapter 4.1. To install PHP 7.0, follow the commands in chapter 4.2, for PHP 7.1 chapter 4.3, for PHP 7.4 use chapter 4.4 and for PHP 7.3 follow chapter 4.5 instead. Follow just one of the 4.x chapters and not all of them as you can only use one PHP version at a time with Apache mod_php.
4.1 Install PHP 5.4
To install PHP 5.4, run this command:
4.2 Install PHP 7.0
We can install PHP 7.0 and the Apache PHP 7.0 module as follows:
4.3 Install PHP 7.1
If you want to use PHP 7.1 instead, use:
4.4 Install PHP 7.2
If you want to use PHP 7.2 instead, use:
4.5 Install PHP 7.3
If you want to use PHP 7.3 instead, use:
In this example and in the downloadable virtual machine, I'll use PHP 7.3.
We must restart Apache to apply the changes:
5 Testing PHP / Getting Details About Your PHP Installation
The document root of the default website is /var/www/html. We will create a small PHP file (info.php) in that directory and call it in a browser to test the PHP installation. The file will display lots of useful details about our PHP installation, such as the installed PHP version.
Now we call that file in a browser (e.g. http://192.168.0.100/info.php):
As you see, PHP 7.3 is working, and it's working through the Apache 2.0 Handler, as shown in the Server API line. If you scroll further down, you will see all modules that are already enabled in PHP. MySQL is not listed there which means we don't have MySQL support in PHP yet.
6 Getting MySQL Support In PHP
To get MySQL support in PHP, we can install the php-mysqlnd package. It's a good idea to install some other PHP modules as well as you might need them for your applications. You can search for available PHP5 modules like this:
Pick the ones you need and install them like this:
In the next step I will install some common PHP modules that are required by CMS Systems like Wordpress, Joomla, and Drupal:
Now restart Apache web server:
Now reload http://192.168.0.100/info.php in your browser and scroll down to the modules section again. You should now find lots of new modules like curl etc there.:
If you don't need the PHP info output anymore, then delete that file for security reasons.
7 phpMyAdmin installation
phpMyAdmin is a web interface through which you can manage your MySQL databases.
phpMyAdmin can now be installed as follows:
Now we configure phpMyAdmin. We change the Apache configuration so that phpMyAdmin allows connections not just from localhost (by commenting out the <RequireAny> stanza and adding the 'Require all granted' line):
Restart Apache to apply the configuration changes:
Afterwards, you can access phpMyAdmin under http://192.168.0.100/phpmyadmin/:
8 Download as a virtual machine
This setup is available as virtual machine download in ova/ovf format (compatible with VMWare and Virtualbox) for howtoforge subscribers.
Login details for the VM
- The Linux root password is: howtoforge.
- Rhe MySQL root password is: howtoforge
Please change both passwords on the first login.
- The IP address of the VM is 192.168.0.100
9 Links
Apache: http://httpd.apache.org/
PHP: http://www.php.net/
MySQL: http://www.mysql.com/
CentOS: http://www.centos.org/
phpMyAdmin: http://www.phpmyadmin.net/
How do I install Apache with PHP support and the MySQL server on Windows without using any ready-to-use packages like WAMPServer or XAMPP ?
2 Answers
First, I recommend you read the Platform Specific Notes of Apache for Windows - it explains some Windows-specific features like running as a service that you don't have on other OSes and you probably have never used before.
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 32-Bit version (win32) or the 64-Bit one (Win64) - if your OS is 64-Bit you should always try to install 64-Bit versions of software, but note that you'll need to use 64-Bit modules as well, that means if you only have a 32-Bit module then download the 32-Bit Apache.
Here's the version that I used when writing this : Apache 2.4.10 Win64. The latest version when this answer was last updated: Apache 2.4.38 Win64 (look at the edit date at the bottom of the post).
Once downloaded, just extract the Apache24
folder to the root of your hard drive, so that you have a path like C:Apache24bin
.
Open a command line window (Windows+R and type cmd
then press Enter), change directory into C:Apache24bin
and run httpd.exe
, normally it shouldn't print any errors.
If you get an error dialog stating that MSVCR110.dll
is missing on your system, you'll need to install the Visual C++ Redistributable for Visual Studio 2012 - as always, when prompted, select the appropriate bit-version : vcredist_x86.exe
for 32-Bit systems and vcredist_x64.exe
for 64-Bit ones.
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 443 by default; uncheck 'Use port 80 and 443 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.
Windows Firewall may prompt you to allow Apache to communicate on specific networks, I recommend you use the default settings : allow it on home and work networks, but not on public/untrusted networks.
Then, open a browser and browse to http://localhost
, if you see a page saying It works !
then it means your Apache installation is working.
You can now stop the currently running Apache by pressing Ctrl+C in the command prompt.
If you got a warning about not being able to determine the system's fully qualified domain name, fix it by editing C:Apache24confhttpd.conf
and editing the ServerName
variable (it should be already there in a comment, just uncomment it and change it) :
Replace <yourhostname>
with either the system's host name or localhost
.
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 :
That's it, now you have a new service in Services (Windows+R then type 'services.msc' then press Enter) named 'Apache2.4' that you can control just like any other Windows service.
Restricting Apache access to localhost
only - optional
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.conf
, search for the default directory block <Directory 'c:/Apache24/htdocs'>
.
Hp 1702 driver xp. • If you are presented with a message about SSM.CAB being missing, double-click on the specified text to copy the file to the file store, and then click Next until you reach client options. • Select Reboot client upon completion of upgrades, and then click Next. Type the name you want to use for the file share, and then click Next.
Hp recovery media creator windows 8 download. 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 403 Forbidden
.
I suggest you read the official PHP documentation about installing it on Windows systems.
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 32-Bit, x64 for 64-Bit).
The non thread-safe version is only when running as a CGI binary - more info here.
The version I used is this : PHP 5.6.2 VC11 x64 Thread Safe. The latest version when this answer was last updated: PHP 7.3.3 VC15 x64 Thread Safe (look at the edit date at the bottom of the post).
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.ini-production
or php.ini-development
(depending on what you want) to php.ini
.
Open that php.ini
file, search for extension_dir = 'ext'
and uncomment that line (remove the first ;
). This sets the default extension dir to ext
(which resolves to C:PHPext
and avoids having to prepend ext/
to all extension's paths manually like in previous versions of this post.
Now configure Apache to use that PHP, by editing C:Apache24confhttpd.conf
- after all the LoadModule
lines, add the following :
(The follow is for PHP 7 only)
(The following is for PHP 5 only)
Now try to start Apache manually by opening a command prompt in C:Apache24bin
and running httpd.exe
- if you see no errors, it means your configuration file is valid and PHP is most likely working.
You can test your PHP installation by creating a file like info.php
with <?php phpinfo();
inside and going to http://localhost/info.php
- you should see quite a bit of info about your system and your PHP installation and all its modules. If you get something else like an 'Internal server error' that means something's wrong.
You can now kill your current Apache process (Ctrl+C in the console) and start the service - the following part doesn't interact with Apache and can be done with the server already started.
Composer - optional
Composer is a tool for dependency management in PHP, like a package manager. It allows to easily install PHP packages and even entire frameworks.
Composer requires the PHP OpenSSL extension to be enabled, so let's enable it in C:PHPphp.ini
.
Use your text editor's search function to search for php_openssl.dll
, there should already be a commented line for it, just uncomment that line.
Now download Composer's Windows installer from their download page - or just use this direct link.
Follow the instructions, when prompted for the path to PHP, browse to C:PHP
and select php.exe
.
That's it, Composer is now installed system-wide and can be used from anywhere - you can try it out, just open a new command prompt (you can't use one that's already open since it needs to read the new PATH
variable set by Composer's installer) and type composer
.
You should get a nice ASCII-art logo and something like this :
PHP MySQL extensions - optional
If you want to access your MySQL database from PHP, you'll need to enable extensions that allow you to do so, like php_mysqli
or php_pdo_mysql
- I recommend enabling them both.
Open PHP's configuration file C:PHPphp.ini
in your text editor and search for php_mysqli
or php_pdo_mysql
- they should already be there, uncomment them.
Done, now you can access any MySQL database using either mysqli
or PDO
.
On the MySQL Installer download page download the web installer mysql-installer-web-community-xxxxx.msi
.
I used mysql-installer-web-community-5.6.21.1.msi. The latest version when this answer was last updated: mysql-installer-web-community-8.0.15.0.msi (look at the edit date at the bottom of the post).
The installer will automatically install the appropriate version (32-Bit or 64-Bit) depending on your system, even though MySQL's bit version doesn't have to match Apache's and PHP's one but it's still beneficial to use the 64-bit version of your system supports it to take advantage of more than 3 GB of RAM, that's quite important as database servers tend to use a lot of RAM.
Follow the steps in the installer, if you're installing this for development then the Developer default
will be your best option, it'll also install MySQL Workbench which is a native GUI client, thus avoiding you having to install slow web-based tools such as PHPMyAdmin if you aren't comfortable with using the command line client.
Once everything is installed the installer will ask your for some basic configuration values, I recommend disabling 'Open firewall port for network access' unless you want to access the database from another machine on the network.
Set the root password - if it's only for development purposes and your firewall blocks incoming connections from the network then a strong password isn't necessary.
Finally, you can disable the useless MySQL Notifier by right-clicking the tray icon, going into Actions -> Options, then untick the Run at Windows Startup
checkbox and apply. That'll save you a few MBs of RAM and avoid slowing your machine down when it's booting.
And that's it, you now have a fully functional WAMP server that runs as a service and doesn't depend on any user (accessible even if no one is logged in).
Note that I have no idea about the security of this, for development purposes I'd say this is pretty safe since your firewall should block incoming connections for both Apache (port 80 and or 443) and MySQL (port 3306).
This was tested on a Windows 7 installation, it should also work just fine on Vista, Windows 8 and possibly Windows Server 2008/2012 - feel free to comment and/or downvote if that's not the case.
Install Apache Php Mysql Manually Change Location
The instructions in the above answer work perfectly as of July 2017, however, if you wish to use PHP 7, you must add the following lines to C:Apache24confhttpd.conf
, instead of the ones in that answer (which work only for PHP 5) [Add the following after all the LoadModule
lines]:
Ensure that all paths are correct. If you don't have php7apache2_4.dll
in your PHP directory, you probably downloaded the wrong package.
protected by Mokubai♦Jul 2 '16 at 21:59
Ubuntu Install Apache Php Mysql
Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?