homepage Welcome to WebmasterWorld Guest from 54.166.122.65
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Installing a new web server: Apache2, PHP5, MySQL4 and PHPmyAdmin.
A Tutorial
henry0

WebmasterWorld Senior Member henry0 us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 5212 posted 12:22 pm on Sep 28, 2004 (gmt 0)

The following was triggered by an earlier thread [webmasterworld.com]
I might have left one or two bugs?
Please review, comment and we hopefully will iron the last details
as is it works fine in XP, however I did not test it on any other platform.
I still did not install the last MS pack so I cannot report if the newest pack has any impact.

Installing a new web server: Apache2, PHP5, MySQL4 and PHPmyAdmin.

Download Apache 2 Windows Binary (MSI installer) [httpd.apache.org]
The zip must end with win32-x86-no_ssl.msi.

Download the PHP zip package and PECL modules [php.net] (PECL are extensions)
Although extensions should come in the PHP package found in the extracted Ext folder) The PHP zip is under "Windows Binaries".
Download the zip pack, not the installer.

Download MySQL [dev.mysql.com]
Look for: "Windows Downloads": MySQL Windows x86.

PHPmyAdmin [prdownloads.sourceforge.net]
Download PHPmyAdmin
In case you are already running any flavor of PHP and MySQL start by stopping them.

Install Apache
We use the installer so it will come easy, just go with the flow!
But for "Install to a different folder", we will use/create:
C:\Program Files\Apache Group\ this_will_be Apache2
(Created by extracting files)
First test:
Go to [localhost...] It should show the default Apache index page in English.
In case of problem: Go to Start > All Programs > Apache and try to stop and start or restart (The "Monitor Apache Servers" utility may also appear in your Windows Taskbar System Tray by the clock, etc.).
Next edit the httpd.conf file using your favorite script editor.
"C:\Program files\Apache group\Apache2\conf\httpd.conf"
Go to line 228, and change the docroot to:
DocumentRoot "C:/Program Files/Apache Group/Apache2/htdocs"
Go to line 253 and copy/paste the same dir as 228 but keep the “ <Directory “ first part
Save, and restart apache 2.

Install PHP5
Unzip the PHP zip to C:/PHP (Create the Dir PHP at C:/ root level) Next: Shut down Apache;
Crank up your favorite editor again and open the apache httpd.conf and add two lines of code:

LoadModule php5_module C:/php/php5apache2.dll
AddType application/x-httpd-php .php
<edit> Added .php extension to show how to parse .php files</edit>
I have added those two to the very bottom of the httpd.conf file.
<edit>Note: See Message 11 below on where to put the LoadModule directive!</edit>
Verify that the path in the LoadModule directive points to the dir where PHP is installed.

Next, copy/paste "php.ini-dist" to C:/Program Files/Apache Group/Apache2, and rename it to php.ini.

In order to get a working WAMP we need to copy from C:/PHP root and from C:/PHP/ext some DLLs to Apache2 root (Where you did paste your renamed copy of php.ini) those are:


fdftk.dll
fribidi.dll
gds32.dll
libeay32.dll
libmash.dll
libmysql.dll
libmysqli.dll
msql.dll
ntwdblib.dll
php5apache2.dll
php5apache.dll
php5apache_hooks.dll
php5isapi.dll
php5nsapi.dll
php5ts.dll
phpmsql.dll
phpmssql.dll
phpmysql.dll
phpmysqli.dll
ssleay32.dll
yas.dll


We need to set the PHP path for Windows:
Go to:
Control Panel > System > Advanced tab
Click on "Environment variables"
Look in the "System variables" pane
Find the "Path" entry
Double click it and add at the end of the string your PHP dir
You need to start with ";" without double quotes!
And follow by: C:\php
So it will look like: ";C:\php" Again, without double quotes!
Now restart the Apache server.
Test: Create a simple file such as php5_info.php

<? phpinfo();?>

Save it in C:/Program Files/Apache Group/Apache2/htdocs/php5_info.php
Open a browser and enter the following address [localhost...] it should display your complete PHP setting if it does not work properly you might have done something wrong with the multiple edits; check them out and give it another go.

Open up C:/Program Files/Apache Group/Apache2/php.ini. First, stop Apache
On line 276, you may change:

error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT
to
error_reporting = E_ALL

