View Full Version : Limiting Php access on a raq3
brainbox 12-26-2000, 06:35 PM Hello,
I've installed PHP 4.0x on a cobalt raq3
In the raq4 admin panel you could control which virtual sites had access to PHP and which ones didn't.
How do you control this on a raq3?
Bbox
Félix C.Courtemanche 12-26-2000, 06:59 PM read the previous post, I talk about what you must _manually_ add to the /etc/httpd/conf/httpd.conf file.
You must add these lines for every site using php.
brainbox 12-26-2000, 09:22 PM I havn't added anything to the httpd.conf file and all sites have access to php so I dont think I need to put anything in the httpd.conf file except for something that would block php usage.
Félix C.Courtemanche 12-27-2000, 01:00 AM You must then modify your php.ini file and change the flag phpengine so that it is off instead of on, only then my tip will work... Or if you dont put it it off, my trick will at least jail the users in their web directory and forbid them from looking around in your system.
brainbox 12-27-2000, 02:18 AM I looked at my php.ini file but it is blank, the one I looked at is in the /usr/local/lib/php directory.
Is there a live one somewhere else that I should be editing?
I did a whereis php.ini from telnet, and the response was /usr/local/lib/php
Thanks,
Bbox
That should sound right, though you should do a
locate php.ini
just to make sure you're not missing any other files.
brainbox 12-27-2000, 10:08 AM Hi,
When I do a locate php.ini I get the following:
/home/sites/home/users/admin/php-4.0.3pl1/php.ini-dist
/home/sites/home/users/admin/php-4.0.3pl1/php.ini-optimized
/home/sites/home/users/admin/php-4.0.3pl1/pear/tests/php.ini
When i first installed php, I unpacked it into my main admin account, and I've been wondering if I can delete the files from there. I was under the impression that it copied out everything that it needs and put them into the proper directories. But I've been worried about removing the files since I dont know if php uses them or not and it's not a big deal to takeup some extra space in my admin account if I have to leave them there.
Bbox
eva2000 12-27-2000, 11:25 AM what i did was copy php.ini-optimized and rename to php.ini and place it in /usr/local/lib/php ?
brainbox 12-27-2000, 11:56 AM Okay, I backed up my original php.ini that held nothing but a zend command, to php.bak then I copied my php.ini-optimized file to the /usr/local/php directory, stopped httpd services, then restarted, all seems fine but can anyone tell me what the difference is by having the optimized file as your php.ini compared to a blank php.ini file?
Thanks,
Bbox
[Edited by brainbox on 12-27-2000 at 11:13 AM]
You should ideally only use the optimized PHP.ini file if you're going to run Zend Optimizer with PHP. I believe there's another reason but I can't find it (it should be somewhere in the PHP documentation @ http://www.php.net ).
Félix C.Courtemanche 12-27-2000, 07:13 PM the php.ini file is the file conatining a lot of default values for php... configuration and security directoives. You need to have it on your system if you have any serious use of PHP in mind.
Domenico 12-28-2000, 05:47 AM Can I have this modified php.ini please ?
Thanks!
Domenico
Domenico,
I presume you're talking about the optimized php.ini file.
Telnet into your server and do a
locate php.ini-optimized
then copy that over to /usr/local/bin/php (or whatever your PHP directory is) and rename it as php.ini. Then download Zend Optimizer and follow the (very simple!) instructions.
Domenico 12-28-2000, 07:39 AM Thank you!
c0bra 12-29-2000, 12:11 PM Félix where is the previous post where you talk about restricting PHP to certain sites on a RAQ3? I've spent half hour trying to find it without success.
Thanks in advance.
Félix C.Courtemanche 12-30-2000, 07:19 PM look in this thread, the other one where eva says she installed php4 & MySQL.
brainbox 12-30-2000, 07:34 PM Okay, heres what you have to do.
1. Telnet into your server as admin, then do an su and enter your password.
2. cd /etc/httpd/conf/
3. pico -w srm.conf
4. find the line that says
AddType application/x-httpd-php .php .php4 .phtml .php3
and comment it out with a # at the beginning of the line.
5. save the file.
6. pico -w httpd.conf
7. for each virtual site that you want to have access to php, add the following line:
AddType application/x-httpd-php .php .php4 .phtml .php3
to the virtual sites area. heres an example:
<VirtualHost xxx.xxx.xxx.xxx>
ServerName http://www.mydomain.com
ServerAdmin admin
DocumentRoot /home/sites/site1/web
ServerAlias mydomain.com
ServerAlias mydomain.net
ServerAlias http://www.mydomain.net
RewriteEngine on
RewriteCond %{HTTP_HOST} !^xxx.xxx.xxx.xxx(:80)?$
RewriteCond %{HTTP_HOST} !^www.mydomain.com(:80)?$
RewriteRule ^/(.*) http://www.mydomain.com/$1 [L,R]
RewriteOptions inherit
AliasMatch ^/~([^/]+)(/(.*))? /home/sites/site1/users/$1/web/$3
AliasMatch ^/users/([^/]+)(/(.*))? /home/sites/site1/users/$1/web/$3
AddHandler cgi-wrapper .cgi
AddHandler cgi-wrapper .pl
AddHandler server-parsed .shtml
AddType application/x-httpd-php .php .php4 .phtml .php3
AddType text/html .shtml
</VirtualHost>
8. Save your httpd.conf file then restart your httpd server, and your all set, those sites that you have done this for in the httpd.conf file will be able to use php, those that dont wont.
Good Luck, and BE SURE TO MAKE BACKUPS OF YOUR SRM.CONF AND HTTPD.CONF FILES BEFORE EDITING SO IF YOU SCREW UP YOU CAN REVERT TO A GOOD COPY!!!!!
Bbox
[Edited by brainbox on 12-30-2000 at 06:36 PM]
|