Running 2 Wordpress instances on a single Apache2 - what's wrong? - php

I have a working Wordpress installation blog.mydomain.net, blog. is an A DNS record, Apache config is
<VirtualHost *:80>
ServerName blog.mydomain.net
ProxyRequests Off
ProxyPreserveHost On
RewriteEngine On
# some rewrites
DocumentRoot /var/www/wordpress
php_admin_flag engine off
AddHandler application/x-httpd-php .php .php3 .php4 .php5 .phtml
suPHP_AddHandler application/x-httpd-php
suPHP_Engine on
</VirtualHost>
The installation resides in a /var/www/wordpress directory, owned by the corresponding user, there's blog DB, etc.
Then I wanted to create a 2nd Wordpress instance on stud.mydomain.net domain.
I created a new DNS records, new folder /var/www/stud_site almost the same as /var/www/wordpress, but with a different DB name in wp-config.php, created a DB for it, and duplicated the apache config:
<VirtualHost *:80>
ServerName stud.mydomain.net
ProxyRequests Off
ProxyPreserveHost On
RewriteEngine On
DocumentRoot /var/www/stud_site
php_admin_flag engine off
AddHandler application/x-httpd-php .php .php3 .php4 .php5 .phtml
suPHP_AddHandler application/x-httpd-php
suPHP_Engine on
</VirtualHost>
But when I open http://stud.mydomain.net/wp-admin/install.php, it says Already Installed.
More to say, when I look into the page's source, I see it loaded CSS from the blog.mydomain.net host, like if Apache didn't see the 2nd Virtualhost

Well, looks like this is because of PG4WP plugin issue...

Related

"No input file specified" when using PHP with symlink

I have setup a website with ISPConfig.
In that website root I made symlink test/ -> /var/test/
/var/test/ contains two files - test.php and test.html. test.html works fine, but when I try to run test.php I get a white page with text No input file specified.
My website is auto-configured by ISPConfig running Apache 2.2.22. Here is an excerpt from config - please ask if you need to see more:
<VirtualHost *:80>
<Directory /var/www/clients/client1/web2/web>
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
<FilesMatch "\.ph(p3?|tml)$">
SetHandler None
</FilesMatch>
<Directory /var/www/clients/client1/web2/web>
AddHandler fcgid-script .php .php3 .php4 .php5
FCGIWrapper /var/www/php-fcgi-scripts/web2/.php-fcgi-starter .php
Options +ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
Solved by setting AddHandler application/x-httpd-php .php in top of .htaccess

Symlink to PHP script under a different user/home directory: "No input file specified"

I'm running virtualmin with apache2 on debian wheezy and standard PHP 5.3 and fastcgi
I have a website that calls a symlink pointing to a php file in another user's home directory
so /home/user1/public_html/adserving/ is symlinked to /home/user2/public_html/
The problem is that if I access user2's php file directly, it works, but if I access it through symlink it just spits out "No input file specified" (i guess fastcgi does not find the file's path?)
This is my php5.fcgi for user2:
#!/bin/bash
PHPRC=$PWD/../etc/php5
export PHPRC
umask 022
export PHP_FCGI_CHILDREN
PHP_FCGI_MAX_REQUESTS=99999
export PHP_FCGI_MAX_REQUESTS
SCRIPT_FILENAME=$PATH_TRANSLATED
export SCRIPT_FILENAME
exec /usr/bin/php5-cgi
This is my apache conf for that virtualserver:
<
VirtualHost XXXXXXXXXXX:80>
SuexecUserGroup "#1012" "#1012"
ServerName adserve.com
ServerAlias www.adserve.com
ServerAlias webmail.adserve.com
ServerAlias admin.adserve.com
DocumentRoot /home/adserve/public_html
ErrorLog /var/log/virtualmin/adserve.com_error_log
CustomLog /var/log/virtualmin/adserve.com_access_log combined
ScriptAlias /cgi-bin/ /home/adserve/cgi-bin/
DirectoryIndex index.html index.htm index.php index.php4 index.php5
<Directory /home/adserve/public_html>
Options -Indexes +IncludesNOEXEC +FollowSymLinks +ExecCGI
allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
AddType application/x-httpd-php .php
AddHandler fcgid-script .php
AddHandler fcgid-script .php5
FCGIWrapper /home/adserve/fcgi-bin/php5.fcgi .php
FCGIWrapper /home/adserve/fcgi-bin/php5.fcgi .php5
</Directory>
<Directory /home/adserve/cgi-bin>
allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
</Directory>
RewriteEngine on
RewriteCond %{HTTP_HOST} =webmail.adserve.com
RewriteRule ^(.*) https://adserve.com:20000/ [R]
RewriteCond %{HTTP_HOST} =admin.adserve.com
RewriteRule ^(.*) https://adserve.com:10000/ [R]
RemoveHandler .php
RemoveHandler .php5
php_admin_value engine Off
IPCCommTimeout 31
FcgidMaxRequestLen 1073741824
</VirtualHost>
(the domain adserve.com is just a placeholder)
Any advice on how to solve the fcgi path resolution problem (if that is indeed the problem) ?
Thanks
I was finally able to solve the problem by relaxing the permissions on the whole traversal path to the file I was trying to symlink to. It needs full read and execute access on the whole path to work as intended
Thanks to all that helped

phpmyadmin shows php code, but actual application code works fine

I am hosting my application on AWS server. I configured Virtualmin on it and created a new virtual server - mydomain.td.lr, and it created a user - mydomain.
I configured a virtual host for it too from the virtualmin interface.
<VirtualHost *:80>
SuexecUserGroup "#500" "#500"
ServerName mydomain.td.lr
ServerAlias www.mydomain.td.lr
ServerAlias webmail.mydomain.td.lr
DocumentRoot /var/www/public_html/mydomain
ErrorLog /var/log/virtualmin/mydomain.td.lr_error_log
CustomLog /var/log/virtualmin/mydomain.td.lr_access_log combined
ScriptAlias /cgi-bin/ /home/mydomain/cgi-bin/
ScriptAlias /awstats/ /home/mydomain/cgi-bin/
DirectoryIndex index.html index.htm index.php index.php4 index.php5
<Directory /var/www/public_html/mydomain>
Options -Indexes +IncludesNOEXEC +SymLinksIfOwnerMatch +ExecCGI
allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
Require all granted
AddType application/x-httpd-php .php
AddHandler fcgid-script .php
AddHandler fcgid-script .php5
FCGIWrapper /home/mydomain/fcgi-bin/php5.fcgi .php
FCGIWrapper /home/mydomain/fcgi-bin/php5.fcgi .php5
</Directory>
<Directory /home/mydomain/cgi-bin>
allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
Require all granted
</Directory>
RewriteEngine on
RewriteCond %{HTTP_HOST} =webmail.mydomain.td.lr
RewriteRule ^(.*) https://mydomain.td.lr:20000/ [R]
RemoveHandler .php
RemoveHandler .php5
php_admin_value engine Off
IPCCommTimeout 31
FcgidMaxRequestLen 1073741824
Alias /dav /home/mydomain/public_html
Alias /pipermail /var/lib/mailman/archives/public
<Location /dav>
DAV on
AuthType Basic
AuthName "mydomain.td.lr"
AuthUserFile /home/mydomain/etc/dav.digest.passwd
Require valid-user
ForceType text/plain
Satisfy All
RemoveHandler .php
RemoveHandler .php5
RewriteEngine off
</Location>
<Files awstats.pl>
AuthName "mydomain.td.lr statistics"
AuthType Basic
AuthUserFile /home/mydomain/.awstats-htpasswd
require valid-user
</Files>
RedirectMatch /cgi-bin/mailman/([^/\.]*)(.cgi)?(.*) https://mydomain.td.lr:10000/virtualmin-mailman/unauthenticated/$1.cgi$3
RedirectMatch /mailman/([^/\.]*)(.cgi)?(.*) https://mydomain.td.lr:10000/virtualmin-mailman/unauthenticated/$1.cgi$3
</VirtualHost>
This got appended to the httpd.conf.
When I open my application at mydomain.td.lr, the application shows up; but when I open phpmhyadmin, I see a php code there.
Also, when I see source code of phpmyadmin page, all the php code is commented out and code inside html which is php is being shown
I reinstalled phpmyadmin on the server, but still no success.
What went wrong with the configuration???
Removing these two lines does the job for me.
RemoveHandler .php
RemoveHandler .php5
Have you made modification in apache.conf which exists in /etc/phpmyadmin folder?
I think you have to also make entry in phpmyadmin apache.conf and make sure that short tag is not commented in php.ini file.
Hope this will help.
In my case it was
php_admin_value engine Off
in httpd.config Virtual host section.
Once disabled,
# php_admin_value engine Off
everything (virtual sites, phpMyAdmin) worked just fine.
Consider security issue, but mod_php could be enabled either in custom or default template > Apache_website under Virtualmin Server Template

Apache uploads (gives for download) php instead of executing it

