[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Installation help - PHP5.1.4/Apache2.2

Posted on 2006-05-19
12
Medium Priority
?
5,957 Views
Last Modified: 2013-12-13
Hi.

PHP is all new to me, so I am using the book PHP & MySQL for DUMMIES.
But some of the directions seems to be outdated, so I need help.

This is what I have done so far:
I have succesfully installed Apache2.2 and MySQL Server 5.0
I have also installed PHP5.1.4 for windows and I've run the installation-wizard.

Now it seems like I have to add lines to some files in both PHP and Apache. Other files are supposed to be copied to other directories, but everything I've tried so far isn't working.

Everything I have found is either outdated or not for windows, so I'm looking for someone to help me by giving an easy step-by-step guide to follow.

Regards,
Jesper
0
Comment
Question by:jespersahner
  • 7
  • 5
12 Comments
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 16717215
The best place to start is with the PHP documentation on installing PHP with Apache.

http://www.php.net/docs.php

0
 
LVL 40

Accepted Solution

by:
Richard Quadling earned 600 total points
ID: 16717220
If the book is talking about PHP4, then a lot has changed.
0
 

Author Comment

by:jespersahner
ID: 16717285
I have been to php.net/docs.php but I have not been able to find out exactly what to do.
There are a lot of notes about a lot of things, but none of them are really helping.
That's why I'm asking here.

I'm aware that a lot has changed since PHP5, but I still should be able to at least install and be able to test php even though the book is outdated, right?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 40

Expert Comment

by:Richard Quadling
ID: 16717430
Normally...

1 - Install Apache as documented by Apache.
2 - Install MySQL as documented by MySQL.
3 - Manual install of PHP depends upon OS and Webserver being used.

For windows, you would download the the ZIP file and not the EXE installer. The installer is really for IIS users who aren't sure how to configure it.

So, unzip PHP into C:\PHP5.

Add C:\PHP5 to your path (this saves a LOT of headaches later on and is REALLY useful!).

Copy the supplied php.ini-recommended to your windows directory and call it php.ini

I would edit this file, looking through it and make appropriate changes.

One change would be to enable the MySQL extension. There are 2, so choose the appropriate one. Read about which is which at http://www.php.net/manual/en/ref.mysqli.php (new and improved) and http://www.php.net/manual/en/ref.mysql.php (older versions of MySQL).

Then it comes to how you want to run PHP within Apache. You have 2 choices - CGI or Apache Module. Read about them at ...

Manual PHP installation - http://www.php.net/manual/en/install.windows.manual.php
PHP for Apache 2 - http://www.php.net/manual/en/install.windows.apache2.php

Once you've configured your Apache server to understand PHP, you will need to set up Apache for your website.

To test it is all working, create the following simple PHP file.

<?php phpinfo(); ?>

Now load this via your browser. If you have any problems try saving the file in C:\info.php and then try these...

1 - Is PHP running OK?

C:\php5\php -v

2 - Is PHP loading modules

C:\php5\php -m

3 - What is the config that PHP has found

C:\php5\php -i > C:\php5\php.log

The log file will be fairly big.

The PHP function phpinfo() is the same output (more or less) as the CLI parameter -i


See how you do with this and let us know what your problems are.

0
 

Author Comment

by:jespersahner
ID: 16718354
When you write:
"The installer is really for IIS users who aren't sure how to configure it."
- take out ISS from that sentence, and that would definately be me!

Since I am getting more and more confused, and this is the 4th time trying to install PHP over the last 3 days I've written down everything that I did.
Here it is:
___________________________


I downloaded and unzipped this:
http://dk.php.net/get/php-5.1.4-Win32.zip/from/a/mirror

It is now located here:
C:/PHP5/php-5.1.4-win32

I copied the file php.ini-recommended from C:/PHP5/php-5.1.4-win32 to C:/WINDOWS/php-5.1.4-win32
and renamed it php.ini so it is now C:/WINDOWS/php.ini

Then you write:
"I would edit this file, looking through it and make appropriate changes."
- What should I look for and what should I change and into what??

And:
"One change would be to enable the MySQL extension. There are 2, so choose the appropriate one. Read about which is which at http://www.php.net/manual/en/ref.mysqli.php"
- Since I installed the newest version of MySQL 2 days ago, so I'm pretty sure what link to choose.
But that is as far as I've gotten.
I've read that page 5 or 6 times and I still have absolutely no idea what to do.

...so I haven't changed or edited anything, which I'm sure is wrong, right?

I try to move on to the next part, but then I have to choose between 2 things again, and I read about them several times and still don't know what to choose.
So I just pick one...!

It says:
Installing as an Apache module
You need to insert these two lines to your Apache httpd.conf configuration file to set up the PHP module for Apache 2.0:

Example 6-6. PHP and Apache 2.0 as Module

# For PHP 5 do something like this:
LoadModule php5_module "c:/php/php5apache2.dll"
AddType application/x-httpd-php .php

# configure the path to php.ini
PHPIniDir "C:/php"

So I open C:/Programmer/Apache Software Foundation/Apache2.2/conf/httpd.conf in notepad.
I find a lot of lines starting with LoadModule, and I add
LoadModule php5_module "c:/php/php5apache2.dll"
right under the last line starting with LoadModule
I find 2 lines starting with AddType and I add
AddType application/x-httpd-php .php
under the last of them.

I have no idea where to put
PHPIniDir "C:/php"
...so I haven't written that anywhere, which I'm sure is wrong, right?

I save and close httpd.conf

That's what I've done so far.
So - What did I do wrong so far, and what will I have to do instead?
0
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 16718389
It is now located here:
C:/PHP5/php-5.1.4-win32

should be

C:\PHP5

The php-5.1.4-win32 is NOT required.

C:\php5\ext

should be a valid directory!!!!

This is also what is expected.
0
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 16718431
The idea is that PHP exist in C:\PHP5

The reason there is a version number is that on some platforms, you can have multiple simultaneous instances of PHP (different versions) and you create a symlink between the version directory and the virtual directory. You COULD use SUBST for this, but yeuch!!!!

The C:\php5\php.ini-recommended file becomes C:\windows\php.ini (or C:\winnt or whatever your %windir% is called).

0
 

Author Comment

by:jespersahner
ID: 16718716
Ok.

C:/PHP5/php-5.1.4-win32 is now C:\PHP5


0
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 16718746
Unfortunately, I'm off home for the weekend now. Won't be back until Monday.

Maybe you need a WAMP (Windows/Apache/MySQL/PHP). Google this. May be easier for you.
0
 

Author Comment

by:jespersahner
ID: 16719115
I tried that... I tried a lot of things.
I'll be happy to wait untill monday if you can help me through this.
0
 

Author Comment

by:jespersahner
ID: 16721431
I finally figured out what was wrong.

On page twenty-something on my google-search I found this link:

http://www.phpfreaks.com/forums/index.php?s=ac84052c2cec55dbf3de8f9a9d3e35df&showtopic=93282&pid=373273&st=0&#entry373273

Someone with a problem exactly the same as mine got this reply:
"PHP is not compatible with Apache 2.2.2. Therefore you are getting those errors. I would recommend you to downgrade Apache to version 2.0.58 as PHP5 is compatible with that version."

So... I downgraded to an earlier apache version and now it works.
Thanx for trying though!

Regards,
Jesper
0
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 16732210
Glad to have helped. I am surprised at the lack of support for 2.2. The PHP manual makes no mention of 2.2, only 2.0 and 1.x.

Good luck!
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses four methods for overlaying images in a container on a web page
The title says it all. Writing any type of PHP Application or API code that provides high throughput, while under a heavy load, seems to be an arcane art form (Black Magic). This article aims to provide some general guidelines for producing this typ…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses
Course of the Month19 days, 15 hours left to enroll

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question