2

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
DataCorrupt
  • 35
  • 1
  • 7

1 Answers1

2

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
Randell
  • 6,112
  • 6
  • 45
  • 70
  • I don't have those lines in my php.conf file. I can't even find php_admin_value within the php.conf in apache. /etc/httpd/conf.d/php.conf is there another location I can look for it? – DataCorrupt Mar 04 '14 at 00:13
  • You can add those lines at the end of the config file if it's not there. – Randell Mar 04 '14 at 00:16
  • You'll need to restart the web server after adding the lines. – Randell Mar 04 '14 at 00:20
  • I did service httpd stop them service httpd start. – DataCorrupt Mar 04 '14 at 00:22
  • Do a `chmod 755 /home/*/www` and see what happens. And check the logs while you're at it. – Randell Mar 04 '14 at 00:38
  • They are all already 755, I noticed they were owned by the user, so I chowned them -R to apache:apache and that didn't work. What logs should I look at? – DataCorrupt Mar 04 '14 at 00:55
  • Nothing in there but some errors for files that don't exist like phpmyadmin. and this Apache/2.2.15 (Unix) DAV/2 mod_fcgid/2.3.9 PHP/5.4.25 mod_ssl/2.2.15 OpenSSL/1.0.0-fips SVN/1.6.11 mod_perl/2.0.4 Perl/v5.10.1 conf configured -- resuming normal operations That's the last line from the restart – DataCorrupt Mar 04 '14 at 01:16
  • Can you add `error_reporting(E_ALL);` and `ini_set('display_errors', 1);` at the top of your PHP script, right after ` – Randell Mar 04 '14 at 01:22
  • I added those lines and nothing shows up. Everything within the is just not showing up. Looking at the source it is getting commented out. so – DataCorrupt Mar 04 '14 at 01:30
  • Also, make sure that the `mod_php` line is not commented out in your apache config. Not sure if it is a problem in centos, but that can bite you in OSX. – zchrykng Mar 04 '14 at 01:41
  • mod_php not found. I added the AddHandler line and it didn't work so I add it and the other one and it didn't work. I then took out the Addhandler line and it still didn't work. The lines about php that you are telling me to add are all that is in my /etc/httpd/conf/httpd.conf Am I editing the wrong files or could my php not have installed correctly? – DataCorrupt Mar 04 '14 at 01:59
  • Yeah, that was the next thing I was going to suggest - reinstall PHP. – Randell Mar 04 '14 at 02:07
  • Okay thank you so much for your help. I had to re-install php, and then reinstall php-mysql. It's working now. Thanks again. – DataCorrupt Mar 04 '14 at 02:49
  • I'm having this same problem from a fresh centos install with virtualmin/webmin - i've re-installed php like 5 times and still no go. Frustrating because I've done this successfully dozens of times.. what the heck is actually at the root of this issue? – tremor Aug 08 '14 at 23:43