PDA

View Full Version : HOWTO : SuPHP


nebukazar
02-03-2004, 10:46 PM
Here are the steps I did to install suPHP under Redhat 9.0 :

1- Get suPHP :
wget http://www.suphp.org/download/suphp-0.5.tar.gz

2- Unpack the archive and enter into the created directory :
tar -zxvf suphp-0.5.tar.gz ; cd suphp-0.5/

3- Copy your current php bin :
cp -p /usr/local/bin/php /usr/local/bin/php.CLI

- Download, extract php CGI :
Make sure you are running Redhat9.0 and you are using PHP 4.3.4 :
wget http://katou.nebukazar.net/CGI-php-v4.3.4-rh9.tar.gz
tar -zxvf CGI-php-v4.3.4-rh9.tar.gz ; cp -fp CGI-php-v4.3.4-rh9/php /usr/local/bin/php.CGI

If you are not using Redhat 9 or you're not using the same PHP version, you can download your PHP version, configure then make. The CGI php version is located under : [PHP-Directory]/sapi/cgi/php

4- Configure suPHP to your system :
./configure --with-apache-user=apache --with-php=/usr/local/bin/php.CGI --disable-checkpath --disable-checkuid --disable-checkgid --with-min-uid=0 --with-min-gid=0

5- Make :
make

6- Before doing make install, please keep a backup of your httpd.conf :
cp -p /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.bak

7- Make install suPHP :
make install

8- Edit your httpd.conf
- vi or pico /etc/httpd/conf/httpd.conf

locate :

<IfModule mod_php4.c>
AddType application/x-httpd-php .inc .php .php4 .php3 .phtml
AddType application/x-httpd-php-source .phps
</IfModule>


and replace with :

<IfModule mod_php4.c>
suPHP_Engine on
AddHandler x-httpd-php .php
AddType application/x-httpd-php .inc .php .php4 .php3 .phtml
AddType application/x-httpd-php-source .phps



9- Change 1 setting in your php.ini (!! Make sure you are editing the right php.ini file !!):
vi or pico /usr/local/lib/php.ini

find :


;cgi.force_redirect =


and change it to :


cgi.force_redirect = 0


10- Restart httpd :
service httpd restart

suPHP log is installed under /etc/httpd/logs/suphp_log

If you need more help PM me or contact me at ltellier@eenix.com

bilco105
07-01-2004, 12:17 PM
Quick question,

This is compiling php barebone right?. So it doesn't include cURL etc etc.

How do we compile it with say...

imap, curl, mcrypt, gd, mhash, freetype?

nebukazar
07-02-2004, 10:06 PM
Hi,

suPHP is only a wrapper. It will take the actual php binary and will execute the binary as the user.

So, you will need to compile the cgi php binary with all the options you want (cURL, mcrypt, etc.)

aleborg
07-16-2004, 04:07 AM
Is there any known problems with changing layout while running suPHP? As we tried now we get this error:

Status: 0 Content-type: text/html Security Alert! The PHP CGI cannot be accessed directly.
This PHP CGI binary was compiled with force-cgi-redirect enabled. This means that a page will only be served up if the REDIRECT_STATUS CGI variable is set, e.g. via an Apache Action directive.
For more information about changing this behaviour or re-enabling this webserver, consult the installation file that came with this distribution, or visit the manual page.

I think this flag (force-cgi-redirect) was set while installing suPHP. Is it neccassary? How do we solve this problem?

nebukazar
07-16-2004, 08:19 AM
hi,

it is necessary otherwise you won't be able to use php-cgi correctly.

regards,

aleborg
07-16-2004, 09:08 AM
So there's no solution to get other layouts then?

nebukazar
07-16-2004, 09:15 AM
well, as far as I know, no

Naughty Sheep
08-18-2004, 03:36 PM
how did you get webmail/squirrelmail/phpmyadmin working?

everything works here except those 3

nebukazar
08-18-2004, 03:39 PM
hi,

make sure both php are installed on your server. CGI and CLI

Do you get any errors ?
Did you take a look @ your logs ?

Naughty Sheep
08-18-2004, 04:14 PM
yes, got both installed

suphp.log:

[Thu Aug 19 00:13:14 2004] [error] Script /var/www/html/webmail//index.php is not in the DOCUMENT_ROOT (/home/user/domains/domain.com/public_html)

i know it goes though suphp, but just want to know how you did it?

and another thing, i actualy have the idea that apache is crashing on something

