Jump to content

Recommended Posts

wamp is great, but I'm in the position where I need to install PHP the "hard" way for testing purposes. So far, all I have is frustration.

My work has PHP 4.3.2 running on Apache 2 for it's web server. I'm trying to mimic that on my desktop machine but it's no use.

Apache is installed fine. I can display html files perfectly. But the php files, when ran, how the script as text instead of executing them.

Any ideas on how to get the server to run the php scripts instead of displaying their contents?

Much thanks in advance ...

Eric
In order for your PHP pages to be parsed you need to configure Apace to send these files to PHP intepreter like so:
Find and opne you httpd.conf file for editing.

Now find the following line:
[code]#LoadModule ssl_module modules/mod_ssl.so[/code]

Add the following after it:
[code]LoadModule php4_module "C:/php/sapi/php4apache2.dll"

#PHPIniDir
PHPIniDir "C:/WINDOWS/[/code]
[b]Note:[/b] I am assuming you have PHP located in a folder called PHP in the root of the hard drive. Change C:/php to the correct path of you PHP folder.

Now scroll down and find this line:
[code]DirectoryIndex index.html index.html.var[/code]
Now append index.php to the end of that line, like so:
[code]DirectoryIndex index.html index.html.var index.php[/code]

Now scroll a litttle further and find this line:
[code]AddType application/x-gzip .gz .tgz[/code]
And add the following after it:
[code]AddType application/x-httpd-php .php[/code]

Save your httpd.conf and restart Apache. Next open up notepad ands put the following in it
[code]<?php
phpinfo ();
?>[/code]
Save it as phpinfo.php (making sure that the file type pull down menu has [b]all files[/b] selected) and save it to the folder where apache accesses your files, by defualt it is something like [i]C :/program files/apache group/apache2/htdocs[/i]

Now open up your web browser and type this in:
[a href=\"http://localhost/phpinfo.php\" target=\"_blank\"]http://localhost/phpinfo.php[/a]

You should now get a page full of current PHP and server settings.
OK, I did that and am sure it's pointing to the correct dictory and file. I check and the php4apache2.dll file is in the sapi directory in my php folder at the root of the C drive.

[!--quoteo(post=386845:date=Jun 22 2006, 10:12 AM:name=wildteen88)--][div class=\'quotetop\']QUOTE(wildteen88 @ Jun 22 2006, 10:12 AM) [snapback]386845[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Add the following after it:
[code]LoadModule php4_module "C:/php/sapi/php4apache2.dll"[/quote]

I did this also
[quote]#PHPIniDir
PHPIniDir "C:/WINDOWS/[/code]
[b]Note:[/b] I am assuming you have PHP located in a folder called PHP in the root of the hard drive. Change C:/php to the correct path of you PHP folder.[/quote]

Yep, I did this.
[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]Now scroll down and find this line:
[code]DirectoryIndex index.html index.html.var[/code]
Now append index.php to the end of that line, like so:
[code]DirectoryIndex index.html index.html.var index.php[/code][/quote]

And this ...
[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]
Now scroll a litttle further and find this line:
[code]AddType application/x-gzip .gz .tgz[/code]
And add the following after it:
[code]AddType application/x-httpd-php .php[/code][/quote]

And this, and I already had a phpinfo file on hand and I know it works.
[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]
Save your httpd.conf and restart Apache. Next open up notepad ands put the following in it
[code]<?php
phpinfo ();
?>[/code]
Save it as phpinfo.php (making sure that the file type pull down menu has [b]all files[/b] selected) and save it to the folder where apache accesses your files, by defualt it is something like [i]C :/program files/apache group/apache2/htdocs[/i][/quote]

And I still get the same result.
Try adding your PHP folder to the Windows PATH variable by doing the following:

Start -> Control Panel -> double click System icon (classic view).

Now click the Advanced tab and click the Environment variables button. Now goto the Systems box and select the PATH variable from the list. Now click the Edit button. Now click the END key on your keyboard. This will make the cursor go to the end of the list of variables.

Type in the following:
[code];C:\php;[/code]
Now click Ok, OK, OK

Once you have returned to the desktop you'll need to restart your computer in order for the new Path variable become available.
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.