Check If Php Suexec Installed

Table of Contents

michel dot jansens at ulb dot ac dot be

Php Version Check How to Check if php is installed on the Web Server and how to Detect the php Version using phpinfo(). An advanced, custom PHP code checker that searches your code for common, hard to find typos and mistakes; includes a syntax check. Via root SSH access the following command may be used to display the default PHP version, the current status of suEXEC, and the current Apache PHP Request Handler, such as DSO, CGI, FastCGI/FCGID, suPHP, or 'none'.

18 years ago
If you want to use suexec and reference your php interpreter via #!/usr/local/bin/php, be shure to compile php WITHOUT --enable-force-cgi-redirect.
This might seems obvious, but I spent 2 days on this :-(
Anonymous
  1. Find Out PHP Version installed On Unix / Linux Server last updated July 26, 2017 in Categories BASH Shell, Linux. How to find out what version of PHP is installed on my server? To find out php version installed on the server type any one of the following commands: $ php --version. Linux iotop Check What's Stressing Increasing Load On.
  2. One thing you can check though is to look in Server Configuration -> Website Options, and to make sure the PHP Execution Mode is set to either FCGID or CGI. If so, then you'll be using suexec with that domain.
7 years ago
IMPORTANT INFORMATION
There was a serious vulnerability in certain CGI-based PHP setups that has gone unnoticed for at least 8 years.
For PHP this means that a request containing ?-s may dump the PHP source code for the page.
Make sure to update to current versions and/or use an .htaccess patch, both available here:
PHP 5.3.12 and PHP 5.4.2 Released:
http://www.php.net/archive/2012.php#id2012-05-03-1
ruben at puettmann dot net
16 years ago
To use php-cgi with suexec it will be nice that each virtual host has ist's own php.ini. This goes with :
SetEnv PHPRC /var/www/server/www.test.com/conf
But suexec will kill this enviromet cause It don't know that it is 'save' so you must edit the suexec.c for compiling ..
kstone at trivergent dot net
19 years ago
Better yet, use binfmt_misc: (linux only)
echo :php3:E::php3::/usr/bin/php: > /proc/sys/fs/binfmt_misc/register
Eliminates the need for the #! at the top of the file.
yohgaki at hotmail dot com
18 years ago
If you care about security, you are better of setting
register_globals = off
enable_track_vars = on (Always on from PHP4.0.3)
Default setting for variable order is
EGPCS
(ENV VARS/GET VARS/POST VARS/COOKIE VARS/SESSION VARS)
Imagine if you are rely on ENV VAR but it was orver written with GET/POST/COOKIE vars?
pookey at pookey dot co dot uk
16 years ago
I have setup a guide to installing PHP with SuEXEC in such a way that shebangs (!#/usr/bin/php4) are not needed. Hope this is of some help to you.
http://www.pookey.co.uk/php-security.xml
goran_johansson at yahoo dot com

Check If Php Is Installed Ubuntu

16 years ago
A tip for Windows-users
Just a tip for you so do not do the same mistake as I did:
I just found out that PHP first seem to look in the php-directory for php.ini, and if that file does not exist, it looks in the Windows directory.
I renamed the file php.ini-dist to php.ini and copied it to my Windows directory, and then I modified the infamous 'cgi.force_redirect = 0' in the php.ini file located in the Windows directory, to make it work. But it did not because it reads from the 'original' php.ini - So when I deleted this php.ini things started working again
matled at gmx dot net
16 years ago
If you are using php per cgi and have additionally mod_gzip enabled you have to disable mod_gzip for the php cgi binary to use --enable-cgi-redirect. mod_gzip sets the REDIRECT_STATUS always to 200 which makes it impossible for the php binary to know when it was called directly or when it was called by a redirect.
phil dot ross at gmail dot com
14 years ago
In response to grange at club-internet dot fr:
There are a couple of errors in the mod_rewrite directives given. I found that the following works:
RewriteEngine on
RewriteCond %{ENV:REDIRECT_STATUS} !200
RewriteRule ^cgi-bin/php.cgi - [F]
I removed the = from the RewriteCond and took out the leading / from the RewriteRule.
phpD0TnetATmoritzHYPHONnaumannD0Tcom
13 years ago
One of the most common reasons why you get 'No input file specified' (AKA 'the second most useful error message in the world') is that you have set 'doc_root' (in php.ini) to a value which is to the 'DocumentRoot' defined in the apache configuration.
This is the same for other webservers. For example, on lighttpd, make sure the 'server.document-root' value is the same as what is defined as 'doc_root' in php.ini.
Craig Buchek
12 years ago
NOTE: Running PHP as a CGI program will change the value of $_SERVER['SCRIPT_NAME']. When running via the (normal) mod_PHP mechanism, it will be set to the name of (actually, path to) the PHP script that's running. When running via CGI, it will instead point to the path of the CGI binary.
martelli at geoserve dot com dot br
15 years ago
PHP CGI with VirtualHosts.
This is what I found out while trying to get php to work as CGI with Apache VirtualHosts.
By enabling 'force-cgiredirects', you *must*:
1) set 'cgi.fix_pathinfo=1' in php.ini
2) leave doc_root commented out (php.ini also)
If you miss item 1, the apache logs will show 'unexpected T_STRING' in the php binary.
If you miss item 2, you'll only see 'No input file specified.', instead of the expected output.
You can then turn on the php support for a particular vhost by defining:
Action php-script /cgi-bin/php
inside the corresponding <VirtualHost> directive.
steeven at kali dot com dot cn
18 years ago
suEXEC require CGI mode, and slow down the scripts. I did them like this:
1. Install php as DSO mode. (for max speed and low secure)
2. Make a seperate CGI install with --enable-force-cgi-redirect, place php to cgi-bin
3 For more secure with suEXEC, choose one of the following method:
3-1: Place a .htaccess file containing this to override main config:
AddType application/x-httpd-wphp php
Action application/x-httpd-wphp /cgi-bin/php
All php files in subdirectory will be protected.
3-2: add following in httpd.conf:
AddType application/x-httpd-wphp sphp
Action application/x-httpd-wphp /cgi-bin/php
then each sensitive php file should be renamed to .sphp
Add 'php_value doc_root /home/user/html_docs' to each virtual host directive in httpd.conf

