PDA

View Full Version : newbie php question


trevor
01-08-03, 17:32
hi

So I have php 4.2.1 installed on my slackware 8.1 box (it came default installed so I am assuming it is installed correctly).

So I am reading online tutorials and i got the source:

<html>
<body>
<title>test page</ititle>
<?php
$myvar = "hello world";
echo $myvar;
?>
</body>
</html>

and I saved it as first.php

but when I go into my browser and go to ~/php/first.php the title shows up at the top (test page) but I don't see "hello world".
I dont think my computer

So i figure something is wrong with theway php is setup on my box. The server (my computer) isn't compiling the code.

any ideas?

Thanks,

Trevor
am I missing something?

bcyde
01-08-03, 19:08
Well it could be a number of things. First thing to check is view the source of your php page when it comes up in your browser, do you see your php code in there? If so that means your web server software (Apache?) is not currently using php to parse your php files.

If this is the case, the problem is more with your apache configuration and not php. You should check in your httpd.conf (again this is assuming you're using apache) to see if php is enabled/being loaded.

Hope this helps,
-B

trevor
01-08-03, 19:39
i think it could be the problem. there is no mention of php in /etc/apache/httpd.conf

but there is however php.ini, php.ini-dist and php.ini-recommended, and a mod_php.conf in /etc/apache.

am I forgetting anything?

thanks so far

-Trevor

trevor
01-09-03, 00:23
i looked some more and found that mod_php4 is there.

I have been playing around with some more complicated scripts I found and I am trying to post data onto a mysql database. I get this error (its probably all related):

405 Method Not Allowed
The requested method POST is not allowed for the URL /register.php.

thanks again
Trevor

bcyde
01-09-03, 10:56
Hmm, sounds like you have everything setup fine. You might try checking the file permissions on your file(s). According to this URL I found http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=3960DC56.78F411C7%40atmedia.net , that 405 error is usually caused with POST when the document is not executable.

By the way, you said you are working with more complicated scripts does this mean the simple script you wrote is working?

Hope this helps.

-b

trevor
01-09-03, 16:43
thanks, i thought so

I think my databases are set up wrong. thats why I am getting the 405.
ill have to play around with it a bit

thanks again,

Trevor

English Guy
02-23-03, 21:46
The code is wrong, you have an i before titles. </ititle> should be </title>. Works fine once this is fixed...