installing guide for a web server

12
INSTALLING GUIDE FOR A WEB SERVER Installation and configuration of Apache 2.2, PHP5 enviroinment, MySQL 5.5 and phpMyAdmin 3.4 By: Josué Gayán Báscones For: Web Application Deployment, 2 nd ASIX Josué Gayán Báscones – Web Application Deployment 1

Upload: others

Post on 12-Sep-2021

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: INSTALLING GUIDE FOR A WEB SERVER

INSTALLING GUIDE FOR A WEB SERVER

Installation and configuration of Apache 2.2, PHP5 enviroinment, MySQL 5.5 and phpMyAdmin 3.4

By: Josué Gayán BásconesFor: Web Application Deployment, 2nd ASIX

Josué Gayán Báscones – Web Application Deployment 1

Page 2: INSTALLING GUIDE FOR A WEB SERVER

INSTALLING GUIDE FOR A WEB SERVER

Content1.Introduction.............................................................................................................32.Download.................................................................................................................3

· Apache 2.2.................................................................................................................3· PHP5 Enviroinment..................................................................................................3· MySQL 5.5.................................................................................................................3· phpMyAdmin 3.2.......................................................................................................33.Installation of Apache.............................................................................................44.Installation of PHP5................................................................................................5

4.1.Installation of the application...............................................................................54.2 Configuring PHP as a module of Apache............................................................6

4.2.1 Apache Security.................................................................................................................74.2.3 Install a PHP editor............................................................................................................7

5.Installation of MySQL............................................................................................86.Installation of phpMyAdmin................................................................................107.Problems.................................................................................................................11

Josué Gayán Báscones – Web Application Deployment 2

Page 3: INSTALLING GUIDE FOR A WEB SERVER

INSTALLING GUIDE FOR A WEB SERVER

1.IntroductionThis guide refers to an installation into Windows Vista. I will explain any problem during

the creation of this guide, as a reference for common errors.Remember to download all the files for first and follow this guide only with the file versions explained here. Otherwise your web server could not work.Good installation!

2.DownloadYou should first download this pakages:

· Apache 2.2

· PHP5 Enviroinment

· MySQL 5.5

· phpMyAdmin 3.2

Josué Gayán Báscones – Web Application Deployment 3

Page 4: INSTALLING GUIDE FOR A WEB SERVER

INSTALLING GUIDE FOR A WEB SERVER

3.Installation of ApacheOpen the file. A windows will open guiding you to the installation. You have to accept the

conditions and configure the installation as this example:

Once finished the installation you'll see an icon like this: This means that Apache is correctly running. Going to http://localhost (or http://localhost:8080 in case of port 8080 installation) should appear a text written “It works!” Otherwise, control the section “Problems” in this tutorial

Josué Gayán Báscones – Web Application Deployment 4

Page 5: INSTALLING GUIDE FOR A WEB SERVER

INSTALLING GUIDE FOR A WEB SERVER

4.Installation of PHP54.1.Installation of the application

Open the installer. Click next acepting the conditions. Select the “C:/php” path to install. Otherwise your installation won't work.You will asked to select the type of module. You have to select “Apache 2.2.x Module”

Then, you have to put “C:\Program Files\Apache Software Foundation\Apache2.2\conf” as Apache configuration directory.

In the next screen, select the option “Entire feature will be installed on local drive” in all the tree

Josué Gayán Báscones – Web Application Deployment 5

Page 6: INSTALLING GUIDE FOR A WEB SERVER

INSTALLING GUIDE FOR A WEB SERVER

4.2 Configuring PHP as a module of ApacheSometimes, the PHP installation don't allow you to restart the service again. So we will

configure the file manually.

Open as Administrator “C:/Program Files/Apache Software Foundation/Apache2.2/conf/httpd.conf”