Check If Php Is Working

geeky at geeky dot de
16 years ago
a replacement for suexec is suphp (http://www.suphp.org).
'suPHP is a tool for executing PHP scripts with the permissions of their owners. It consists of an Apache module (mod_suphp) and a setuid root binary (suphp) that is called by the Apache module to change the uid of the process executing the PHP interpreter.' (from the website)
Anonymous
15 years ago
PHP works with Apache and suEXEC like this:
(Assuming that suEXEC ist allready installed and working)
Install PHP as CGI binary (e.g. in /usr/local/bin/php)
(compile with --enable-force-cgi-redirect)
Create a Link inside cgi-bin directory to make php-cgi accessable:
cd /usr/local/apache/cgi-bin
ln /usr/local/bin/php php
Edit your httpd.conf file:
AddHandler php4-script .php
Action php4-script /cgi-bin/php
<VirtualHost 123.456.789.0:80>
User exampleuser
Group examplegroup
..
</VirtualHost>
Restart Apache
PHP-scripts are now called under the user-id of exampleuser and group-id of examplegroup.
kschroeder at mirageworks dot com
14 years ago
I have noticed that some people have noted that running PHP as a CGI program can run slowly compared with a compiled in module. Some have noted that they want to use FastCGI but are hesitant. I found that using the Apache 2's CGID module was a great way to speed up performance almost to the same level as an 'so'-installed PHP module but you get the added benefit of running each virtual host under it's own user and group.
In my testing I got 44 pages per second using PHP as a module and I got roughly the same performance (within 5%) running PHP as a CGI program through CGID.
CGID is also really easy to set up. Just add --enable-cgid to your Apache configure command and you're good to go. Just set up PHP as a CGI normally.
I'm sure that there's extra RAM used for this method but RAM is as cheap as borscht anyways so it shouldn't be a major factor when trying to speed up PHP CGI.
  • Security
Active3 years, 4 months ago

I successfully managed to make mod_fastcgi work with fpm, which enables me to set the user:group running the scripts via fpm pools definition. However, there is no similar alternative for, say, a python script run through mod_fastcgi, so i'm trying to learn how to use suexec to run whatever script through mod_fastcgi with the user:group i choose.

I'm starting from this working configuration:

I put a phpInfo() inside /var/www/test1/index.php, which shows the correct php.ini path.

Now, to activate suexec i:

  • Installed apache2-suexec: sudo apt-get install apache2-suexec
  • Activated mod_suexec: sudo a2enmod suexec
  • Changed files' permissions: sudo chown -R michele:michele /var/www/test1
  • Added this line to the vhost configuration: SuexecUserGroup michele michele
  • Reactivated the site and restarted apache: sudo a2dissite test1 && sudo a2ensite test1 && sudo service apache2 restart

The user:group michele:michele exists in the system. When running test1.slothcompany.net i see the phpInfo() output exactly as before, and echo exec('whoami'); prints www-data instead of michele.

sudo /usr/lib/apache2/suexec -V tells me that the log file should be in /var/log/apache2/suexec.log, but no such file exists. Then, i know that apache should log in the error.log file the activation of the suexec wrapper, as a notice, but in the error.log no such notice is found as well. So, i suspect that for some reason suexec isn't starting at all.

I read here the list of checks suexec doesto decide if the call is successfull, but i don't know how to check what the results of these checks are.it says they should be written in the suexec log file, but this file is never created, as it seems.

So, what i'm doing wrong?

Thank you all so much.

swahneeswahnee
1,0711 gold badge15 silver badges28 bronze badges

1 Answer

I finally managed to make it work, with the help of this post. There were two big issues with my first configuration: the first was that i didn't enable suexec to work with fastcgi (this requires to edit the fastcgi.conf configuration file); the second was that in my first virtual host i wasn't using fastcgi at all! I got this when i realized that the system worked the same after disabling fastcgi.

Serial means a unique number or code which identifies the license of the software as being valid. All retail software uses a serial number or key of some form. A serial number can also be referred to as an Activation Code or CD Key. When you search for Hp Tuners Serial, you may sometimes find the word 'serial' in the results. Hp Tuner Serial Numbers. Convert Hp Tuner trail version to full software. HP Tuners, the home of VCM Suite and the MPVI since 2003. Now enhancing these to new heights with a new feature rich VCM Editor and VCM Scanner, coupled together with the latest generation MPVI2, this is only tuning and diagnostic solution you’ll ever need for your modern OBDII vehicle. Hp tuners serial number. Apr 24, 2007  Does anyone knows where the freaking serial number is on the MPVI HPtuners? I want to download the last version capable of scaning some Fords, and in the house there's a couple of bad apples that I want to diagnose. Anyone, Everyone? Dec 23, 2010  Is my serial number on the CD somewhere, or is there anyway of retrieving it? I put the number somewhere, and cannot find it!!!

However, these are the final steps that worked for me (i tried them inside a Debian virtual machine created just for this):

  1. Install packages (after adding non-free to /etc/apt/sources.list for libapache2-mod-fastcgi):

  2. Add a global fastcgi configuration:

  3. Enable suexec inside fastcgi configuration (remove the # from the FastCgiWrapper line):

  4. Enable apache modules:

    If you don’t know how to install, you can see at “How To Install” tab. The player takes the role of a US soldier, part of the allied force fighting against outnumbering Chinese forces vying for Title: Operation Flashpoint: Dragon Rising Genre: Action Developer: Codemasters Studios Publisher: Codemasters Release Date: 8 Oct, 2009 Operation Flashpoint: Dragon Rising-RELOADED SIZE: 4.39 GB DOWNLOAD TORRENT All Torrents are seeding 24/7. Operation Flashpoint: Dragon Rising is a game about a fictitious conflict on one of the Sakhalin islands, a conflict that is in danger of erupting onto a global scale. Operation flashpoint free.

  5. Create test site files:

  6. Create apache virtual host:

  7. Restart apache

Check If Php Array Is Empty

swahneeswahnee
1,0711 gold badge15 silver badges28 bronze badges

Check If Php Function Exists

Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.

Not the answer you're looking for? Browse other questions tagged apache or ask your own question.

Comments are closed.