vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Forum and Server Management (https://vborg.vbsupport.ru/forumdisplay.php?f=232)
-   -   Stop PHP executing on a (or multiple) sub-domain(s) (https://vborg.vbsupport.ru/showthread.php?t=226841)

James Birkett 10-26-2009 11:01 PM

Stop PHP executing on a (or multiple) sub-domain(s)
 
Server: Fedora 7 i686 virtuozzo
cPanel 11.24.5-R38506
WHM 11.24.2 - X 3.9

I'm trying to stop PHP from parsing (executing) on sub domains so that I can offer my VIP members a free sub-domain for their portfolio's (I run a GFX-related forum).

Is this possible?

I don't want it globally disabled for obvious reasons - just for specified sub-domains.

Thanks in advance.

P.S: It's my own VPS.

RenatoMN 10-27-2009 08:19 PM

What you mean by "PHP executing"?

vBulletin don't allow PHP code to be executed in the frontend. The [PHP] bbcode is there just for code highlighting.

James Birkett 10-27-2009 10:39 PM

This isn't forum-related it's server-related. I posted it here because it's "Forum and Server Management" and this comes under server management.

I want to stop PHP from parsing or executing on sub-forums on my server - not my forum. I know I can globally stop PHP - but I just want to stop it on certain sub-forums.

I am aware of the BBCodes ;)

Woops.. title said sub-forums. Dammit. I've done that so many times on Google searches ;(.

Sorry guys.

TurkeySub 10-28-2009 03:01 PM

Quote:

Originally Posted by James Birkett (Post 1907181)
This isn't forum-related it's server-related. I posted it here because it's "Forum and Server Management" and this comes under server management.

I want to stop PHP from parsing or executing on sub-forums on my server - not my forum. I know I can globally stop PHP - but I just want to stop it on certain sub-forums.

I am aware of the BBCodes ;)

Woops.. title said sub-forums. Dammit. I've done that so many times on Google searches ;(.

Sorry guys.

Are you asking if you setup new accounts as sub-domains off your primary domain if you can manage whether or not they have access to PHP?

Are you using a control panel or manual editing apache?

James Birkett 10-28-2009 04:32 PM

I have a VIP feature which is the ability to have a sub-domain set up for their own personal use - as I explained in the first post.

Of course, I don't want that to be abused in any way so I would like to disable PHP on that sub-domain so that they cannot run PHP scripts on their sub-domain.

I am using cPanel and WHM - that is all I am using to run my server. I am hoping there's a configuration option.

snakes1100 10-28-2009 05:19 PM

You try this in a php.ini in their public folder?
engine = Off

Then chown to root & chmod the php.ini to 000 so they cant see or access it.

James Birkett 10-28-2009 05:25 PM

I'll try it.

I'm not familiar with chowning, got any idea what command i'd use?

Also, would this be in effect only for that sub-forum or throughout everything?

EDIT: I created a file named "php.ini" and put in it "engine = Off" and it hasn't worked.

snakes1100 10-28-2009 08:09 PM

chown -h

chown root:root php.ini

It should only be in that users sub-domain folder
xxxx.xxxxx.xxx/username

When apache/php was compiled, was rights given to allow php.ini overwirte by users?

James Birkett 10-28-2009 08:54 PM

The sub-domain is:
../public_html/{sub-domain} which is where I placed the php.ini.

I'm not sure if the rights were given - the installation of everything was there before I bought the server. Any way I can check?

snakes1100 10-28-2009 11:49 PM

try a simple php flag like memory_limit and view a phpinfo file from that location and see if it raises the limit, you should have the two columns in phpinfo and the memory limit for the local side should rise, if not you will need to recompile apache/php.

James Birkett 10-29-2009 01:08 PM

I put memory_limit = 50M into the php.ini and it didn't affect the phpinfo file.

I suppose i'll have to recompile?

bobster65 10-29-2009 01:32 PM

Quote:

Originally Posted by James Birkett (Post 1907784)
I put memory_limit = 50M into the php.ini and it didn't affect the phpinfo file.

I suppose i'll have to recompile?

no, you should just have to restart apache for it to take effect..

snakes1100 10-29-2009 01:40 PM

Bob, there is NO need to restart, if local override is allowed, it's on the fly.

bobster65 10-29-2009 01:44 PM

Quote:

Originally Posted by snakes1100 (Post 1907791)
Bob, there is NO need to restart, if local override is allowed, it's on the fly.

