Page 1 of 1

php.ini (newbie)

Posted: Sat Apr 12, 2008 3:30 pm
by mikevarela
This is probably a very tired question...

I have a macbook, new (leopard 10.5.2) with an already installed php 5.25 (I found this by hitting the terminal with php -v

I can't find the php.ini file, nor can i even find a file dedicated to php in my library, though i have ruby, perl and python there.

anyways

I've created a test.php file and saved it in my root directory. i hit my browser with http://localhost/~mike
and receive a return of the test.php file. in that file i included the script <?php phpinfo(); ?> but when i click the file the page just diplays that script, not all the info it's supposed too.

I need to find this php.ini file

help

Re: php.ini (newbie)

Posted: Sat Apr 12, 2008 3:32 pm
by John Cartwright
Create a file, and add

Code: Select all

 
<?php
 
phpinfo();
 
?>
This should contain the path to your php.ini in the "Loaded Configuration File" value, I believe. Don't forget to delete this file afterwards, so it's not publicly available.

Re: php.ini (newbie)

Posted: Sat Apr 12, 2008 3:57 pm
by mikevarela
Thanks for the reply, though as stated in the previous post, i've already created that file with that script, and when i serve it via http://localhost/~mike i get a white page showing the script, but not all the pertinent info i need.

it just shows <? phpinfo(); ?>

can you help me find the php.ini page

Re: php.ini (newbie)

Posted: Sat Apr 12, 2008 5:29 pm
by EverLearning
It shows <? phpinfo(); ?> because you're using short tags for php - <?(which are in PHP5 turned off by default), instead of <?php

Copy arborint's code, it will show filepath to your the php.ini

Re: php.ini (newbie)

Posted: Sat Apr 12, 2008 7:17 pm
by mikevarela
I must be completely retarded. I copied the code and the same result came out.

The page just repeats what i enter in the test.php page.

I've tried it like this <?php phpinfo(); ?> - and - like this <? phpinfo(); ?>

both return the same thing.

am i correct in creating a php page in textmate by just entering this code (the first one) and saving it as test.php in the sites folder on my mac?

and what are short tags?

Re: php.ini (newbie)

Posted: Sat Apr 12, 2008 7:48 pm
by John Cartwright
EverLearning wrote:Thanks for the reply, though as stated in the previous post, i've already created that file with that script, and when i serve it via http://localhost/~mike i get a white page showing the script, but not all the pertinent info i need.
Oops, sorry! I sometimes tend to skip posts.
EverLearning wrote:Copy arborint's code, it will show filepath to your the php.ini
Ahem. :wink:
mikevarela wrote:I must be completely retarded. I copied the code and the same result came out.

The page just repeats what i enter in the test.php page.

I've tried it like this <?php phpinfo(); ?> - and - like this <? phpinfo(); ?>

both return the same thing.

am i correct in creating a php page in textmate by just entering this code (the first one) and saving it as test.php in the sites folder on my mac?
It sounds like you haven't added the .php file extension to be parsed by the php interpreter. I have no idea what the Mac filesystems look like, but look around for apache's httpd.conf file, and see if you can find

Code: Select all

AddType application/x-httpd-php .php
...if not, add it.
mikevarela wrote:and what are short tags?
Short tags are a short version of the standard php tags <?php ?>... the short version being <? ?>. It is highly recommended you never use short tags since they can easily be disabled in any environment, which makes portability a issue.