Page 1 of 2
Can't get PHP to work!
Posted: Thu Aug 02, 2007 11:19 am
by james3302
I have limited knowledge of PHP, I have used someone else's code for a visitor counter and it does not work. I have tried a few of them so I know its not the code that I am using. I made a test php file that just displays a word and it does not display. My company has MS IIS running and the other PHP files work fine. They are named php4 and not php. I am trying to add php code onto the main page which is named default.htm.
The code im adding is
<? echo "Hi, I'm a PHP script!"; ?>
I am even tried using <?php instead to make sure that its not using an old version.
I have used sitemeter and it works, but this is an internal website and I cannot have anything that looks outside the site or the users will have to have internet access to see the site since we are going through a proxy.
Posted: Thu Aug 02, 2007 11:39 am
by boo
what was the name of your test php file?
Was it test.php?
Posted: Thu Aug 02, 2007 11:41 am
by thiscatis
you should make sure the page is called default.php not default.htm
(or add a line in htaccess that makes .htm files parse by the php engine)
Also, don't use shorttags (i think that's what they are called)
always put <?php
I believe
Posted: Thu Aug 02, 2007 11:42 am
by james3302
I believe that it was example.php4 and I tried example.php and I tried example.html..... none worked.
.htaccess
Posted: Thu Aug 02, 2007 11:44 am
by james3302
There already are .html files that run php, my main file is called .htm I will change it and see if that works.
now my site is under construction I have to setup the main page to look for .html instead of .htm, once i figureout how.
Re: Can't get PHP to work!
Posted: Thu Aug 02, 2007 11:46 am
by nickvd
james3302 wrote:My company has MS IIS running and the other PHP files work fine. They are named php4 and not php.
Have you talked to your IT department yet? I'm sure they can help you...
okay
Posted: Thu Aug 02, 2007 11:48 am
by james3302
I have renamed the main page to default.html and it still does not show up. I will not rename it to .php and see what happens
Posted: Thu Aug 02, 2007 11:51 am
by boo
I could be wrong but I have never seen where and file named HTM ot HTML was able to execute php code within the page?
Are there php files within the same folder as the one that you are calling that work?
If the php files that do work on your server are in a different folder then the folder you are running your script in might not be allowed to run php.
Nickvd had it right. Chat with your IT staff
Posted: Thu Aug 02, 2007 12:20 pm
by thiscatis
boo wrote:I could be wrong but I have never seen where and file named HTM ot HTML was able to execute php code within the page?
As I said, you can add a command in your htaccess file so other extensions (like .html) are parsed by the PHP version installed on your server.
Posted: Thu Aug 02, 2007 12:23 pm
by boo
thiscatis wrote:
As I said, you can add a command in your htaccess file so other extensions (like .html) are parsed by the PHP version installed on your server.
This is good to know thanks
I will check
Posted: Thu Aug 02, 2007 1:03 pm
by james3302
I will check the .htaccess file because if I name my main page default.php or default.php4 then it does not show the page. where is the .htaccess file located???
not there
Posted: Thu Aug 02, 2007 1:08 pm
by james3302
there is no .htaccess file! i searched the whole HD for one.
Posted: Thu Aug 02, 2007 1:15 pm
by thiscatis
Sorry, that was off-topic and meant for boo.
but
Posted: Thu Aug 02, 2007 1:21 pm
by james3302
But if I am trying to run php code from inside a HTML file shouldn't it be in the .htaccess file???
Re: but
Posted: Thu Aug 02, 2007 1:53 pm
by nickvd
james3302 wrote:But if I am trying to run php code from inside a HTML file shouldn't it be in the .htaccess file???
You're running IIS, so you can pretty much ignore anything about .htaccess as any help you will get on it will be based on apache experience, not IIS...
PHP on IIS has always been a PITA... Have you talked to the administrators of your IIS server? as they are the ONLY ones who can help you...