Which should be fine as a test server, remember this is a test server running under Windows as such it HAS NEVER BEEN INTENDED TO BE USED AS A PRODUCTION SERVER!
You may also change line 288:

display_startup_errors = Off
to
display_startup_errors = On

On line 351, you may possibly uncomment
";arg_separator.output = "&amp;"

On line 378...

register_long_arrays = On
to
register_long_arrays = Off

After saving restart Apache. Run again your php5_info.php script and check that your changes are showing up as intended

Next: Let’s play with Extensions, there are a bunch of extensions that you will on your own explore however setting the SQL extension is a must!

Now, open your php.ini. On line 447 you should read: user_dir ="c:\php\" and below leave extension_dir = "./" as is.

Go to line 579 and uncomment:

extension=php_msql.dll
extension=php_mysql.dll

Save and give it a try
If it does not work try:

extension_dir = "C:\PHP\ext"[fixed]

Save and try again!
As I mentioned all the DLLs should be in PHP dir or in the [fixed]PHP/ext dir.
If some are missing then unzip the PECL libraries zip file and pick your choices :)

Go to line 880 and enter

session.save_path = "C:\Program Files\Apache Group\Apache2\htdocs\tmp"

Do not forget to create the \tmp dir.

From then you should have a working PHP

Install MySQL
Easy enough you may extract it in any dir that fits you. And run the setup.exe
Enjoy the show and follow the guide. (Chose to install at Apache Group root level)
Finished ...MySQL is installed

You may or may not configure the root user (remember this is your test bed not a production server)
if you decide not to set a root user then do not use a password in your connection functions.

Create a shortcut to start MySQL: Go to Apache Group root and open the bin dir highlight mysqld.exe and create a shortcut – this will start MySQL,
do the same with MySQLshutdown and drag those shortcuts to your desktop
From then you may run a simple query test or wait and use the PHPmyAdmin as a final test

Install PHPmyAdmin

Extract the zip file to .... /apache group/apache2/htdocs
The PHPmyAdmin dir has a long name so we prefer renaming it as "pma"
Then go to pma/config.inc.php

On line 39, type:

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

Go to line 84 and enter your password (again only if you set one!)

Verify that MySQL and Apache are running and go to [localhost...]

That is it -
You have installed the finest WAMP based on the most recent distribution and PHP5!
Remember that all scripts used in your web dev test bed are loaded in the Apache2/htdocs directory.

[edited by: coopster at 6:46 pm (utc) on Oct. 30, 2004]

 

jatar_k

WebmasterWorld Administrator jatar_k us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 5212 posted 6:43 pm on Sep 28, 2004 (gmt 0)

very nice henry0

ergophobe

WebmasterWorld Administrator ergophobe us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 5212 posted 7:18 pm on Sep 28, 2004 (gmt 0)

Thanks for that Henry0!

Thanks also to coopster for some behind-the-scenes work on it.

Tom

henry0

WebmasterWorld Senior Member henry0 us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 5212 posted 7:38 pm on Sep 28, 2004 (gmt 0)

Hope it will be helpful

Thanks Jatar_k and Ergophobe

and special thanks to Coopster for helping in putting it together

You know the rest of the story...
I would not have done it without WebmasterWorld knowledge wealth :)

Henry

mikejson

10+ Year Member



 
Msg#: 5212 posted 1:15 pm on Sep 29, 2004 (gmt 0)

I've read in about 3 other tutorials that the php.ini file is supposed to be located in the windows directory. Is that true for a windows install?

henry0

WebmasterWorld Senior Member henry0 us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 5212 posted 1:52 pm on Sep 29, 2004 (gmt 0)

Mikejson


Next, copy/paste "php.ini-dist" to C:/Program Files/Apache Group/Apache2, and rename it to php.ini.

The above works on XP

Previously I did as you said but it was not working

You can copy many php.ini without creating any damages
then back up your way by renaming any of the phi.ini
as "php.ini_OLD"

Give it a try until only one php.ini will do fine
and delete the remainig " _OLD "

mikejson

10+ Year Member



 
Msg#: 5212 posted 2:16 pm on Sep 29, 2004 (gmt 0)

Either of them work just fine, but neither of those help my problem I have here.

[webmasterworld.com...]