[Wed Aug 18 21:23:51 2004] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Wed Aug 18 21:23:51 2004] [notice] Accept mutex: sysvsem (Default: sysvsem)
[Wed Aug 18 21:25:03 2004] [error] [client 82.192.xx.xx] request failed: URI too long
[Thu Aug 19 00:11:00 2004] [notice] caught SIGTERM, shutting down
[Thu Aug 19 00:11:01 2004] [notice] Apache/1.3.31 (Unix) mod_ssl/2.8.19 OpenSSL/0.9.7a PHP/4.3.8 mod_perl/1.27 FrontPage/5.0.2.2510 configured -- resuming normal operations

blueice
09-27-2004, 12:04 PM
any how-to for freebsd systems?

KulM
11-02-2004, 12:24 PM
I got SuPHP working on FreeBSD 4.10, the only thing different I had to do was copy the php-4.3.9.tar.gz to another directory and run my normal configure, but without the:
--with-apxs \
line. Then I ran make, but NOT make install
Then I copied sapi/cgi/php to /usr/local/bin/php.CGI and made the other changes. That was it.

redeye
02-14-2005, 01:48 AM
Hi I couldn't find the php.CGI, so i rebuild php with options --enable-cgi

I've runned configure of suphp like this: ./configure --with-apache-user=apache --disable-checkpath --disable-checkuid --disable-checkgid --with-min-uid=0 --with-min-gid=0

After restarting I get internal servererrors when requesting php pages.

In the logging it says:

[Mon Feb 14 09:16:24 2005] [error] System error: execl() failed (No such file or directory)
[Mon Feb 14 09:16:24 2005] [info] Executing /home/wil/domains/public_html/forum/index.php as user wil (1017),
group wil (1017)
[Mon Feb 14 09:16:24 2005] [error] System error: execl() failed (No such file or directory)

Can anyone help?

nbn
02-18-2005, 12:26 AM
I tried to do a custom php build, in order to include the cgi.

I went to directory:
/usr/local/directadmin/customapache/php-4.3.10
Which is the version I use, and tried using the configure options (as displayed by phpinfo), and added --enable-cgi

After running ./configure and make it does not create any php binary in sapi/cgi

Do I need to run a build with --disable-cli? Because, then I would have to remove pear as well, and I don't know if that is good or bad.

Cheers

redeye
02-18-2005, 04:47 AM
That's exactly what I mean, dito here.

nbn
02-18-2005, 05:03 AM
I got to creating a CGI edition, by adding --enable-cgi, and REMOVING --with-apxs from the configure line.

redeye
02-22-2005, 02:29 AM
Dito here. Just got a problem with --with-php=/usr/local/bin/php.cgi

It doesn't use that var :s, it keeps looking at /usr/bin/php which is a link to /usr/local/bin/php, so I changed that link to /usr/local/bin/php.cgi

And now it Rocks, at last. I'm currently testing and, when everything goes well, I will change domain by domain to suphp.

I will default enable it for new clients :D.

XBL
04-17-2005, 10:19 AM
In case someone doesn't know for sure: suPHP works perfectly fine with PHP5 (I wasn't sure because I couldn't get it compiled with php5 properly before).

It's great to watch 'top' now ;).

Jochem

Titam
04-30-2005, 03:42 AM
I don't understand this :

- Download, extract php CGI :
Make sure you are running Redhat9.0 and you are using PHP 4.3.4 :
wget http://katou.nebukazar.net/CGI-php-v4.3.4-rh9.tar.gz
tar -zxvf CGI-php-v4.3.4-rh9.tar.gz ; cp -fp CGI-php-v4.3.4-rh9/php /usr/local/bin/php.CGI

If you are not using Redhat 9 or you're not using the same PHP version, you can download your PHP version, configure then make. The CGI php version is located under : [PHP-Directory]/sapi/cgi/php

In fact i have fedora, what do i have to do ? Because i can't download this file ... Where can i find one for my system and php 4.3.11 ?

Tanks :)

XBL
05-01-2005, 07:01 AM
@titam: go to www.suphp.org for suPHP and go to www.php.org/downloads.php to get the latest versions of both products. The versions above is outdated anyway.

To compile php as a CGI bin, leave out '--with-apxs' and add '--enable-force-cgi-redirect'. Good luck.

Jochem

Titam
05-01-2005, 09:04 AM
In my suphp_log i have :


[Sat Apr 30 13:05:30 2005] [error] suPHP was called by apache (100), not by nobody (99)
[Sat Apr 30 13:27:31 2005] [error] suPHP was called by apache (100), not by nobody (99)
[Sat Apr 30 13:27:33 2005] [error] suPHP was called by apache (100), not by nobody (99)
[Sat Apr 30 13:27:41 2005] [error] suPHP was called by apache (100), not by nobody (99)
[Sat Apr 30 13:27:51 2005] [error] suPHP was called by apache (100), not by nobody (99)
[Sat Apr 30 13:27:53 2005] [error] suPHP was called by apache (100), not by nobody (99)
[Sat Apr 30 13:27:54 2005] [error] suPHP was called by apache (100), not by nobody (99)


