How to solve php can not run?

468

I just installed php7.0 but could not be seen on my browser when I access via

localhost/info.php

when I have a file in /var/www/html/info.php

<?php phpinfo();?>

please help how to solve the problem ?

712

Answer

Solution:

Check your apache2 conf file. It could be in /etc/httpd/conf or /etc/apache2/conf or similiar like that.

In there there should be a path in directory tag. If it is true but still dont work add these to end of your conf file

DocumentRoot /var/www/html
<Directory /var/www/html>
    AllowOverride None
    Order Allow,Deny
    Allow from All

    <IfModule mod_rewrite.c>
        Options -MultiViews
        RewriteEngine On
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteRule ^(.*)$ app.php [QSA,L]
    </IfModule>
</Directory>

# uncomment the following lines if you install assets as symlinks
# or run into problems when compiling LESS/Sass/CoffeScript assets
# <Directory /var/www/project>
#     Options FollowSymlinks
# </Directory>

ErrorLog /var/log/httpd/custom_error.log
CustomLog /var/log/httpd/custom_access.log combined

273

Answer

Solution:

I guess you should try "localhost/html/info.php" instead of "localhost/info.php" since you need to specify the path inside the www folder correctly in the url so that the file can be found.

358

Answer

Solution:

Have you tried with ssh? try php -v in the terminal.

People are also looking for solutions to the problem: php - Joomla Login - Some Times Redirect Wrong Page.

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.