Php not working

11 posts / 0 new
Last post
#1 Tue, 08/22/2017 - 05:49
erkan1525

Php not working

I tried this process with "CentOS 7 server" and "Centos 7 Minimal".

I am creating a virtual server. But php files are not working. Instead, php files are starting to download directly.

For example: I write "<? Php phpinfo ();?>" To test.php file. When I open http://domain.com/test.php, the test.php file is not working and is downloaded to my computer.

Centosa did not have any intervention. I just installed original virtualmin.

How can I solve this problem?

Dear Masters Thank you very much already.

Tue, 08/22/2017 - 07:05
Joe
Joe's picture

I'm not seeing this behavior on my CentOS 7 test system.

What PHP execution mode are you using?

--

Check out the forum guidelines!

Tue, 08/22/2017 - 07:23
erkan1525

I have never messed with PHP execution modes. I do not know where such a setting is made. I did not set it on another setting. All I do is install CentOS7 and then install VirtualMin. So I simply created a virtual server. But php did not work.

I have installed VirtualMin too many times before. I have never encountered such a problem. I think it's a problem in VirtualMin.

Tue, 08/22/2017 - 07:32
Joe
Joe's picture

OK, I have been able to reproduce this. mod_fcgid isn't working right for some reason. php-fpm works, and the other execution modes work, but fcgid isn't attaching handlers correctly it seems. I'm looking into it.

--

Check out the forum guidelines!

Tue, 08/22/2017 - 07:37
Joe
Joe's picture

OK, here's how you fix that:

Edit /etc/httpd/conf.d/php.conf and comment out (put a # in front of it) everything that isn't commented out. Especially this line:

AddType text/html .php

Then restart Apache with:

# systemctl restart httpd

I'll fix this in the installer soon. I don't know what changed in CentOS 7 that made our installer stop working for this...

--

Check out the forum guidelines!

Tue, 08/22/2017 - 08:19 (Reply to #5)
erkan1525

I did what you said. But it did not work. Unfortunately, :(

Tue, 08/22/2017 - 07:49
erkan1525

I'm going to try this right away. If it does not work, is it possible to help me by connecting remotely?

Tue, 08/22/2017 - 08:05
erkan1525

I did what you said. But it did not work. Unfortunately, :(

Tue, 08/22/2017 - 09:52
erkan1525

I wondered, and I set up at CentOS 6. Virtualmin worked without problems. However, installing CentOS 7 with VirtualM will cause problems.

I've done a lot of testing and tried everything I wrote on the forums. But CentOS 7 and VirtualMin are not running. I think there are problems in the latest version of VirtualMin

These are the tests I did. https://i.hizliresim.com/7N5avL.png

Tue, 08/22/2017 - 11:24
Joe
Joe's picture

Stop re-installing! This is a minor, super tiny, not even significant, configuration issue. It's almost certainly one single configuration directive that's causing the problem (the one I mentioned above).

Are you sure you commented everything out in that file and restarted Apache? On my test machine, that was exactly the cause of the problem.

The only other cause I can think of is if there are php_admin_value options in /etc/httpd/conf/httpd.conf. Check that file for those, and remove them, if they appear.

Also, try switching execution types in Server Configuration->Website Options->PHP script execution mode.

In my testing, even when fcgid didn't work, php-fpm did (and that was with the misconfiguration of mod_php still being in place).

--

Check out the forum guidelines!

Tue, 08/22/2017 - 13:30
erkan1525

edit /etc/httpd/conf.d/php.conf

<FilesMatch \.php$>
    SetHandler application/x-httpd-php
</FilesMatch>

I have changed the above lines as follows

#<FilesMatch \.php$>
#    SetHandler application/x-httpd-php
#</FilesMatch>

In doing so, it worked I hope there are no other mistakes. Thank you very much to joe master.

Topic locked