You are not logged in.
Pages: 1
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
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
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
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
That is the problem. I looked in the error log and there is no error pertaining to this at all.
Offline
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
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
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
Pages: 1