:(

mikejson

10+ Year Member



 
Msg#: 5212 posted 1:55 pm on Oct 1, 2004 (gmt 0)

I copied what you've done, and got to the point of installing phpMyAdmin. There is settings in mySQL that phpMyAdmin doesn't like.

I'm going to fiddle with the user I'm letting phpMyAdmin use.

The error I'm getting is...

Client does not support authentication protocol requested by server; consider upgrading MySQL client

mikejson

10+ Year Member



 
Msg#: 5212 posted 2:06 pm on Oct 1, 2004 (gmt 0)

Doing a search on that found myanswer.

"UPDATE mysql.user SET password=OLD_PASSWORD('yourpass') WHERE user='youruser';
FLUSH PRIVILEGES;"

For some reason phpMyAdmin doesn't like the normal way of setting passwords for accounts...

Doing it like this works perfectly, I now have access to MySQL database through phpMyAdmin.

THANKS FOR THE TUTORIAL WORKS GREAT!

coopster

WebmasterWorld Administrator coopster us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 5212 posted 2:29 pm on Oct 1, 2004 (gmt 0)

Glad you found your answer. It is known and documented at MySQL's site. I'll throw a link down here for others that run into the same issue.

Mysql - 3.23 or 4.1: is there a benefit of going to 4.1? [webmasterworld.com]

jdMorgan

WebmasterWorld Senior Member jdmorgan us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 5212 posted 2:38 pm on Oct 1, 2004 (gmt 0)

henry0,

Bookmarked, thanks!

LoadModule php5_module C:/php/php5apache2.dll
AddType application/x-httpd-php
I have added those two to the very bottom of the httpd.conf file.
(Emphasis added)

I've seen a lot of problems due to incorrect load list order when installing php. Modules in the load list are in reverse-priority order; those that come later can override or pre-empt those listed earlier. Therefore, adding php_mod at the end of the list can have unexpected results, such as disabling mod_rewrite (and other modules) for any php files that exist (mod_rewrite will run fine if the file doesn't exist). The same error can disable mod_auth and other important modules.

php_mod should be loaded *before* any modules you wish to run before your php code is executed.

This Apache "feature" is poorly-documented, but see the note in the Apache Addmodule documentation [httpd.apache.org] for how to find the recommended ordering.

Jim

henry0

WebmasterWorld Senior Member henry0 us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 5212 posted 3:25 pm on Oct 1, 2004 (gmt 0)

Thanks Jim

Would you PM coopster and suggest editing upon your finding

henry

mikejson

10+ Year Member



 
Msg#: 5212 posted 6:50 pm on Oct 1, 2004 (gmt 0)

Thanks Jim, this could be the reason for one of my other annoying "glitches" I'm having right now :)

retroking

10+ Year Member



 
Msg#: 5212 posted 2:02 am on Oct 30, 2004 (gmt 0)
henry0 wrote
"LoadModule php5_module C:/php/php5apache2.dll
AddType application/x-httpd-php"

.php is missing at the end of the last line

AddType application/x-httpd-php .php

But otherwise this walkthrough has saved my sanity, I was going... going... and nearly went.
It's setting PHP path for windows that I was missing.

Adrian2k4

10+ Year Member



 
Msg#: 5212 posted 5:15 pm on Oct 30, 2004 (gmt 0)

the far easier way to create a server on windows is using XAMPP.

Simply download XAMPP and unzip it.
Includes Apache, Mysql, PHP, etc.

[apachefriends.org...]

satsteve

10+ Year Member



 
Msg#: 5212 posted 3:32 pm on Dec 13, 2004 (gmt 0)

I have just ried to follow your instructons.. but just as when I tried other peoples instructions I get the same problem....

I installed Apache to its default (C:\Program Files\Apache Group\Apache2)

I then tried to test it by typing [localhost...] in explorer. Nothing happend. It tried to load a page but it never gets there! Why is this. I tried to restart apache and even rebooted but No change.

I then tried the next section and did the following..

On line 228, it now reads "C:/Program Files/Apache Group/Apache2/htdocs"
On line 253 it now reads <Directory "C:/Program Files/Apache Group/Apache2/htdocs"

Is that last bit right? Can somebody help please as this is the 3rd week of me trying to set up apache and php5 and as a result I have very little hair left!
Thanks
Steve

Kysmiley

