You are not logged in.

#1 2007-12-29 21:22:45

cu3edweb
Member
From: USA
Registered: 2007-10-07
Posts: 291

PHP questions

I am trying to learn php. My problem is I have installed apache and php on my laptop so I can test stuff that I do. So I have a practice folder in my html folder. If i put index.php in the practice folder and in a web browser go to http://localhost/practice/ it shows what I am working on. If I save the same file as foo.php and go to http://localhost/practice/foo.php it shows a blank plain white screen with nothing.

Am I doing something wrong? Anybody know why?

Thanks

Offline

#2 2007-12-29 21:28:45

DeveloperDave
Member
Registered: 2007-12-25
Posts: 9

Re: PHP questions

You followed the necessary portions of the LAMP installation guide in the wiki, I take it?

Are you certain you're manually navigating to http://localhost/practice/foo.php, and not just to http://localhost/practice/ ? The latter address would automatically display an index.php document within the web root, but foo.php isn't one of the filename 'guesses' it makes by default...

- Dave


- Dave

Offline

#3 2007-12-29 21:32:00

cu3edweb
Member
From: USA
Registered: 2007-10-07
Posts: 291

Re: PHP questions

Yes I am positive I am manually navigating to http://localhost/practice/foo.php and I did follow the lamp setup from the link provided.

Offline

#4 2007-12-29 21:59:07

DeveloperDave
Member
Registered: 2007-12-25
Posts: 9

Re: PHP questions

Have a look in your apache access/error logs and post their content please. I believe they are located in /usr/local/apache/logs/ .

- Dave


- Dave

Offline

#5 2007-12-29 22:11:01

cu3edweb
Member
From: USA
Registered: 2007-10-07
Posts: 291

Re: PHP questions

That is the problem. I looked in the error log and there is no error pertaining to this at all.

Offline

#6 2007-12-29 22:14:13

DeveloperDave
Member
Registered: 2007-12-25
Posts: 9

Re: PHP questions

What's the content of your PHP file? Also, check that in /etc/php.ini 'display_errors' is set to 'on', not 'off'.

Last edited by DeveloperDave (2007-12-29 22:15:49)


- Dave

Offline

#7 2007-12-30 16:03:11

cu3edweb
Member
From: USA
Registered: 2007-10-07
Posts: 291

Re: PHP questions

I figured out it was a permission problem. If I save foo.php in that folder it is only read & write by me read by users and none by others? Now when ever I save any file in there I have to change the permissions. How can I set it so anything I save in that folder uses the right permissions?

Offline

#8 2007-12-30 16:25:53

DeveloperDave
Member
Registered: 2007-12-25
Posts: 9

Re: PHP questions

cu3edweb wrote:

I figured out it was a permission problem. If I save foo.php in that folder it is only read & write by me read by users and none by others? Now when ever I save any file in there I have to change the permissions. How can I set it so anything I save in that folder uses the right permissions?

There are two commands that are always useful to remember: 'chown' and 'chmod'. 'chown' allows you to change the owner and group of a file, while 'chmod' allows you to change permissions for the owner, group and others indpendent from one-another.

Many desktop environments (DEs) will facilitate the change through the file manager they provide. If you are using Nautilus, Thunar, or some similar file manager, you should be able to right click -> get info/properties and change permissions from there.

If you wish to effect this change via the terminal, you should read the man pages for those commands, then use

chmod 600 my_php_file.php

To change the permissions of your PHP file(s). To change all the php files in a directory to the correct permissions, use

chmod 600 '\ls | grep php'

For a better long-term solution, google '.htaccess tutorial' and learn how to use chmod in a .htaccess file to automatically correct permissions on PHP files under your document root.


- Dave

Offline

Board footer

Powered by FluxBB