D
D
Denis Karimov2016-01-04 13:08:59
linux
Denis Karimov, 2016-01-04 13:08:59

Debian Jessie + Apache2 + PHP5. Why doesn't PHP work on built sites?

Hello. This is not the first time I set up LAMP on Linux, but this is the first time I have encountered such a problem.
Delivered LAMP and adjusted. Began to check. To check, Apache inserted phpinfo() into the default page. The bottom of the page has become similar to the official site, which symbolizes that. that PHP5 is wound up.
Next, I created my own folder /home/user/public_html and uploaded sites there. In order for the new folder to be visible, I added the following lines to /etc/apache2/apache2.conf :

<Directory /home/user/public_html/>
  Options Indexes FollowSymLinks
  AllowOverride None
  Require all granted
</Directory>

And eureka! The site is visible. But instead of the usual colorful interface, I am given the PHP source code of the page. What, in fact, is the problem. As I understand it, php started up, but it stalls somewhere, and I can’t find the reason.
File /etc/apache2/sites-available/site.localhost.conf :
<VirtualHost *:80>
  ServerName site.localhost

  ServerAdmin [email protected]
  DocumentRoot /home/user/public_html/site.localhost

  <Directory "/home/user/public_html/site.localhost">
    Options Indexes FollowSymLinks
     AllowOverride None
     Order deny,allow
     Allow from all
  </Directory>

  ErrorLog ${APACHE_LOG_DIR}/site-error.log
  CustomLog ${APACHE_LOG_DIR}/site-access.log combined
</VirtualHost>

This is obviously not about shortcodes, because:
1. I enabled the display of shortcodes in php.ini
2. There are no shortcodes on the index page of the site.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Denis Karimov, 2016-01-04
@trixden

Well, I asked myself, I'll answer myself. PHP is blocked in configs.
File /etc/apache2/mods-available/php5.conf . You need to comment out the lines:

<IfModule mod_userdir.c>
    <Directory /home/*/public_html>
        php_admin_flag engine Off
    </Directory>
</IfModule>

I.e:
# <IfModule mod_userdir.c>
#     <Directory /home/*/public_html>
#         php_admin_flag engine Off
#     </Directory>
# </IfModule>

N
Nikolai Turnaviotov, 2016-01-04
@foxmuldercp

And all the sites for good should be run on behalf of a specific user of the system, and they should be stored in / var / www, because on servers / home usually has a near-zero size and is rarely backed up / viewed

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question