Im using Virtualmin on top of Webmin to configure my websites on a VPS.
Everything worked fine, but now I try to create a new domain, but when I put files in its public_html it gives the php-files to download instead of executing it. How to solve this
These is my apache config (can't find anything strange):
/etc/apache2/sites-available/testbyc.--.nu.conf
SuexecUserGroup "#1009" "#1011"
ServerName testbyc.--.nu
ServerAlias www.testbyc.--.nu
ServerAlias webmail.--.--.nu
ServerAlias admin.testbyc.--.nu
DocumentRoot /home/byc/domains/testbyc.--.nu/public_html
ErrorLog /var/log/virtualmin/testbyc.--.nu_error_log
CustomLog /var/log/virtualmin/testbyc.--.nu_access_log combined
ScriptAlias /cgi-bin/ /home/byc/domains/testbyc.--.nu/cgi-bin/
ScriptAlias /awstats/ /home/byc/domains/testbyc.--.nu/cgi-bin/
DirectoryIndex index.html index.htm index.php index.php4 index.php5
<Directory /home/byc/domains/testbyc.--.nu/public_html>
Options -Indexes +IncludesNOEXEC +SymLinksIfOwnerMatch +ExecCGI
allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
AddHandler fcgid-script .php
AddHandler fcgid-script .php5
FCGIWrapper /home/byc/domains/testbyc.--.nu/fcgi-bin/php5.fcgi .php
FCGIWrapper /home/byc/domains/testbyc.--.nu/fcgi-bin/php5.fcgi .php5
</Directory>
<Directory /home/byc/domains/testbyc.--.nu/cgi-bin>
allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
</Directory>
RewriteEngine on
RewriteCond %{HTTP_HOST} =webmail.testbyc.--.nu
RewriteRule ^(.*) https://testbyc.--.nu:20000/ [R]
RewriteCond %{HTTP_HOST} =admin.testbyc.--.nu
RewriteRule ^(.*) https://testbyc.--.nu:10000/ [R]
php_admin_value engine Off
IPCCommTimeout 31
FcgidMaxRequestLen 1073741824
<Files awstats.pl>
AuthName "testbyc.--.nu statistics"
AuthType Basic
AuthUserFile /home/byc/domains/testbyc.--.nu/.awstats-htpasswd
require valid-user
</Files>
RedirectMatch /cgi-bin/mailman/([^/\.]*)(.cgi)?(.*) https://testbyc.--.nu:10000/virtualmin-mailman/unauthenticated/$1.cgi$3
RedirectMatch /mailman/([^/\.]*)(.cgi)?(.*) https://testbyc.--.nu:10000/virtualmin-mailman/unauthenticated/$1.cgi$3
Alias /pipermail /var/lib/mailman/archives/public
Try commenting out the line
php_admin_value engine Off
It's related to a larger issue that I'm still researching, but a recent update to Virtualmin added that line to some FCGI-related config files, breaking some things for some users.
As the accepted answer has said comment out
php_admin_value engine Off
We had this issue moving a site from one Virtualmin Install with PHP 5.X to a new server with PHP 7.1.
What had happened is that the default configuration for PHP7.1 had the following
<IfModule mod_userdir.c>
<Directory /home/*/public_html>
php_admin_flag engine Off
</Directory>
</IfModule>
This stopped virtualmin from running PHP scripts in users directories by adding that flag to all the local .conf files.
The php7.conf file /etc/apache2/mods-available/php7.conf also had the following
SetHandler application/x-httpd-php
This was causing all child sites to run with the process www-data and not the virtualmin user. Causing write access errors. So comment that out also.

php not interpreted ONLY in shibboleth-protected directory

I have searched everywhere for an answer to this, without success.
I have PHP installed on my OSX web server. When I access myserver.com/test.php everything works perfectly.
However, I have a subdirectory protected by mod_shib and shibd called /shibboleth/
When I put the exact same test.php file into /shibboleth/ it is served back to the browser rather than interpreted. I have messed with a million combinations of AddType and AddHandler; I've checked that I'm using
Here is the relevant part of my httpd.conf file:
<VirtualHost *:443>
SSLEngine on
SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
ServerName jeesty.homeip.net
DocumentRoot "/Library/WebServer/Safe"
DirectoryIndex index.html index.php
DefaultType text/plain
AddType application/x-httpd-php .php
AddHandler application/x-httpd-php .php
<Directory "/Library/WebServer/Safe/">
DirectoryIndex index.html index.php
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
php_admin_flag engine on
</Directory>
<Location /shibboleth/>
SetHandler shib
AuthType shibboleth
ShibRequestSetting requireSession 1
Require valid-user
php_admin_flag engine on
</Location>
</VirtualHost>
If the directory is literally /shibboleth, then it's outside the document root of /Library/WebServer, and as such won't inherit a bunch of important configuration directives declared elsewhere in httpd.conf.

Categories