I did something wrong somewhere ... :\

Titam
05-01-2005, 09:10 AM
And when i had this line my httpd.conf :

AddHandler x-httpd-php .php


I have an Internal Server Error ... sniff

If i quote it, my website is ok, but suphp is not really ok (right are always nobody)

webquarry
05-01-2005, 03:13 PM
Anyone have any idea if the latest direct admin/installatron combo will work with suphp?

XBL
05-01-2005, 11:31 PM
Originally posted by webquarry
Anyone have any idea if the latest direct admin/installatron combo will work with suphp? No problem here using php5.0.4/suPHP0.5.2/DA1.23.5. DirectAdmin doesn't have anything to do with PHP, really. It does use the php binary, but it's no problem if it's cgi, cli or whatever.

We do run have the cli binary in our path tho, but it's only used when called like /usr/local/bin/php (and "php" from the command line). Otherwise it will use suPHP with /usr/local/bin/php.cgi.

Jochem

Titam
05-23-2005, 02:59 AM
Originally posted by XBL
@titam: go to www.suphp.org for suPHP and go to www.php.org/downloads.php to get the latest versions of both products. The versions above is outdated anyway.

To compile php as a CGI bin, leave out '--with-apxs' and add '--enable-force-cgi-redirect'. Good luck.

Jochem

Thanks.

I have an internal server error when a rep or file is in 775 chmod, by example. I think it's normal, but when all files are in 755, that works.

Is it ok ?

Thanks :)

XBL
05-24-2005, 01:10 PM
Check your suphp log. It will probably mention that the chmods are incorrect (set to write, for example). Files can't be executed when they are writeable, I believe.

Jochem

Titam
05-24-2005, 01:15 PM
Originally posted by XBL
Check your suphp log. It will probably mention that the chmods are incorrect (set to write, for example). Files can't be executed when they are writeable, I believe.

Jochem

It's ok thanks, but since i installated this, i have problem with function mail() (in fact i think that the adress designed in httpd.conf by sendmail -t -i domaine@domaine.com does'nt work, because with mail function, it's right (in header) from : domaine@Hotsname from domaine@domaine.com

Is suPhp or CGI mod who maked this ?

Titam
05-24-2005, 04:01 PM
Originally posted by Titam
It's ok thanks, but since i installated this, i have problem with function mail() (in fact i think that the adress designed in httpd.conf by sendmail -t -i domaine@domaine.com does'nt work, because with mail function, it's right (in header) from : domaine@Hotsname from domaine@domaine.com

Is suPhp or CGI mod who maked this ?

I have uninstall suPhp, no more problem with function mail() :\

Sheldon
06-30-2005, 06:36 PM
I just cant get this to work properly.

Ive got it setup pretty much, except for the fact that it doesnt work. httpd still runs as apache.

no errors tho. but then again im not using php as CGI, which according to suphp website, you dont have to, it never specifies that you do.

-Sheldon

jmstacey
06-30-2005, 09:06 PM
Have you tried 0.6.0 which was released earlier this month?

Following this tutorial requires CGI, see step 3.

Sheldon
06-30-2005, 09:30 PM
I did download the latest version yes.

I followed the instructions on the website and couldnt get it to work correctly.

-Sheldon

Avenueduweb
07-21-2005, 05:38 AM
Hello,

I've got a problem with suphp. Actually, if I create a folder "include", when a php's script use "require_once" (or "include") and the file are not in the same folder of the php's script, the php's script go to folder include to include the file but the folder "include" don't run with suphp. What is the solution ? Thanks. Bye.

lyzer4
08-15-2005, 03:38 AM
After much frustration I finally managed to get suPHP working!

As was said before (although it took me a while to figure it out) you just have to configure and make your PHP version with the same options as the currently installed one except you exclude --with-apxs.

Then copy and paste the sapi/cgi/php to /usr/local/bin/php.CGI and voila suPHP works fabulously. I love it. MK

PS: It only worked with versions 0.5 and 0.5.2 I couldn't get 0.6 working.

Don't forget to use --disable-checkuid --disable-checkgid --with-min-uid=0 --with-min-gid=0 in your ./configure of suPHP otherwise things like webmail and other stuff will break that is run as root or another UID.

extor
10-29-2005, 01:58 AM
So if I understand it right you must let the PHP version (4.4.0) that is installed by DirectAdmin intact and install a new PHP manually like in /root? Or you just need to configure the current PHP installation by DirectAdmin?

This howto is not very clear for me so I hope someone could explain me a bit more, thanks!

Titam
10-29-2005, 02:30 AM
If you speak or understand a little bit french, i did an other how to here (http://www.directadmin.fr/forum/viewtopic.php?t=6)

extor
10-29-2005, 02:40 AM
Nevermind, I have read all reactions xx times and now I get it.

You must install a new version of PHP (same as already is running), that is the clue, now my suPHP is working but one website is now having problems with the sessions... strange

extor
10-31-2005, 12:54 PM
I have a problem with suPHP.

The logfile: suphp_log gets bigger and bigger every second! How do you stop the logging?

Thanks..

getUP
11-06-2005, 03:38 PM
Any update on this with the latest versions?

extor
11-07-2005, 01:50 AM
I don't use suPHP any more because it's in my opinion not stable enough and I had to many issues while it was enabled.

I don't recommend it but that's my statement!

Titam
11-08-2005, 03:33 PM
Originally posted by extor
I don't use suPHP any more because it's in my opinion not stable enough and I had to many issues while it was enabled.

I don't recommend it but that's my statement!

I think different lol . Since I installed and configurated it on my servers, I have no problem with it, and no more "little" problems due to a badscript of my hosted people

XBL
11-08-2005, 11:28 PM
Originally posted by getUP
Any update on this with the latest versions? In a few weeks we will probably update to the latest version (0.6.0). I'll post my results and an updated how-to. Not now, since I'm kinda busy.

Jochem

VisiGod
02-04-2006, 04:32 AM
I've tried this solution in CentOS 4.2 (x86_64) with PHP 4.4.2

There is a bug in PHP when you do the configure.
You must edit the file
/usr/local/directadmin/customapache/php-4.4.2/pear/Makefile.frag

and change line 6 to read:
PEAR_INSTALL_FLAGS = -n -dshort_open_tag=0 -dsafe_mode=0 -dmemory_limit=-1

instead of:
PEAR_INSTALL_FLAGS = -n -dshort_open_tag=0 -dsafe_mode=0

after that you can configure PHP like is said before (remove --with-apxs and include --enable-force-cgi-redirect)

PS: Dont forget that the binary of PHP in /usr/bin will be written over, so it's better to make a backup copy.

PeterT
02-25-2006, 09:19 AM
Anyone got 0.6.1 running combined with php 5.1.2 yet?

duke28
03-07-2006, 01:42 PM
i got this :

[root@box4 suphp-0.6.1]# service httpd restart
Stopping httpd: [ OK ]
Starting httpd: [Tue Mar 7 15:24:22 2006] [warn] module perl_module is already loaded, skipping
Syntax error on line 386 of /etc/httpd/conf/httpd.conf:
Invalid command 'suPHP_Engine', perhaps mis-spelled or defined by a module not included in the server configuration
[FAILED]


what is the problem ?

sullise
03-07-2006, 03:05 PM
error message is clearly in english..

Invalid command 'suPHP_Engine', perhaps mis-spelled or defined by a module not included in the server configuration

duke28
03-07-2006, 03:07 PM
i just install susphp5 and now its fixed

i think suphp6* not working yet..

duke28
03-09-2006, 02:52 PM
since i installed suphp,

all plugins of directadmin dont appear in each user panel..

i mean installatron + awstats options in user panel do not show..

do you know why ?

sullise
03-09-2006, 07:31 PM
Which skin?

duke28
03-10-2006, 11:57 AM
its ok , i forgot to chmod 755 the bin of php ( the cli )

now its ok, but now few websites have this error :

Warning: Unknown(): open(/tmp/sess_e2a331a498d9ae602c6b4f956aa7bfa0, O_RDWR) failed: Permission denied (13) in Unknown on line 0

Warning: Unknown(): Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line 0


and in the /tmp the file are there but with the UID root:root
???

3 or 4 files sess_ are with this group ( 0:0 )
any idea ?

i use suphp-0.5

XBL
03-10-2006, 12:12 PM
The sessions that exist at the moment are owned by the user apache is running on (if that's root, you should change that 'nobody' or 'apache' or something!). Now all php documents are executed by different users, so it's impossible to read previous sessions.

An option is to just delete all those sessions and your problems will be fixed. Otherwise you could chmod the session to have proper read/write permissions for all users.

Jochem

duke28
03-10-2006, 12:41 PM
i have rm -rf * in /tmp

but its continu

[root@box4 tmp]# ls -ln
total 188
-rw------- 1 897 897 0 Mar 10 14:19 sess_2603c01ada36184f4b71ffbca9be00bf
-rw------- 1 897 897 0 Mar 10 14:19 sess_57e937c99caac762baa760c446a4baed
-rw------- 1 897 897 0 Mar 10 14:18 sess_6893398349d313d18da6abeb3480c1f4
-rw------- 1 724 724 0 Mar 10 14:15 sess_6c83a9f30fab855b1a85ddb0a9bced7f
-rw------- 1 897 897 0 Mar 10 14:18 sess_6f13b3021111342da9d4e06103dc553d
-rw------- 1 897 897 0 Mar 10 14:18 sess_71b082e89342a7e11c74d40fd889bafa
-rw------- 1 0 0 165396 Mar 10 14:19 sess_74be7999392bac3940ec1b43f20d3e43
-rw------- 1 0 0 22 Mar 10 14:16 sess_7d998915db500c7a92736318feb4b288
-rw------- 1 916 916 190 Mar 10 14:18 sess_8169a9ea38d5c7b70f1e3301fa088ca2
-rw------- 1 897 897 0 Mar 10 14:15 sess_8c53c2470d0400b74e755651fe9c4b32
-rw------- 1 897 897 0 Mar 10 14:18 sess_9002913f0fd202c0e2f4617ff0eb5e76
-rw------- 1 897 897 0 Mar 10 14:19 sess_99d2d86897f916365a8504eefaadf131
-rw------- 1 0 0 22 Mar 10 14:16 sess_9d14e36495331ae304db58fbf8957925
-rw------- 1 897 897 0 Mar 10 14:19 sess_d15e7d918b51a1e2d8a69f86fc99b963

why again other files in 0:0 ( root ) ??

xprotect
03-12-2006, 01:11 PM
I hear webmail and phpmyadmin will not work? It is rigth?

xprotect
03-12-2006, 01:18 PM
I do not have sapi/cgi/php folder? only sapi/cgi with this files
CREDITS Makefile.frag README.FastCGI cgi_main.c config9.m4 getopt.c libfcgi php.sym php_getopt.h

This is cofigure command:
# ./configure --with-apxs2 --with-curl --with-curl-dir=/usr/local/lib --with-gd --with-gd-dir=/usr/local/lib --with-gettext --with-jpeg-dir=/usr/local/lib --with-kerberos --with-mcrypt --with-mhash --with-mysql=/usr --with-pear --with-png-dir=/usr/local/lib --with-xml --with-zlib --with-zlib-dir=/usr/local/lib --with-zip --enable-bcmath --enable-calendar --enable-ftp --enable-magic-quotes --enable-sockets --enable-track-vars --enable-mbstring --enable-memory-limit --enable-fastcgi
# make
without make install

duke28
03-12-2006, 02:34 PM
you need compile it without --with-apxs2

after you going to found your sapi/cgi/php

xprotect
03-13-2006, 09:31 AM
Webmail and PhpMyAdmin will work?

xprotect
03-13-2006, 09:45 AM
I do not have <IfModule mod_php4.so> :/

It`s my httpd.conf
ServerRoot "/etc/httpd"

PidFile /var/run/httpd.pid

Timeout 300
KeepAlive Off
MaxKeepAliveRequests 100
KeepAliveTimeout 15


##
## Server-Pool Size Regulation (MPM specific)
##

# prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule prefork.c>
StartServers 5
MinSpareServers 5
MaxSpareServers 50
MaxClients 50
MaxRequestsPerChild 100
</IfModule>

# worker MPM
# StartServers: initial number of server processes to start
# MaxClients: maximum number of simultaneous client connections
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadsPerChild: constant number of worker threads in each server process
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule worker.c>
StartServers 2
MaxClients 150
MinSpareThreads 25
MaxSpareThreads 75
ThreadsPerChild 25
MaxRequestsPerChild 100
</IfModule>

# perchild MPM
# NumServers: constant number of server processes
# StartThreads: initial number of worker threads in each server process
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# MaxThreadsPerChild: maximum number of worker threads in each server process
# MaxRequestsPerChild: maximum number of connections per server process
<IfModule perchild.c>
NumServers 5
StartThreads 5
MinSpareThreads 5
MaxSpareThreads 10
MaxThreadsPerChild 20
MaxRequestsPerChild 100
</IfModule>

Listen 0.0.0.0:80

#
# Dynamic Shared Object (DSO) Support
#
LoadModule php4_module /usr/lib/apache/libphp4.so
LoadModule frontpage_module /usr/lib/apache/mod_frontpage.so
LoadModule perl_module /usr/lib/apache/mod_perl.so
#LoadModule security_module /usr/lib/apache/mod_security.so



User apache
Group apache

ServerAdmin admin@localhost
UseCanonicalName Off
DocumentRoot "/var/www/html"

<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>

<Directory "/var/www/html">
Options -Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>

#this is setup, but via alternate means
UserDir disabled

AddHandler cgi-script .cgi .pl
<Directory /home/*>
AllowOverride All
Options MultiViews -Indexes FollowSymlinks IncludesNoExec +Includes
<Limit GET POST OPTIONS PROPFIND>
Order allow,deny
Allow from all
</Limit>
<LimitExcept GET POST OPTIONS PROPFIND>
Order deny,allow
Deny from all
</LimitExcept>
</Directory>

DirectoryIndex index.html index.html.var index.htm index.shtml index.php index.php4 index.php3 index.phtml index.cgi

AccessFileName .htaccess
<Files ~ "^\.ht">
Order allow,deny
Deny from all
</Files>

TypesConfig /etc/mime.types

DefaultType text/plain

<IfModule mod_mime_magic.c>
MIMEMagicFile conf/magic
</IfModule>

HostnameLookups Off

EnableMMAP on
EnableSendfile on

ErrorLog /var/log/httpd/error_log
LogLevel warn

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
LogFormat "%b" bytes

CustomLog /var/log/httpd/access_log combined

# Set to one of: Full | OS | Minor | Minimal | Major | Prod
ServerTokens Full
ServerSignature On

Alias /icons/ "/var/www/icons/"
<Directory "/var/www/icons">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>

<Directory "/var/www/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>

IndexOptions FancyIndexing VersionSort

#
# AddIcon* directives tell the server which icon to show for different
# files or filename extensions. These are only displayed for
# FancyIndexed directories.
#
AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip

AddIconByType (TXT,/icons/text.gif) text/*
AddIconByType (IMG,/icons/image2.gif) image/*
AddIconByType (SND,/icons/sound2.gif) audio/*
AddIconByType (VID,/icons/movie.gif) video/*

AddIcon /icons/binary.gif .bin .exe
AddIcon /icons/binhex.gif .hqx
AddIcon /icons/tar.gif .tar
AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv
AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip
AddIcon /icons/a.gif .ps .ai .eps
AddIcon /icons/layout.gif .html .shtml .htm .pdf
AddIcon /icons/text.gif .txt
AddIcon /icons/c.gif .c
AddIcon /icons/p.gif .pl .py
AddIcon /icons/f.gif .for
AddIcon /icons/dvi.gif .dvi
AddIcon /icons/uuencoded.gif .uu
AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl
AddIcon /icons/tex.gif .tex
AddIcon /icons/bomb.gif core

AddIcon /icons/back.gif ..
AddIcon /icons/hand.right.gif README
AddIcon /icons/folder.gif ^^DIRECTORY^^
AddIcon /icons/blank.gif ^^BLANKICON^^

#
# DefaultIcon is which icon to show for files which do not have an icon
# explicitly set.
#
DefaultIcon /icons/unknown.gif

ReadmeName README.html
HeaderName HEADER.html

IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t

# DefaultLanguage en

AddLanguage ca .ca
AddLanguage cs .cz .cs
AddLanguage da .dk
AddLanguage de .de
AddLanguage el .el
AddLanguage en .en
AddLanguage eo .eo
AddLanguage es .es
AddLanguage et .et
AddLanguage fr .fr
AddLanguage he .he
AddLanguage hr .hr
AddLanguage it .it
AddLanguage ja .ja
AddLanguage ko .ko
AddLanguage ltz .ltz
AddLanguage nl .nl
AddLanguage nn .nn
AddLanguage no .no
AddLanguage pl .po
AddLanguage pt .pt
AddLanguage pt-BR .pt-br
AddLanguage ru .ru
AddLanguage sv .sv
AddLanguage zh-CN .zh-cn
AddLanguage zh-TW .zh-tw

LanguagePriority en ca cs da de el eo es et fr he hr it ja ko ltz nl nn no pl pt pt-BR ru sv zh-CN zh-TW
ForceLanguagePriority Prefer Fallback
AddDefaultCharset ISO-8859-2

AddCharset ISO-8859-1 .iso8859-1 .latin1
AddCharset ISO-8859-2 .iso8859-2 .latin2 .cen
AddCharset ISO-8859-3 .iso8859-3 .latin3
AddCharset ISO-8859-4 .iso8859-4 .latin4
AddCharset ISO-8859-5 .iso8859-5 .latin5 .cyr .iso-ru
AddCharset ISO-8859-6 .iso8859-6 .latin6 .arb
AddCharset ISO-8859-7 .iso8859-7 .latin7 .grk
AddCharset ISO-8859-8 .iso8859-8 .latin8 .heb
AddCharset ISO-8859-9 .iso8859-9 .latin9 .trk
AddCharset ISO-2022-JP .iso2022-jp .jis
AddCharset ISO-2022-KR .iso2022-kr .kis
AddCharset ISO-2022-CN .iso2022-cn .cis
AddCharset Big5 .Big5 .big5
# For russian, more than one charset is used (depends on client, mostly):
AddCharset WINDOWS-1251 .cp-1251 .win-1251
AddCharset CP866 .cp866
AddCharset KOI8-r .koi8-r .koi8-ru
AddCharset KOI8-ru .koi8-uk .ua
AddCharset ISO-10646-UCS-2 .ucs2
AddCharset ISO-10646-UCS-4 .ucs4
AddCharset UTF-8 .utf8
# See http://www.iana.org/assignments/character-sets
AddCharset GB2312 .gb2312 .gb
AddCharset utf-7 .utf7
AddCharset utf-8 .utf8
AddCharset big5 .big5 .b5
AddCharset EUC-TW .euc-tw
AddCharset EUC-JP .euc-jp
AddCharset EUC-KR .euc-kr
AddCharset shift_jis .sjis

AddType application/x-tar .tgz
AddType application/x-httpd-php .inc .php .php4 .php3 .phtml
AddType application/x-httpd-php-source .phps

#
# AddEncoding allows you to have certain browsers uncompress
# information on the fly. Note: Not all browsers support this.
# Despite the name similarity, the following Add* directives have nothing
# to do with the FancyIndexing customization directives above.
#
#AddEncoding x-compress .Z
#AddEncoding x-gzip .gz .tgz
#
# If the AddEncoding directives above are commented-out, then you
# probably should define those extensions to indicate media types:
#
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddHandler cgi-script .cgi
AddHandler imap-file map
AddHandler type-map var
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml

BrowserMatch "Mozilla/2" nokeepalive
BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0
BrowserMatch "RealPlayer 4\.0" force-response-1.0
BrowserMatch "Java/1\.0" force-response-1.0
BrowserMatch "JDK/1\.0" force-response-1.0
BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully
BrowserMatch "^WebDrive" redirect-carefully
BrowserMatch "^WebDAVFS/1.[012]" redirect-carefully
BrowserMatch "^gnome-vfs" redirect-carefully

#<Location /server-status>
# SetHandler server-status
# Order deny,allow
# Deny from all
# Allow from .example.com
#</Location>

#<Location /server-info>
# SetHandler server-info
# Order deny,allow
# Deny from all
# Allow from .example.com
#</Location>

<IfModule mod_ssl.c>
Include conf/ssl.conf
</IfModule>


#Start DirectAdmin Settings
Alias /config /var/www/html/redirect.php
Alias /phpMyAdmin /var/www/html/phpMyAdmin/
Alias /phpmyadmin /var/www/html/phpMyAdmin/
Alias /webmail /var/www/html/webmail/
Alias /squirrelmail /var/www/html/squirrelmail/

ErrorDocument 400 /400.shtml
ErrorDocument 401 /401.shtml
ErrorDocument 403 /403.shtml
ErrorDocument 404 /404.shtml
ErrorDocument 500 /500.shtml

#All NameVirtualHost lines are in this file
#Don't remove this line or apache will generate errors.
Include /etc/httpd/conf/ips.conf

LogFormat "%b \"%r\"" homedir
#The default site for the server.
<VirtualHost MyIP:80>
ServerAdmin webmaster@localhost
AliasMatch ^/~([^/]+)(/.*)* /home/$1/public_html$2
DocumentRoot /var/www/html
ServerName localhost
ScriptAlias /cgi-bin/ /var/www/cgi-bin/

CustomLog /var/log/httpd/homedir.log homedir
</VirtualHost>

<VirtualHost MyIP:443>
ServerName localhost
ServerAdmin webmaster@localhost
AliasMatch ^/~([^/]+)(/.*)* /home/$1/public_html$2
DocumentRoot /var/www/html
ScriptAlias /cgi-bin/ /var/www/cgi-bin/

SSLEngine on
SSLCertificateFile /etc/httpd/conf/ssl.crt/server.crt
SSLCertificateKeyFile /etc/httpd/conf/ssl.key/server.key

CustomLog /var/log/httpd/homedir.log homedir
</VirtualHost>

duke28
03-13-2006, 03:14 PM
do you have already php4 installed and working ?

i dont think so..

xprotect
03-14-2006, 05:27 AM
i have PHP 4.4.2 as apache module (API is Apache Handler 2.0) already working :)

xprotect
03-19-2006, 01:11 PM
I have suPHP already installed by for example user JOHN can include files from /home/admin/public_html :/

xprotect
03-19-2006, 01:23 PM
[Sun Mar 19 20:59:50 2006] [error] Script (/home/XXXXX/domains/XXXXX/public_html/m.php) is writeable by others
I have this in logs after installation and add suPHP :/
Apache 2.0.55, PHP 4.4.2, suPHP-0.5, DirectAdmin, CentOS 4.2

duke28
03-19-2006, 03:54 PM
chmod 755 or 644 the file .php

XBL
03-19-2006, 11:53 PM
Originally posted by xprotect
I have this in logs after installation and add suPHP :/
Apache 2.0.55, PHP 4.4.2, suPHP-0.5, DirectAdmin, CentOS 4.2 The error says it all: suPHP restricts certain read/write permissions (files only need to be writeable by the user). So you have to fix permissions (we recommend 444 (read/read/read) or 644 (read+write/read/read) most of our users).

Jochem

xprotect
03-19-2006, 11:57 PM
ergh, that i must use Safe Mode :( I was thinking that suPHP restrict user access only for him directories :P

xprotect
03-20-2006, 12:03 AM
next problem is this type:
when i turn suPHP on some users gets Internal Server Error when use php scripts (this site use phpBB)

XBL
03-20-2006, 12:08 AM
Originally posted by xprotect
next problem is this type:
when i turn suPHP on some users gets Internal Server Error when use php scripts (this site use phpBB) There should be errors in the suPHP log or in the httpd logs (error logs).

Jochem

xprotect
03-20-2006, 09:04 AM
This is in apache error logs:
[Mon Mar 20 16:52:48 2006] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Mon Mar 20 16:52:48 2006] [warn] RSA server certificate CommonName (CN) `www.XXXXXXX' does NOT match server name!?
[Mon Mar 20 16:52:48 2006] [warn] RSA server certificate CommonName (CN) `www.XXXXXX' does NOT match server name!?
[Mon Mar 20 16:52:48 2006] [warn] RSA server certificate CommonName (CN) `www.XXXXX' does NOT match server name!?
[Mon Mar 20 16:52:49 2006] [notice] Apache/2.0.55 (Unix) mod_perl/1.99_17-dev Perl/v5.8.5 mod_ssl/2.0.55 OpenSSL/0.9.7a PHP/4.4.2 FrontPage/5.0.2.2634 configured -- resuming normal operations
This in suEXEC
[2006-03-15 19:47:01]: uid: (500/admin) gid: (501/501) cmd: php
[2006-03-15 19:47:01]: target uid/gid (500/501) mismatch with directory (0/0) or program (0/0)
[2006-03-15 19:47:11]: uid: (500/admin) gid: (501/501) cmd: php
[2006-03-15 19:47:11]: target uid/gid (500/501) mismatch with directory (0/0) or program (0/0)
[2006-03-15 19:47:13]: uid: (500/admin) gid: (501/501) cmd: php
[2006-03-15 19:47:13]: target uid/gid (500/501) mismatch with directory (0/0) or program (0/0)
[2006-03-15 19:47:15]: uid: (500/admin) gid: (501/501) cmd: php
[2006-03-15 19:47:15]: target uid/gid (500/501) mismatch with directory (0/0) or program (0/0)
[2006-03-15 19:48:30]: uid: (500/admin) gid: (501/501) cmd: php
[2006-03-15 19:48:30]: target uid/gid (500/501) mismatch with directory (0/0) or program (0/0)
[2006-03-15 19:48:48]: uid: (500/admin) gid: (501/501) cmd: php
[2006-03-15 19:48:48]: target uid/gid (500/501) mismatch with directory (0/0) or program (0/0)
[2006-03-15 19:48:53]: uid: (500/admin) gid: (501/501) cmd: php
[2006-03-15 19:48:53]: target uid/gid (500/501) mismatch with directory (0/0) or program (0/0)
And this in suPHP logs:
[quote][Mon Mar 20 16:52:23 2006] [error] Script (/home/XXXXXX/domains/XXXXXXX/public_html/forum/index.php) is writeable by others[/quote[

thoroughfare
03-28-2006, 02:53 PM
Please see:
http://directadmin.com/forum/showthread.php?s=&threadid=12683

PhilipL
04-03-2006, 07:15 AM
Hi,

has anybody managed to get this installed and working on CentOS 4.2 with PHP 4.4.2?

I can't get mine to work and after compiling PHP as CGI and installing suPHP 6.1 and editing the httpd.conf it wont restart and spits out the following error message:

Invalid command 'suPHP_Engine', perhaps mis-spelled or defined by a module not included in the server configuration

Any help would be much appreciated.

Phil

xprotect
04-03-2006, 10:36 AM
You should install 0.5 v.

yorn
05-20-2007, 06:19 AM
Is it safe to use the lastest suPHP now? I want to set it up on a production system, along with PHP 5. I'm fine with Apache 1, so I don't intend updating it, but if it's recommended to do so, I would.