Apache 2 + Php 4 + Php 5 + Suphp 0.6.1

Now it works with Apache 2.2.x!

Just use suPHP 0.6.2 :)

suPHP 0.6.2 has been released.
The following problems have been fixed with this release:
* Double free() problem with certain versions of GCC
* Dead locked Apache processes when a script wrote more than 4096 bytes to stderr.
* Problems with PATH_INFO environment variable
Features / improvements:
* Apache 2.2 compatibility
* (Basic) mod_userdir support
 
I found that openssl is missing from the php5 install. How can I add that back? Do I need to build php once again for this? Thank!
 
What setting could I use to run PHP under the user the files are owned by? And besides PHP also to run all other http request under the user (so all files can have a chmod 100/200/400/500/600/700)?
 
Hello,

streamservice said:
What setting could I use to run PHP under the user the files are owned by? And besides PHP also to run all other http request under the user (so all files can have a chmod 100/200/400/500/600/700)?

suPHP will run your scripts as the owner of the script.

They need like now with PHP CLI a executable chmod.

Bye.
 
Hi,

ak17_hk said:
I found that openssl is missing from the php5 install. How can I add that back? Do I need to build php once again for this? Thank!

add --with-openssl=DIR to your PHP configuration line.

Yes you have to build php once again.
 
smtalk said:
Now it works with Apache 2.2.x!

Just use suPHP 0.6.2 :)

suPHP 0.6.2 has been released.
The following problems have been fixed with this release:

Features / improvements:

Howto updated. Thanks.
 
Maniak said:
Hello,



suPHP will run your scripts as the owner of the script.

They need like now with PHP CLI a executable chmod.

Bye.

I know that PHP-scripts need a chmod so they can be executed. But I want an option to serve html-pages/images under the username that is the owner off the file. And I would also like a way to run PHP under the user AND enable php_flag and php_value in .htaccess.

Besides this it would also be great to run MySQLd under the user that owns the database or that did login to the database. This way it is easily to know who is abusing a server with many clients with MySQL. So we can see what client uses to much off the server resources (CPU/ram).
 
Is there way to have php5 run natively and have php4 run only in CGI? I need php5 to run natively with Apache and I know clients will need php4 so I'm curious to know if I can setup only php4 to run with suphp while keeping my current php5.2.0 setup?
 
Hi,
streamservice said:
I know that PHP-scripts need a chmod so they can be executed. But I want an option to serve html-pages/images under the username that is the owner off the file. And I would also like a way to run PHP under the user AND enable php_flag and php_value in .htaccess.

Besides this it would also be great to run MySQLd under the user that owns the database or that did login to the database. This way it is easily to know who is abusing a server with many clients with MySQL. So we can see what client uses to much off the server resources (CPU/ram).
So far I have no idea. Maybe google a while for phpsuexec.

Using suPHP means to run as CGI and means also no php_flag.

Good luck.
 
Hi,
Senad said:
Is there way to have php5 run natively and have php4 run only in CGI? I need php5 to run natively with Apache and I know clients will need php4 so I'm curious to know if I can setup only php4 to run with suphp while keeping my current php5.2.0 setup?
Yes you can of course.

Just compile PHP5 as a normal DA version, keep only the php5 default configuration in the httpd.conf and remove the others for PHP4 and PHP.

Then do the howto, but add only this to your suphp.conf :

x-httpd-php=php:/usr/local/php4/bin/php

and in your httpd.conf only :

AddHandler x-httpd-php .php .inc .php4

that will run PHP5 as CLI (default with DA) and PHP4 as CGI module.

Of yes, do add also only this to your httpd.conf... :

<Location />
suPHP_Engine on
suPHP_ConfigPath /usr/local/etc/php5/cgi/
suPHP_AddHandler x-httpd-php
</Location>

Good luck.
 
Last edited:
Hello together,

I have a small problem using suphp for apache 2.2. Perhaps someone of you can help me to solve that probleme.

