Apache works but php does not work

Asked

Viewed 3,013 times

2

Apache has been installed in a centos 7 and the service is active and php has also been installed, but whenever game in nagevador php does not run, just shows the php code.

when checking the version with the command php -v show me

PHP 7.2.7 (cli) (built: Jun 20 2018 08:21:26) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies

And the http server is active.

I’m wearing Centos 7

  • When you run a local project some error appears ?

  • No error appears. Neither the info.php works. Shows the code in the browser

  • I think that answer might help you: https://answall.com/a/178453/84579

  • If you don’t run a test and check that your php is running, create an index.php file inside your htdocs file where is apache and then put <?php echo="Testing PHP"? > if you return the message is because everything is ok

  • is it possible that it is because the php code is not in the correct directory? it is in this path: var/www/html/

  • Yes great chances of being that same.

  • and what is the right way? I have to edit in httpd.conf?

  • No, on which site you followed the apache installation tutorial on centos ?

  • No. I didn’t install, only php, I can say that has an http service running that is apache

Show 4 more comments

1 answer

-1

Just install the apache PHP module. Run this command on the terminal. sudo apt-get install libapache2-mod-php7

  • When executing the command: apachectl -M, module appears php7_module (shared), so I believe I’m already installed

  • You can check. Once it happened to me, but I was using Ubuntu I did the installation of this mod and it worked again. Run the command, if already installed the system will warn you!

  • I found another similar with the modules for 7.2. but it still doesn’t work

  • You gave Start on apache?

  • 1

    It worked, it was the penultimate line of http.conf that was commented and was not initiating. I do not know if it was after the installation of the modules. IncludeOptional conf.d/*.conf

Browser other questions tagged

You are not signed in. Login or sign up in order to post.