[SOLVED] apache (running in Ubuntu 10.10) can't access php files
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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)
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541
Rep:
In your httpd.conf file, locate and add index.php like this
Code:
#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
Also, make sure you're including
Code:
# Uncomment the following line to enable PHP (this may vary on your platform):
#
Include /etc/httpd/mod_php.conf
If you added or edited the above, stop and restart httpd (and force a reload of a web page -- in Firefox you shift and click on the reload current page icon). You may also want to put your PHP files in /var/www/htdocs for them to be found.
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...
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
ls -ld /etc/*apache*
ls -ld /etc/*httpd*
ps -eaf|grep -i apache
ps -eaf|grep -i http
- 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
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:
/etc/apache2/*
4. There's something wrong with your "real" script (hence the "white").
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).
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.