logikstudios

Well-Known Member
Nov 2, 2006
156
0
166
Hey. A Person who i am hosting a site for has asked me enable safe mode on his account. If i did that everyone else account would suffer. There is a way to set up a dedicated php.ini file for each account. How do i do this.

Thanks,
Nathaniel
 

cPanelKenneth

cPanel Development
Staff member
Apr 7, 2006
4,607
80
458
cPanel Access Level
Root Administrator
PHP.INI options can also (usually) be configured within the virtualhost block for a website. Check the PHP Manual for more specifics, but I think enabling safe mode is something like:

php_admin_flag safe_mode On
 

Rafaelfpviana

Well-Known Member
Mar 12, 2004
141
0
166
Brazil
Add this

Code:
php_admin_flag safe_mode On
in httpd.conf file, but online inside the <VirtualHost></VirtualHost> for that domain only.
 

logikstudios

Well-Known Member
Nov 2, 2006
156
0
166
Add this

Code:
php_admin_flag safe_mode On
in httpd.conf file, but online inside the <VirtualHost></VirtualHost> for that domain only.
does that go in the php.ini file.

Sorry i am really new to this kind of thing.
 

Rafaelfpviana

Well-Known Member
Mar 12, 2004
141
0
166
Brazil
No, it doesn't. You know what, since you don't know what that is the best thing to do is leave it alone, but i'll try to teach the best way possible.

First, you are going to SSH the server as root, if you know know what I just said or if you don't have root access to the server then forget about it.

First left make a backup file, type this:
Code:
cp /usr/local/apache/conf/httpd.conf /usr/local/apache/conf/httpd.conf.my_backup
in the server type this:

Code:
vi /usr/local/apache/conf/httpd.conf
ok, now search for the domain that needs safemode on, you do a search by typing / and then typing what you what to search. Pay attention to the lower left corner, that's where you will see what you are searching for, it's going to look alot like this:

Code:
/domain.com
after typeing that press enter.

Ok, when you find the domain its going to look something like this:

Code:
<VirtualHost 111.111.111.111>
ServerName www.domain.com
ServerAlias domain.com
ServerAdmin [email protected]
DocumentRoot /home/userdom/public_html
BytesLog domlogs/domain.com-bytes_log
User userdom
Group userdom

<IfModule mod_userdir.c>
  Userdir disabled
  Userdir enabled userdom 
</IfModule>

<IfModule mod_php5.c>
  php_admin_value open_basedir "/home/userdom:/usr/lib/php:/usr/local/lib/php:/tmp"
</IfModule>

CustomLog /usr/local/apache/domlogs/domain.com combined
ScriptAlias /cgi-bin/ /home/userdom/public_html/cgi-bin/
</VirtualHost>
Ok, using the arrow keys, go right bellow the second </IfModule> and press O

Now you are going to type:

Code:
php_admin_flag safe_mode On
when you are done typing press the escape key and save the file by pressing
Code:
:wq
now restart apache

Code:
/etc/init.d/httpd restart
and take a look to see if safemod is on for that domain.

If something goes wrong let's restore the backup that we made:

Code:
cat /usr/local/apache/conf/httpd.conf.my_backup > /usr/local/apache/conf/httpd.conf
That's it I think :D
 

logikstudios

Well-Known Member
Nov 2, 2006
156
0
166
Hey. I do have root access. I might pay some people in the datecentre to do it. I have done basic file editing and moving files in ssl but i am not comftable in editing the apache settings.
 

Rafaelfpviana

Well-Known Member
Mar 12, 2004
141
0
166
Brazil
Hey. I do have root access. I might pay some people in the datecentre to do it. I have done basic file editing and moving files in ssl but i am not comftable in editing the apache settings.
That's is the best thing you should do, don't touch on files when you are not sure of what you are doing.

I sugest you give'm the link for this post so they can understand what you need.

Good luck.
 

Rafaelfpviana

Well-Known Member
Mar 12, 2004
141
0
166
Brazil

logikstudios

Well-Known Member
Nov 2, 2006
156
0
166
Before i had my own server i had a reseller account on webhosting company. What they did is that they had a php folder in every accounts root. What i mean by that is as they can go up. So they see the folder www,mail,public_html etc

Couldn't you just put a folder called php in the root then put the file in?
 

Rafaelfpviana

Well-Known Member
Mar 12, 2004
141
0
166
Brazil
Before i had my own server i had a reseller account on webhosting company. What they did is that they had a php folder in every accounts root. What i mean by that is as they can go up. So they see the folder www,mail,public_html etc

Couldn't you just put a folder called php in the root then put the file in?
Not on servers with CPanel, at least not that I know.