Find the answer to your Linux question:
Results 1 to 7 of 7
Hello to all, I recently installed Apache, MySQL and PHP on Centos 5, and it seems to be installed, but then I go to the folder .../www/html and I create ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Oct 2009
    Posts
    19

    PHP files open blank page on browser


    Hello to all,

    I recently installed Apache, MySQL and PHP on Centos 5, and it seems to be installed, but then I go to the folder .../www/html and I create the usual php test file to see if is installed correctly or not.

    When I open the browser and write localhost it display the apache server screen....so I assume that apache is well installed, but when I try to open the test.php file of the html folder on the browser..... localhost/test.php it display a blank page on the browser....no error, just a blank page, I read somewhere on the web that I have to change the permissions to the folder, I tried with the chmod 777, 755 to the html folder and it stills shows a blank page when I open the file, then I tried with the permission chmod 644 and then it shows an error like Apache won't have the permission to display the file.

    I can't make php to work fine in the server...what can I do?

    thanks for your attention and responses

    regards,

    Andres Camino

  2. #2
    Linux Guru coopstah13's Avatar
    Join Date
    Nov 2007
    Location
    NH, USA
    Posts
    3,149
    PHP files and their folders must all have execute permission bit set. You say you installed them, but did you configure apache to use the php plugin? You need to restart the httpd service after changing apache configuration.

  3. #3
    Just Joined!
    Join Date
    Oct 2009
    Posts
    19
    Hello coopstah13

    Thanks for your response, I've restarted the httpd service but I still have teh same problem....do you have any idea why this is happening?

    Thanks for your help

  4. $spacer_open
    $spacer_close
  5. #4
    Just Joined!
    Join Date
    Oct 2009
    Posts
    19
    I could fix the problem...but is really weird...because i had to write the change mode in the terminal for each php file like this:

    # chmod 777 /var/www/html/test.php

    and after that the file is shown in the browser when i hit refresh....is there any way to avoid to write that line for EACH php file I have in that folder and instead write a command like that for the whole folder? ... I tried
    # chmod 777 /var/www/html

    but no luck for all the files...i have to specify the file in order to watch it on the browser

    any suggestions??

    thanks for the responses

  6. #5
    Linux User
    Join Date
    Dec 2009
    Posts
    264
    You may wanna try:
    chmod 777 /var/www/html/
    chmod 777 /var/www/html/*
    or
    chmod -R 777 /var/www/html

    if I remember right ...

  7. #6
    Penguin of trust elija's Avatar
    Join Date
    Jul 2004
    Location
    Either at home or at work or down the pub
    Posts
    3,649
    It's a bad idea to give anything open to the web 777 permissions unless it is really ok for it to be written to.

    I think it is as simple as making sure the apache user (I think it is apache in centos) has read and execute permissions. Try the following

    1. Reset the permissions to 755
    2. chown apache: test.php

    As I say it might not be apache but that's who it is on RHEL
    "I used to be with it, then they changed what it was.
    Now what was it isn't it, and what is it is weird and scary to me.
    It'll happen to you too."

    Grandpa Simpson



    The Fifth Continent

  8. #7
    Just Joined!
    Join Date
    Oct 2009
    Posts
    19
    Thank you very much for your assistance..

    I tried with this line tks to zombykillah
    chmod 755 /var/www/html/* (tks elija for that)



    Is it usual to give permissions to the php files when you just install Apache and PHP??

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •