Question

I have a CentOS 6 VPS, I installed VirtualMin and Webmin onto a fresh install. I followed the walk-through here http://76design.com/provision-webmin-centos/

I have 5 domains that I need to be served from this server. I created /home/domain.com/www for each and then went into webmin and set up Virtual Servers in the Apache Webserver. I set up three of the domains and I can navigate to them and prove it is working by having different info in the index.html within the www directory. Html works, as does javascript, but php does not, which means I don't have access to the mysql.

Please let me know what I need to do to get php to work in all virtual servers. I have wordpress on one domain, and a homebrew site 2 others, and I want laravel in the other two, so I need to get this working. I really don't want to go back to ISPConfig 3.

Thanks in advance.

Result of php -v

PHP 5.4.25 (cli) (built: Feb 18 2014 14:19:15)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
Was it helpful?

Solution

You need to enable userdir in PHP config.

Find the line in your PHP config that says

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

and modify it to add another Directory to make it look like:

<IfModule mod_userdir.c>
  <Directory /home/*/public_html>
    php_admin_value engine Off
  </Directory>
  <Directory /home/*/www>
    php_admin_value engine On
  </Directory>
</IfModule>

This should enabled PHP scripting in those directories.

You'll also need to set the permission of the /home/*/www directories to 755.

Also add PHP to the Apache handler in httpd.conf, like:

<FilesMatch "\.(htm|html|php)$">
   SetHandler application/x-httpd-php
</FilesMatch>

or

AddHandler application/x-httpd-php5 .html .htm
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top