10+ Year Member



 
Msg#: 5212 posted 9:44 pm on Dec 13, 2004 (gmt 0)

can someone explain this part to me I'm trying to get this set up
Next, copy/paste "php.ini-dist" to C:/Program Files/Apache Group/Apache2, and rename it to php.ini.

does that mean to copy and paste everything from one file to another then rename it the file it was copied to. Or do i copy the hole file over to the root of apache2 and rename it to the php.ini so i would infact have the php.ini in the apache2 folder and the php.ini.dist in the PHP folder.
Sorry for a question that should make sence to most

Kysmiley

10+ Year Member



 
Msg#: 5212 posted 3:25 am on Dec 14, 2004 (gmt 0)

Ok I figured out the C/P part but in the section of the dll files to copy is this a typo I cant find it libmash.dll i found libmhash.dll but not the other one
Pat

Kysmiley

10+ Year Member



 
Msg#: 5212 posted 4:41 am on Dec 14, 2004 (gmt 0)

almost there One more question I hope someone answers this one Im getting an error message when trying to test the myphpadmin here is what i put into the config.ini.php file
On line 39, type:

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

and the error message im getting is.
Error

MySQL said:
#2003 - Can't connect to MySQL server on 'localhost' (10061)
can anyone give me any suggestions on why I followed everything else as i should and the rest seems to be ok.Just this last part
pat

feder

10+ Year Member



 
Msg#: 5212 posted 10:53 am on Dec 24, 2004 (gmt 0)

If you are developing a php site on your desktop and you don't yet have a website, what do you put in when you are installing Apache as your domain and the rest?

coopster

WebmasterWorld Administrator coopster us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 5212 posted 3:13 pm on Dec 24, 2004 (gmt 0)

Welcome to WebmasterWorld, feder.

Anything, really. But

localhost
is a good start. Once you plop that in and finish the installation, you can open up the httpd.conf file in your favorite text editor and scan it for "localhost". Then you'll see to which directives apache applied the value(s).
henry0

WebmasterWorld Senior Member henry0 us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 5212 posted 1:47 pm on Jan 15, 2005 (gmt 0)

Found two posts about adding on XP CURL
I did not try any of the options
However it is said to work fine

<<<
Posted by Mandlnet
Hi,
This is how I got CURL working on my Windows XP machine.
1. Copied libeay32.dll and ssleay32.dll to c:\windows\system32
2. Edited my PHP.ini file un-commenting extension=php_curl.dll
3. Checked what my extension directory was (extension_dir = "./")
4. Copied php_curl.dll from my c:\php\extensions directory to c:\php directory.
That was it. Tested it using $cp = curl_init(); and worked fine.
Hope this helps you.
Andrew McCarron

Or

Posted by VBBNN
Hi,
I have used another method on my WinXP:
1. Add C:\php5 (my php503 root) to the path, Environment var
2. Uncomment extension=php_curl.dll
3. Set extension_dir = "c:/php5/ext"
I have ested it by using $cp = curl_init() and phpinfo(), and it worked fine.
In Phpinfo it shows following
CURL support ¦ enabled
CURL Information ¦ libcurl/7.11.2 OpenSSL/0.9.7c zlib/1.1.4
Regards

>>>

grandpa

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 5212 posted 10:11 pm on Jan 15, 2005 (gmt 0)

Thanks henry0. Much more consise than install.txt. Too bad for me that I didn't find this thread yesterday, BEFORE I installed Apache and PHP on the local machine. Not sure, but I'll probably add MySQL at least... it just makes sense.

Gotta love it, the complete home development setup.

henry0

WebmasterWorld Senior Member henry0 us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 5212 posted 10:27 pm on Jan 15, 2005 (gmt 0)

You are welcome, glad to be of some help!

Regards

Henry

SamSwashbuckler

10+ Year Member



 
Msg#: 5212 posted 10:28 am on Jan 31, 2005 (gmt 0)

Great guide, but you've got a bunch of those .dlls named wrong :)

henry0

WebmasterWorld Senior Member henry0 us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 5212 posted 12:26 pm on Jan 31, 2005 (gmt 0)

Welcome to WebMasterWorld SamSwashbuckler,

I from the very beginning mentioned that to make it better it should be a work in process

since you found some errors it will be nice to indicate what those errors are; thus making your contribution

thanks

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved