apache (running in Ubuntu 10.10) can't access php files
Hi everyone,
I'm having a little problem with my Ubuntu 10.10. After install LAMP, apache2 can't access php files; I can see the info from the phpinfo(); but when I create a php file in /var/www and try to access the file (via web browser), the page is blank. If I change the extension to html I can acces without problems. I checked everythig but I can't understand why any web browser access a blank page. Nothing appears when I'm cheking the error.log file (apache2) Anybody have an idea??? Thanks |
Q: You wrote a PHP file with "phpinfo();", copied it somewhere, displayed it in your browser, and it worked. Correct?
Q: Could you copy/paste this verbatim into "/var/www/test.php", and point your browser to "http://localhost/test.php"? Code:
<?php Thanx in advance .. PSM |
In your httpd.conf file, locate and add index.php like this
Code:
# Code:
# Uncomment the following line to enable PHP (this may vary on your platform): Hope this helps some. |
Thanks, everybody.
First of all, the phpinfo() works properly and show all the info. I see that my httpd.conf file is empty... perhaps is not installed well or something happens... I don't know that to do now... |
Hi, W_Chevezman -
I understand that "phpinfo()" worked for you. I wanted to verify whether or not "test.php" worked. And, if it did, exactly *which directory* test.php was located in. /etc/httpd.conf determines which directories the Web server will use, and which directories can execute PHP scripts (among many other things). But first, before we got into httpd.conf, I wanted to verify that PHP itself was working. A completely SEPARATE problem that could ALSO be causing "white space" is a simple bug in your PHP script. There are LOTS of different things that could be going wrong. So I wanted to take "baby steps" toward a solution. Q: Could you please create "test.php", and try to execute it through your browser (as "http://localhost/test.php")? Copy my script verbatim. Try copying it to /var/www/htdocs/test.php (if you have that directory). Please let us know exactly what you did, and the exact results (cut/paste error message, if possible) Q: Exactly what OS and Apache are you running? Q: Please run the following commands and give us the output: Code:
uname -a |
I'm following your steps:
- I create the file test.php and put your code above. It works, I can see the PHP info page without errors. I don't have /var/www/httpd only /var/www - OS: Ubuntu Maverick 10.10 / Apache: Apache/2.2.16 (Ubuntu) - Commands results: root@pcseginf4:~# uname -a Linux pcseginf4 2.6.35-25-generic #44-Ubuntu SMP Fri Jan 21 17:40:48 UTC 2011 i686 GNU/Linux root@pcseginf4:~# ls -ld /etc/*apache* drwxr-xr-x 7 root root 4096 2011-02-03 09:25 /etc/apache2 root@pcseginf4:~# ls -ld /etc/*httpd* ls: no se puede acceder a /etc/*httpd*: No existe el fichero o el directorio root@pcseginf4:~# ps -eaf | grep -i apache root 2687 1 0 14:59 ? 00:00:00 /usr/sbin/apache2 -k start www-data 2691 2687 0 14:59 ? 00:00:00 /usr/sbin/apache2 -k start www-data 2692 2687 0 14:59 ? 00:00:00 /usr/sbin/apache2 -k start www-data 2693 2687 0 14:59 ? 00:00:00 /usr/sbin/apache2 -k start www-data 2694 2687 0 14:59 ? 00:00:00 /usr/sbin/apache2 -k start www-data 2695 2687 0 14:59 ? 00:00:00 /usr/sbin/apache2 -k start www-data 2696 2687 0 14:59 ? 00:00:00 /usr/sbin/apache2 -k start root 2716 2202 0 15:06 pts/2 00:00:00 grep --color=auto -i apache root@pcseginf4:~# ps -eaf | grep -i http root 2718 2202 0 15:06 pts/2 00:00:00 grep --color=auto -i http |
Hi, W_Chevezman -
Cool - thanx! We now know the following: 1. You're running Apache2 on Ubuntu 10.10 2. PHP and your basic Apache configuration are OK: a simple test script (/var/www/test.php) works without problem. 3. Your Apache configuration files are all located here: Quote:
Sooooo ....... Please think about what might be "different" between your "real" script (the one that won't display) and "test.php" (a minimal, "hello world" test case). If nothing comes to mind, then please cut/paste a snippet (no more than 20-50 lines) of your script. Please use code blocks (to retain script formatting). Thanx in advance .. PSM PS: Please check out this link: http://php.about.com/od/troubleshoot...e_page_php.htm PPS: You can also modify your "php.ini" file to enable full debugging: Code:
error_reporting = E_ALL & ~(E_NOTICE | E_USER_NOTICE) ; // display all errors and warnings |
Quote:
Code:
/etc/apache2/apache2.conf Code:
apache2ctl -V |
My guess is that /var/www != DocumentRoot
Try a Code:
grep -r DocumentRoot /etc/apache2/. |
Hi, Tinkster -
We've already ascertained that the config file isn't /etc/httpd.conf, and the DocumentRoot isn't /var/www/htdocs. The main problem now is "why is W_Chevezman's PHP page 'white'?" I believe the problem is with a particular PHP script, and I believe there are some good troubleshooting tips here. IMHO .. PSM |
Thanks paulsm4.
Now I know what's the problem... It was a problem in the php script (strange... when we tested it before it works)... but now we find the error. You save me. |
My pleasure :)
And thank you for marking the thread "Solved", and posting back your solution. That's definitely helpful for others who might encounter the same problem. |
Quote:
DocumentRoot in the thread before my post :} ... never mind. Cheers, Tink |
All times are GMT -5. The time now is 05:24 AM. |