Apache doesn't load .php files

Posted by Haddex on Ask Ubuntu See other posts from Ask Ubuntu or by Haddex
Published on 2014-06-08T11:13:05Z Indexed on 2014/06/09 15:41 UTC
Read the original article Hit count: 301

Filed under:
|
|

First, sorry for my English and asking something that it's quite answered all over the web. I've read a lot of post about this problem but I still can't find the solution.

I'm a web developer who recently moved to Ubuntu from Windows 7. I had a website done (it's online and working) and I set up LAMP to keep working with it. I made a test.php file with: <?php phpinfo(); ?> and put it on /var/www/html directory, it shows all the information about the php and I was really happy: "Ok, it's all done, tomorrow I will work hard"

But I placed my whole web into /var/www/html , not in a folder, the index.php is in /var/www/html but guess what: doesn't load any of my .php files, the browser just keep thinking.

What I did:

  1. I rebooted Apache: /etc/init.d/apache2 restart
  2. I tried again with the test.php file and it works fine
  3. I put in /var/www/html a .html file and works fine.
  4. I looked for /etc/apache2/sites-enable/000-default.conf and it says: DocumentRoot /var/www/html

  5. I looked for /etc/apache2/mods-enabled/dir.conf and it says: DirectoryIndex index.html index.cgi index.pl index.php ...

Edit*

I think it's something related to phpmyadmin, like if I'm not able to connect with the database. But I got nothing on the screen when trying to load the page so...I'm not sure.

I can access to the url localhost/phpmyadmin and I edited the connection.php file like this:

<?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_rakstadconnection = "localhost";
$database_rakstadconnection = "rakstadclandb";
$username_rakstadconnection = "root";
$password_rakstadconnection = "admin";
$rakstadconnection = mysql_connect($hostname_rakstadconnection, $username_rakstadconnection, $password_rakstadconnection) or trigger_error(mysql_error(),E_USER_ERROR);
mysql_query("SET NAMES 'utf8'"); 
?>

The name of the database is correct, like the user and password.

http://i89.photobucket.com/albums/k220/Haddex/Capturadepantallade2014-06-09112609_zpsc45ddb72.png

http://i89.photobucket.com/albums/k220/Haddex/Capturadepantallade2014-06-09112120_zps0b9e15f7.png

*Edit2: could this be because it's a website that I brought to Linux from Windows? I used Dreamweaver.

Edit3: I changed the # to /*/, nothing. The error.log file says:

[Mon Jun 09 17:08:13.627881 2014] [:error] [pid 1517] [client 127.0.0.1:46663] PHP Warning:  require_once(/var/www/html/Connections/rakstadconnection.php): failed to open stream: Permission denied in /var/www/html/index.php on line 1
[Mon Jun 09 17:08:13.627933 2014] [:error] [pid 1517] [client 127.0.0.1:46663] PHP Fatal error:  require_once(): Failed opening required 'Connections/rakstadconnection.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/html/index.php on line 1

I'm reading error log but...should I add a linux path into a my index.php file? Don't think so.

Thanks.

© Ask Ubuntu or respective owner

Related posts about apache2

Related posts about php