I'm using an dedicated Server with openSuse 10.1 and Apache 2.2 installed. On this machine i've tried to install suphp 0.6.2 but without success.

Everytime when i try to run the configure command i will get the error Message that APR is needed but wasn't found.

./configure --with-min-uid=30 --with-min-gid=30 --with-apache-user=wwwrun --with-php=/usr/bin/php5 --with-logfile=/var/log/apache/suphp.log --with-apxs=/usr/sbin/apxs2 --prefix=/usr --sysconfdir=/etc

I don't know how to solve this. The APR Libary are also installed.

libapr-util1
libapr-util1-devel
libapr1
libapr1-devel

The error message is the following.

checking for APR... no
checking for dynamic Apache module support (via APXS)... found at /usr/sbin/apxs2 (version 2.2.0)
configure: error: APR is needed to build mod_suphp for Apache 2.x but was not found

I hope that someone can help me.

Regards
Markus
 
Hello Markus,

I don't think that you are a DirectAdmin user on openSUSE and this forum is for DirectAdmin user only.

But to answer your question, you should try to run these commands as root :

# whereis apr

and add --with-apr=/path/to/apr to your configuration line while trying to compile suPHP.

It should fix your issue.

Regards.
 
Last edited:
I have bit the bullet with this and put it on one server.

The obvious problem that stood out to me was breaking .htaccess functionailty so I wanted mod_php to function as normal and simply use this to allow people to use php5 if they needed.

So I followed the guide with the following changes.

Didnt recompile php4 left the current install how it is, compiled su-php and php5 as instructed.

in the suphp.conf handlers look like this.

[handlers]
;Handler for php-scripts
;x-httpd-php=php:/usr/bin/php
x-httpd-php5=php:/usr/local/php5/bin/php

so no php4 handler.

in httpd.conf I kept all the mod_php stuff intact and only added the php5 handler line like this.

AddHandler x-httpd-php5 .php5
(no line for .php)

and in the location container.
<Location />
suPHP_Engine on
suPHP_ConfigPath /usr/local/etc/php5/cgi/
suPHP_AddHandler x-httpd-php5
</Location>

I also had to chown apache:apache the suphp log file else it couldnt write to it.

The suphp appears to be working fine with .php5 and .php has normal .htaccess functionality.

This setup I think is how DA plan to implement so as far as customers are concerned the main .php handler will work as normal and .htaccess wont be broken.
 
This HOW-TO explain you how to setup suPHP 0.6.2 + PHP 4.4.x(CGI) + PHP 5.1.x(CGI).

Including a script that will create a php.ini for each user (existing and new). Just send me a private message.

Just to be absolutely clear, we do not need to create a php.ini file for each user for this how-to to work, it's completely optional, correct?
 
Just to be absolutely clear, we do not need to create a php.ini file for each user for this how-to to work, it's completely optional, correct?

Exact you can create a global configuration. But using one php.ini file per user is a good solution harden your system.
 
How do whe install zend optimizer?

I do the folling:

I have installed zend 2 times

./build zend

installation path: /usr/local/zend4
lokation php.ini: /usr/local/etc/php4/cgi/

After this done:

./build zend
installation path: /usr/local/zend5
lokation php.ini: /usr/local/etc/php5/cgi/
 
Last edited:
Maniak, Thanks for the How-To, it worked great. We ended up not using su-php for PHP4 as some scripts broke and clients were complaining but we were able to run PHP4 as normal and suPHP with PHP5 altogether no problem as this guide helped point us in the right direction!
 
Hi.

Tried to get this working on a VPS, but when I add:

<Location />
suPHP_Engine on
suPHP_ConfigPath /usr/local/etc/php5/cgi/
suPHP_AddHandler x-httpd-php
suPHP_AddHandler x-httpd-php5
</Location>

and then restart Apache, I get:

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

I guess its spelt right as I have done it before using your HowTo guide but this time no go - any help appreciated!!!
 
Back
Top