Enabling PHP for certain directories?

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
JasonTC
Forum Commoner
Posts: 92
Joined: Wed Nov 02, 2005 11:05 am
Location: Grand Rapids, MI

Enabling PHP for certain directories?

Post by JasonTC »

We have a webserver that hosts two websites: taxsale and titlecheck. In a certain directory on our server, the following paths exist:

Code: Select all

taxsale/InetPub/wwwroot
titlecheck/InetPub/wwwroot
The taxsale site is a big program with tons of PHP scripts and the titlecheck site is just static HTML. I designed a new titlecheck site on my local server that uses PHP rather than just HTML.

When I uploaded this new site, I found to my dismay that this directory will apparently not run PHP scripts. When I try to view index.php, I get a "You are not authorized to view this page" error.

One thing I noticed is that all the scripts in the titlecheck/InetPub/wwwroot folder have an "A" in the "Attributes" column, where the scripts in the taxwsale/InetPub/wwwroot folder have nothing in the "Attributes" column.

Does anybody have an idea of what's going on? Even if someone could just tell me what the "Attributes" property means, that might be helpful.

Thanks,
Jason
User avatar
Zoxive
Forum Regular
Posts: 974
Joined: Fri Apr 01, 2005 4:37 pm
Location: Bay City, Michigan

Post by Zoxive »

Check under one of the options for that folder, and make sure index.php is set be be a default home page. Right now its like default.html, index.html, and some others, but index.php proably isn't one of them : p

-NSF
JasonTC
Forum Commoner
Posts: 92
Joined: Wed Nov 02, 2005 11:05 am
Location: Grand Rapids, MI

Post by JasonTC »

Any idea how to get to those settings? I'm very new to server administration.

Also, it doesn't seem like that should even matter for my purposes - I don't care at this time whether or not index.php is the default page for my site. Shouldn't I be able to view any php file by simply typing in the name? That's what I can do on any other server I've worked with.

Thank you,
Jason
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Post by Jenk »

If you are using apache, it is possible to use the .htaccess file as a "mini" httpd.conf, by means of specifying the AddType for PHP, have a read here:

http://httpd.apache.org/docs/1.3/howto/htaccess.html

P.S. this should be in the Apache, ISS and webservers forum, not PHP Code :)
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Post by josh »

find httpd.conf (locate httpd.conf in bash), open it up and look for a bunch of lines that begin with "LoadModule"

Add

LoadModule php5_module libexec/libphp5.so

or


LoadModule php4_module libexec/libphp4.so

Then in httpd.conf:

Code: Select all

<Directory /var/www>
      
      # Add this line
      AllowOverride All

</Directory>
where /var/www is your documentRoot


then in .htaccess of any directory you want to enable php:

Code: Select all

AddType application/x-httpd-php .php
AGISB
Forum Contributor
Posts: 422
Joined: Fri Jul 09, 2004 1:23 am

Post by AGISB »

I am not entirely sure here but it might be that your php script need execute permission. HTML just needs read permission to work.
JasonTC
Forum Commoner
Posts: 92
Joined: Wed Nov 02, 2005 11:05 am
Location: Grand Rapids, MI

Post by JasonTC »

It's been brought to my attention that this is not the appropriate place for this thread, but since there's already been some ideas thrown around here, I don't want to start over. Hope nobody minds.
I am not entirely sure here but it might be that your php script need execute permission. HTML just needs read permission to work.
I checked the permissions; they all have execute permission.
find httpd.conf (locate httpd.conf in bash), open it up and look for a bunch of lines that begin with "LoadModule"
I searched the server's hard drives for "httpd.conf" - no results.
If you are using apache, it is possible to use the .htaccess file as a "mini" httpd.conf, by means of specifying the AddType for PHP, have a read here:
I visited that link and found it a little confusing. I my server's hard drives for anything containing "htaccess" - it found four files names ".htaccess". Two were in the mail server directory and two were in a folder called phpBB2/cache. Don't know what to make of this.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

JasonTC wrote:
find httpd.conf (locate httpd.conf in bash), open it up and look for a bunch of lines that begin with "LoadModule"
I searched the server's hard drives for "httpd.conf" - no results.
That's because it looks like you're not using Apache, you're using IIS.

How did you install PHP? Does it run OK from any other directories within the web root?

EDIT | Also, please post the path on the hard disk to the web root: e.g. C:\www\inetpub\ and also the path you're typing in the URL bar of your browser to access the files ;)
JasonTC
Forum Commoner
Posts: 92
Joined: Wed Nov 02, 2005 11:05 am
Location: Grand Rapids, MI

Post by JasonTC »

Yeah, I forgot to mention I'm using IIS, not Apache. Sorry.
I'm not the one who installed PHP on this server - the people who did are conveniently long gone and unavailable for questions.

These are the paths to the two webroots with which I'm concerned:
C:\Program Files\Ensim\Sitedata\taxsale\InetPub\wwwroot (PHP scripts work)
C:\Program Files\Ensim\Sitedata\tcadmin\InetPub\wwwroot (PHP scripts don't work: "Not authorized..." error message)
...and also the path you're typing in the URL bar of your browser to access the files
I actually don't know what this would be. Since our web server is around 1,000 miles away from us, it's faster to work from a local server and then upload to the web server. I've never gone to "http://localhost" from our webserver or anything like that, if that's what you're asking for.

Thanks,
Jason
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

JasonTC wrote:I actually don't know what this would be. Since our web server is around 1,000 miles away from us, it's faster to work from a local server and then upload to the web server. I've never gone to "http://localhost" from our webserver or anything like that, if that's what you're asking for.
I was but the paths you gave are enough anyway thanks :)

If static HTML files load (via the web server) from that directory I can't see any reason why PHP would not run on that directory alone. If you have access to install stuff on the server I'd probably have done a reinstall by this point ;)

Reinstalling PHP/IIS on windows is trivial. IIS is done by Control Panel->Add/Remove Programs->Windows Components..... and PHP is a simple binary installer that steps you through it.

I tend to find that you'll get a lot more help and support with Apache though.... It's easier to explain how to configure it since it's text-file based configuration rather than GUI.
JasonTC
Forum Commoner
Posts: 92
Joined: Wed Nov 02, 2005 11:05 am
Location: Grand Rapids, MI

Post by JasonTC »

What's the risk of reinstalling PHP (even if it's a degligible one)? I'm new here and I don't want my first "accomplishment" to be screwing up our only server.

Thanks for the help,
Jason
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

not much of a risk, just read the manual during installation and keep a backup copy of your php.ini file for reference.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
Post Reply