Apache 2 + Php 4 + Php 5 + Suphp 0.6.1

Yes, sorry I think I wasn't clear. What would seem like a good idea to me for use on my production server with existing clients would be a set up where mod_php (php4) is used as standard as it is now and then for specific clients suPHP with choice of PHP4 or PHP5 (.php or .php5 files) can be set up and enabled for them in their virtaul host.

This would enable full backwards compatibility and would mean I don't have to immediately check all user's php applications (quite a few) to ensure there are no issues with the suPHP version. Then slowly I can migrate them towards suPHP if everything seems ok.

So I'm looking for a default setting of using mod_php and then explicitly activating suPHP for specific users. Are you able to explain how to do this?
 
*guess* using apache 1 do inside your httpd.conf :

LoadModule suphp_module /usr/lib/apache/mod_suphp.so

AddModule mod_suphp.c

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

and :

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

(for apache 2 do not add : AddModule ..)

and for restart apache, check that Server API is Apache (with a phpinfo(); file)

then for who needs suphp inside their httpd.conf :

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

that's it. (i guess)
 
This part in the main httpd.conf file seemed to be an issue:

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

as it stopped the mod_php from processing the .php files.

What I ended up doing was writing just the line:
LoadModule suphp_module /usr/lib/apache/mod_suphp.so
in my apache2 httpd.conf file and the rest in my virtual host httpd.conf file like so:

<VirtualHost xx.xx.xxx.xx:80>

# These are the handlers for suPHP
AddHandler x-httpd-php .php .inc .php4
AddHandler x-httpd-php5 .php5

# suPHP with PHP4 and 5 explicitly set here
<Location />
suPHP_Engine on
suPHP_ConfigPath /usr/local/etc/php5/cgi/
suPHP_AddHandler x-httpd-php
suPHP_AddHandler x-httpd-php5
</Location>

ServerName ... etc

This seems to be working in preliminary tests. All virtual hosts are using the standard mod_php successfully and the explicitly enabled virtual host is using suPHP with PHP4 and 5 as per the instructions.
 
You are right, I forgot that AddHandler would become a global Handler.

It should work at all, until da will not rewrite the file and remove that special *hands added* suPHP part.
 
Maniak said:
It should work at all, until da will not rewrite the file and remove that special *hands added* suPHP part.

Sorry, I don't understand. Do you mean that DirectAdmin will overwrite that file at some point and remove the suPHP part?
 
I'm not 100% sure.

The best way to try it, is to add a subdomain to the domain you changed (inside your httpd.conf) and check right after the subdomain is added if PHP is still handled by suPHP.

I made few tests, but actually, now I run only suPHP.

Let me know the results.
 
I've got a different problem with suPHP. I can view the base level of a site on a domain enabled with suPHP and PHP5 but can't then click through to any other pages. The site uses mod_rewrite rules to give short urls and it seems that there is a clash with my configuration of suPHP. I simply get this error: "No input file specified".

My apache logs show 404 errors for the requested pages. Do you have any idea what the problem might be? All other vhosts are not effected as they are still on mod_php and working as they did previously.
 
Yes I did. What should be changed?

I've tried with a fresh php.ini and the one I was using from mod_php.
 
Check the path of your normal php.ini file (that you use for mod_php), you can use phpinfo(); for this.

Try this :

# cp /usr/local/etc/php5/cgi/php.ini /usr/local/etc/php5/cgi/php.ini.old

# cp /usr/local/etc/php5/cgi/php.ini /usr/local/etc/php5/cgi/php.ini.old

# rm -rf /usr/local/etc/php4/cgi/php.ini
# rm -rf /usr/local/etc/php5/cgi/php.ini

# cp /usr/local/lib/php.ini /usr/local/etc/php4/cgi/php.ini

# cp /usr/local/lib/php.ini /usr/local/etc/php5/cgi/php.ini

and restart apache and try again.
 
Yes I tried that already but same issues as before. First page loads fine but all rewritten urls dont. For instance I can access pages by typing in their non-rewritten url and I can also access php files directly like info.php etc

So it seems an issue with rewritten files and paths.
 
So :

1° - Do you have the links updated to use .php5 files (in your website) ?

2° - Try to use the extension .php (for php5) and to upload this as .htaccess :

AddHandler x-httpd-php5 .php
RewriteEngine On
RewriteBase /

3° - Try with another browser just to make sure, it's not about the cache
 
Solution can be also :

AddHandler x-httpd-php5 .php
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

or

AddHandler x-httpd-php5 .php
RewriteEngine On
RewriteBase /
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
%{DOCUMENT_ROOT}%{REQUEST_URI} !-d

try, I remember an issue with DotClear 2.0 few days ago...
 
I have configured suPHP in my vhosts file to use just PHP5 for .php files already (also tested with PHP4).

I tried the htaccess options, the second one produced 500 errors. I've already changed the UID and GID in suphp.ini to 0 in case it helped.

I tried in another browser but same errors...
 
It seems strange that it could be a php error as it was working just fine before suPHP was activated on the vhost. It was working in PHP4 using mod_php.

Most info I can find by googling says that the path of doc_root in php.ini should be the same as the one set in httpd.conf

I've tried changing it to the one in both the main httpd.conf and the vhost one (user's public_html) but neither makes any difference.

Its a strange error as the index.php processes fine. I can process files when addressed directly but their short urls simply dont work. I have two CMS systems running on this domain, both of which were working fine. I can get neither to work now.
 
Solution n° 1:

in your php.ini :

comment -> doc_root
and -> cgi.fix_pathinfo=1

Solution n° 2 :

RewriteEngine on
RewriteCond %{ENV:REDIRECT_STATUS} !=200
RewriteRule /cgi-bin/path/to/php - [F]

or

RewriteEngine on
RewriteCond %{ENV:REDIRECT_STATUS} !200

Solution n° 3 :

Recompile php like this :

./configure --prefix=/usr/local/php5 --enable-force-cgi-redirect --with-config-file-path=/usr/local/etc/php5/cgi --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

force-cgi-redirect and fastcgi does not work together.

Finally if nothing works fine, I'll give you 2 others solutions.
 
Anything up?

I heard on french forum that gzip does distrub php5.

try a .htaccess with :

mod_gzip_on Off

let me know what going up with you
 
Back
Top