At the end of the file, delete the last paragraph that PHP installer created (if not indicated that PHP installer do it that, don't delete anything) and write:

LoadModule php5_module “c:/php/php5apache2_2.dll”AddHandler application/x-httpd-php .php

You should uncomment (delete the # symbol in the line) the option “ShortTags = On” if it’s not, otherwise the tags <?, ?> won’t be read

Go to Apache monitor and restart the service clicking “Restart”

Now, create a file into the directory “C:/Program Files/Apache Software Foundation/Apache2.2/htdocs” called “info.php” with the notepad:

<? phpinfo(); ?>Save the file and go to the URL http://localhost/info.php (or http://localhost:8080/info.php in case of port 8080 installation)

You should have a page like this:

If you don’t see this, control the “Problems” section, at the end of this document.

Josué Gayán Báscones – Web Application Deployment 6

Page 7: INSTALLING GUIDE FOR A WEB SERVER

INSTALLING GUIDE FOR A WEB SERVER

4.2.1 Apache SecuritySearch the line like this:

Options Includes Indexes FollowSymLinks MultiViewsThen remove word Indexes and save the file. The line should look like this one:

Options Includes FollowSymLinks MultiViewsThis won't allow users to navigate into Apache directory. You should also hide your Apache information. Search for this lines and uncomment it, or create it:

ServerSignature OffServerTokens Prod

This for assure that Apache is using a user:

User apacheGroup apache

Ensure that files outside the web root are not served:

<Directory /> Order Deny,Allow Deny from all Options None AllowOverride None</Directory><Directory /web> Order Allow,Deny Allow from all</Directory>

Turn off directory browsing:Options -Indexes

Turn off server side includes:Options -Includes

If your server is linux there are more security options. But this is a guide for windows.

There are a lot of security options that we don't include because depends on the use of our server.

4.2.3 Install a PHP editorWe reccomend to install a PHP editor to create your PHP documents.

You can use Dreamweaver, from Adobe. As this is not a guide for this editor, follow THIS LINK to know how to install it

Josué Gayán Báscones – Web Application Deployment 7

Page 8: INSTALLING GUIDE FOR A WEB SERVER

INSTALLING GUIDE FOR A WEB SERVER

5.Installation of MySQLThis step is simple, because consist only in the use of an installer application, but we have to

follow the instructions to have a correct installation.

Open the installer. Accept conditions and click next.

You are pleased to select an option. You have to select “Developer Default” that will install all the necessary programs and components.

The program will control if you are ready for the installation. Probably the second option is not ready, you have to click “Execute” and the program will install the necessary programs. For Windows 2008 please visit the “Problems” section, 6th problem.

Now start the installation. You will see something like this:

Josué Gayán Báscones – Web Application Deployment 8

Page 9: INSTALLING GUIDE FOR A WEB SERVER

INSTALLING GUIDE FOR A WEB SERVER

Once finished, you will be asked about the type of machine. Select a Server Machine

Then, you will configure MySQL with a password. The other options are good in that way.

Josué Gayán Báscones – Web Application Deployment 9

Page 10: INSTALLING GUIDE FOR A WEB SERVER

INSTALLING GUIDE FOR A WEB SERVER

And you will finish the installation. This is the server console. You can create a database also with Workbench, also installed.

6.Installation of phpMyAdminDownload the ZIP file and open it.

Unzip all the elements (not the folder) and leave it into a folder called “phpmyadmin” on the htdocs directory on Apache.

Now we’ll open the file into phpmyadmin/libraries/config.default.php and we will search this line:

$cfg['PmaAbsoluteUri'] = '';And we will write the absolute path of phpMyAdmin:

$cfg['PmaAbsoluteUri'] = 'http://localhost/phpmyadmin/';

Now we will search:

$cfg['blowfish_secret'] = '';And we will write whatever. This is for encrypting the files.

$cfg['blowfish_secret'] = 'to be or not to be';You now need to indicate the type of authentification for entering phpMyAdmin. Set this on “Cookie”:

$cfg['Servers'][$i]['auth_type'] = 'cookie';Copy libmysql.dll from MySQL/MySQL Server 5.5/lib to phpmyadmin/binUncoment the line in C:/php/php.ini

extension=”php_mysqli.dll”This should be enough to install phpMyAdmin.

Now, you should be able to enter http://localhost/phpmyadminJosué Gayán Báscones – Web Application Deployment 10

Page 11: INSTALLING GUIDE FOR A WEB SERVER

INSTALLING GUIDE FOR A WEB SERVER

7.Problems

1.Apache: “make_sock: could not bind to adress 0.0.0.0:80” That’s because a program in your computer is already using port 80 and Apache cannot listen to port 80. Install Apache in port 8080 (or if you know what program has a conflict, change it’s port)

2.Apache: Syntax error. The program tells you the number of line. So search for it (it’s always something that you write, otherwise you have to reinstall) and correct it.

3.PHP: If you see the code you have to control the option ShortTags, as descripted before, that should be ON. Maybe is also a problem with the httpd.conf file. Control that you have written the correct paths.

4.PHP: If you don’t see anything or get an error, maybe you hadn’t save the file info.php in the correct directory. Remember that entering http://localhost is the same that enter into the directori of Apache called htdocs.

5.MySQL: In the installation, I don’t see all those things installing. Control that you have selected the right option.

6.MySQL: The program Microsoft Visual runtime doesn’t install it for itself. Try to do it manually Josué Gayán Báscones – Web Application Deployment 11

Page 12: INSTALLING GUIDE FOR A WEB SERVER

INSTALLING GUIDE FOR A WEB SERVER

searching in google. If you can’t (I’ve encountered problems in Windows Server 2008) install the “Server” option in the first question of the installation. You will install only a thing but should be enough.

7.phpMyAdmin: You got the error: “No se encontró la extensión mysqli. Por favor revisa la configuración PHP. <a href="Documentation.html#faqmysql" target="documentation"><img class="icon" src="./themes/pmahomme/img/b_help.png" width="11" height="11" alt="Documentación" title="Documentación" /></a>”Try to do all the steps in this guide in the installation of phpMyAdmin as descripted. If your problem continues, you can install EasyPHP that will install all automatically.

Remember that, if you followed this tutorial, you should uninstall before all programs (Apache, MySql and PHP)

You can install EasyPHP clicking in the image below, or HERE. After, create an user

Josué Gayán Báscones – Web Application Deployment 12