Jump to content


Photo

Apache Installation help!


  • Please log in to reply
16 replies to this topic

#1 Benan

Benan
  • Members
  • PipPip
  • Member
  • 12 posts

Posted 02 October 2006 - 08:30 AM

Hi,

I installed Apache, used localhost for my domain name serrver and website, installed it etc.. then went to http://localhost in my browser and it said "it works" so I made a folder called "examples" in the htdocs directory, saved my script to it with is a basic script

<?
echo "hello";
?>

and I saved it to exmaples folder as hello.php and when i went to http://localhost/Examples/hello.php it didnt come up as hello it come up as the code, i think this might be a problem with the apache installation i made because the code is pefectly fine from what I can see.


#2 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 02 October 2006 - 08:53 AM

Use full php tags not short php tags:
<?php
echo "hello";
?>

Dont used <? use <?php instead.

If it still doesnt parse your php script then Apahe isnt configured to send any php files that are requested to the php intepreter. How have your configured Apache?

#3 Benan

Benan
  • Members
  • PipPip
  • Member
  • 12 posts

Posted 02 October 2006 - 09:09 AM

No I havn't configured it, I dont know how to can you help me? and I tried that script same prob

#4 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 02 October 2006 - 09:26 AM

Okay. Could you post the steps you did you to configure Apache here. Also what OS are you using? Windows, Linux, or Mac?

#5 Benan

Benan
  • Members
  • PipPip
  • Member
  • 12 posts

Posted 02 October 2006 - 09:34 AM

Umm, Im using Windows..

Configure? I havnt tried configuring, i installed it and trie to use it..

but the steps i did to install
pretty much click next, until i had to enter some info.. which was: domain server name: localhost, domainname:localhost, email:Benan7@hotmail.com then next installed..

#6 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 02 October 2006 - 09:56 AM

So you have just installed Apache. you havn't downloaded and installed PHP? If you havnt downloaded PHP yet, download the following package:
PHP 5.1.6 zip package

Download that package to your My Documents area.

Once downloaded, extract the contents of zip to C:\php (XP and 2000 should have an Extraction Wizard built in when you Right click and select Extract All)

Once you have extracted PHP. We'll add the PHP folder to the Windows PATH variable. To do this make sure you're logged in as the adminstrator account. Now go to Start > Control Panel > System > Advanced Tab > Evironment Variables button > Evnvironment Variables Box

Scroll to the Path variable. Left click the Path variable row and click the edit button. Now press the End key on your keyboard type in the following exactly: ;C:\php; Click Ok on the three open dialog boxes to close them

Now to configure Apache. Make sure you have downloaded and installed Apache2.0.x. If you have Apache2.2.x then you may need to download a third party dll file.

Okay find and edit the httpd.conf file. You can access this file easily by going to Start > Program files > Apache HTTP Server (your version here) > Configure Apache Server > Edit the Apache httpd.conf Configuration File

The httpd.conf file opens up for editing in Notepad/Wordpad

Now scroll down and find the following:
#LoadModule ssl_module modules/mod_ssl.so

Add the following on a new line after it:
#PHP 5
LoadModule php5_module "C:/php/php5apache2.dll"

#PHPIniDir
PHPIniDir "C:/php"

Now scroll down and find the following:
DirectoryIndex index.html index.html.var
Add (space)index.php after index.html.var so the DirectoryIndex line is like this:
DirectoryIndex index.html index.html.var index.php

Again scroll down and find the following:
AddType application/x-gzip .gz .tgz
Add the following on a new line after the line above:
#PHP5
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-phps .phps

You have successfully configured Apache to parse PHP files with the PHP intepreter! Save the httpd.conf (Ctrl+S) Close the editor. Now go to C:\php and find the php.ini-recommended file. Rename this file to php.ini

Everything is done. All you need to do now is restart your computer in order for the Path variable to com available. When you restart your computer.  You should get no errors/beeps fingers crossed. If you get no beeps/errors when Apache startup. Open up your browser and go to http://localhost/Examples/hello.php

Is the php script now being parsed?

#7 Benan

Benan
  • Members
  • PipPip
  • Member
  • 12 posts

Posted 02 October 2006 - 10:25 AM

It worked! No error so far! thankyou very much Wildteen!

#8 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 02 October 2006 - 10:27 AM

Glad its all working.

Npte if you wish to work with a mySQL database. You'll need to enable the mysql extension. Which you can learn to do in this FAQ.

If you get any problems please post back.

#9 Benan

Benan
  • Members
  • PipPip
  • Member
  • 12 posts

Posted 02 October 2006 - 11:38 AM

Do you have to do anything special to install SQL? like I did with PHP?

#10 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 02 October 2006 - 12:30 PM

Which ever version of SQL you want to use MySQL, MSSQL, PostrgreSQL etc yuou'll need to download and install them from thier develoipers web site.

Then for PHP to be able to communicate to the SQL Server you install you'll need to enable the extension in the php.ini

#11 devarmagan

devarmagan
  • Members
  • PipPip
  • Member
  • 17 posts

Posted 14 October 2006 - 10:23 AM

i got same problem before and i configure the apache according to this post and its didnt work for me then what i did is unstall the apache and reinstall it, now the problem is when i start the apache service its giving the following error  "windows could not start the apache2.2 on local computer "  how can i solve this problem and run my php script  and iam using iis also when i starting the window i stop the iis service and start the apache is that the problem iam getting??

#12 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 14 October 2006 - 10:34 AM

I see youre using apache2.2.x. PHP is not compatible with this version of Apache. See if downgrading Apache to Apache2.0.x solves this.

If you want to use Apache2.2.x you'll want to download the third party php5Apache2.dll file from apachelounge.com

#13 devarmagan

devarmagan
  • Members
  • PipPip
  • Member
  • 17 posts

Posted 14 October 2006 - 10:43 AM

ok  after downloading the apache 2.0 i have to remove the current vesion right but after unstalling the apachee 2.2 the files are remaining in the programmfiles

#14 devarmagan

devarmagan
  • Members
  • PipPip
  • Member
  • 17 posts

Posted 14 October 2006 - 10:45 AM

i have to download this vesion right  "Win32 Binary (MSI Installer): apache_2.0.59-win32-x86-no_ssl.msi [PGP] [MD5]"

#15 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 14 October 2006 - 10:54 AM

Yes download the binaries.

NOTE: Before installing Apache remove the files left over from uninstalling Apache2.2.x.

#16 devarmagan

devarmagan
  • Members
  • PipPip
  • Member
  • 17 posts

Posted 14 October 2006 - 11:18 AM

the apache is working fine now  thank you

and i have test the php like http://localhost/Examples/hello.php
and create the files in C:\Examples\hello.php  its not working

error msg  "The page cannot be found"

#17 devarmagan

devarmagan
  • Members
  • PipPip
  • Member
  • 17 posts

Posted 14 October 2006 - 01:35 PM

thank you its working fine




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users