AdamV
AdamV

Reputation: 167

Need help getting Apache to work with PHP

I am following a book for PHP development and I am having trouble getting Apache to work with PHP. So I've been trying for awhile, the first time I thought it was because I had a 64bit version of PHP and 32bit Apache so I've downloaded everything all over again making sure I have all 32 bit versions.

Book Title: PHP and MySQL Web Development Developer's Library 4th Edition

I downloaded PHP 5.5(5.5.24) x86 Thread Safe. So far I have followed the instructions

  1. Set up a php.ini file so I copied the php.ini-devlopment pasted it in the same location and renamed it php.ini
  2. Edited my php.ini file by changing the extension
    extension_dir=c:/php/ext

Also inside the php.ini file where this line extension_dir=c:/php/ext is located underneath it is

;On Windows:
;extension_dir="ext" 

Do I also have to change this to extension_dir=c:/php/ext because I am using Windows 8.1 I believe, but the book I'm using doesn't mention anything except change the extension_dir but doesn't say anything about changing all of them?

  1. Then I changed the doc_root in the php.ini file to doc_root = "c:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs"

4.Downloaded Apache. This is the one I downloaded trying to stay as close to what the book says apache_2.2.9-win32-x86-openssl-0.9.8h-r2.msi file. Did the localhost test and it works.

5.Opened the httpd.conf file and the book says to insert these lines if they are not in the file.

LoadModule php5_module c:/php/php5apache2_2.dll
PHPIniDir "c:/php/"
AddType application/x-httpd-php .php

I had php5apache2_4.dll in my php download

So I typed the following lines at the end of the httpd.conf file at the end of the file:

LoadModule php5 module c:/php/php5apache2_4.dll
PHPIniDir "c:/php/"
AddType application/x-httpd-php .php

Then the book says to restart apache but I get an error here after trying to start it again: enter image description here

Upvotes: 1

Views: 619

Answers (2)

Pedro Lobito
Pedro Lobito

Reputation: 98861

As your error says, LoadModule take only 2 arguments, i.e.:

LoadModule access_module modules/mod_access.so

Take a look at an example of httpd.conf -- win32 Apache

Upvotes: 0

I wrestled a bear once.
I wrestled a bear once.

Reputation: 23379

There are pre-configured full stack options for every operating system. As noted in the comments, if you're just learning you really shouldn't worry about trying to set things up manually. For Window's, I recommend WAMP stack, which stands for Window's Apache MySQL PHP. It will install all that stuff for you. All you have to worry about is having the c++ redistributable.

Download the C++ redistributable here: http://www.microsoft.com/en-us/download/details.aspx?id=30679

Download WAMP here: http://www.wampserver.com/en/

Plus, that book looks like it's almost a decade old. You're likely better off tossing it. A lot has changed since 2008.

Upvotes: 2

Related Questions