ah, gotcha.. makes perfect sense :)

snakes1100 10-29-2009 05:11 PM

Yea, you wouldn't want to restart apache 300 times a day because ppl keep changing variables.

Angel-Wings 10-30-2009 09:29 AM

Depending on how you use PHP - if it's the Apache module a simple:

Quote:

<VirtualHost ....>
php_flag engine Off
php_admin_value engine Off
...
</VirtualHost>
Should do it. If you run it as CGI / FastCGI just remove the Handler for the specific sub-domains or directories.
Little bit :confused: first allowing this handler to be executed - if it's CGI - just to run PHP in order the PHP interpreter gets it isn't allowed to do anything - so better remove it completely that there're no CGI / FastCGI calls made anyways.

James Birkett 10-30-2009 01:26 PM

Where do I put that Angel?
In php.ini or in htaccess? :confused:

Angel-Wings 10-30-2009 01:29 PM

Webserver Configuration if you're using Apache. For Nginx / Lighty or other server just look how PHP is called - usually via FastCGI then - and remove the handler / caller on your virtual hosts where you don't want to have them.

RenatoMN 10-30-2009 11:01 PM

This is usually located in /etc/apache2/httpd.conf

I'm not sure for cPanel, I do not use it for years. Using Kloxo (formerly LxAdmin) and Virtualmin.

However, if you have root access to cPanel, all config files are editable from within WHM.

snakes1100 10-31-2009 02:15 AM

Quote:

Originally Posted by RenatoMN (Post 1908507)
This is usually located in /etc/apache2/httpd.conf

I'm not sure for cPanel, I do not use it for years. Using Kloxo (formerly LxAdmin) and Virtualmin.

However, if you have root access to cPanel, all config files are editable from within WHM.

cpanel: /usr/local/apache/conf/httpd.conf

James Birkett 11-01-2009 12:47 PM

Quote:

Originally Posted by Angel-Wings (Post 1908295)
Webserver Configuration if you're using Apache. For Nginx / Lighty or other server just look how PHP is called - usually via FastCGI then - and remove the handler / caller on your virtual hosts where you don't want to have them.

Can I allow that handler to only run on sub-domains to stop PHP parsing on them sub-domains? I still host a vBulletin forum on the same server - so, of course, I don't want to stop PHP altogether.

snakes1100 11-01-2009 09:08 PM

place it in the sub-domain container <virtualhost> subdomain </virtualhost>

Angel-Wings 11-02-2009 02:10 PM

Quote:

Originally Posted by James Birkett (Post 1908994)
Can I allow that handler to only run on sub-domains to stop PHP parsing on them sub-domains? I still host a vBulletin forum on the same server - so, of course, I don't want to stop PHP altogether.

Depends on how your PHP is set. If you run it via CGI or FastCGI - usually you've an Suexec Wrapper - something like:

Global HTTP Conf:

Quote:

FastCgiWrapper /usr/local/sbin/suexec
And then place in your Vhosts:

Quote:

<VirtualHost ....>
FastCgiServer /usr/local/example/php_vhost_1 -user domain_1 -group domain_2
...
</VirtualHost>
Using this you've PHP running under different users for each Vhost. If that line is missing, no PHP will be executed.
Just look how you can set FastCGI with an Suexec Wrapper.

If you use the Module:

Quote:

<VirtualHost ...>
php_admin_flag engine off
php_admin_value open_basedir /nonexistent
</VirtualHost>
Will do it. The second one isn't required, just to be safe setting open_basedir to a non existing directory never hurts.
Or you do it vise versa and disable PHP globally by php.ini then enabling it only for the Vhosts you will need it. :)

snakes1100 11-03-2009 06:29 PM

Quote:

Originally Posted by Angel-Wings (Post 1909425)
Depends on how your PHP is set. If you run it via CGI or FastCGI - usually you've an Suexec Wrapper - something like:

He is using a cpanel server, those instructions will not help him to put it in the needed location.

Angel-Wings 11-05-2009 04:32 PM

Quote:

Originally Posted by snakes1100 (Post 1909896)
He is using a cpanel server, those instructions will not help him to put it in the needed location.

Someone else might not using cpanel so these instructions might be still useful

snakes1100 11-06-2009 01:36 AM

I didn't state they wasn't useful, i only stated that they won't work on a cpanel server, which he is using.


All times are GMT. The time now is 08:29 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01098 seconds
  • Memory Usage 1,774KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (12)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (26)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete