LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 01-30-2012, 12:07 PM   #1
ppostma1
LQ Newbie
 
Registered: Dec 2006
Location: Michigan USA
Distribution: slackware, ubuntu, Debian, knoppix, Fedora, CentOS
Posts: 14

Rep: Reputation: 0
Post issues with setting up apache, fcgid, php on CentOS


We have a server running fine on a host with WHM/Cpanel.

I am trying to get a 'duplicate' test server set up so we can run optimization and upgrade tests... but without buying the whm/cpanel since we are going to ditch it when our test are finished being reviewed.

I'm finding that many people have gone through the same issues I have so I'm posting as much of the process as I can remember to make this thread a reference.

But the main purpose is I have finally hit the same point as many others where there is no posted solution. Everything is installed but the fcgid just isn't kicking in.

so on centOS

yum install httpd mod_fcgid php-cli

however, that fcgid did not work out for me, I followed these directions: http://en.ispdoc.com/index.php/Insta...n_CentOS_Linux but I grabbed 2.3.6 (I could use 2.3.5 instead)

service httpd stop failed or httpd start cannot bind to port 80 already in use:
issue is the httpd.pid is directed to be stored in logs/httpd.pid when serivce looks for /var/run/httpd.pid
That can be fixed in the apache config by PidFile /var/run/httpd.pid
This file still is not written when the server starts, get the process id of the main thread (under root user) and write it to the file or killall httpd to shut down.

Invalid command 'x', perhaps misspelled or defined by a module not included in the server configuration:
most likely missing a module, Google "Invalid command x LoadModule" to get a list of suggested modules out of the search results.

mod_fcgid couldn't bind unix domain socket x:
permissions error on the path to the log directory where the default fcgidsock/ is. Make sure the path, both from /etc/ and /var/log is +rx for needed users.

now I am at the issue where the fcgid is not starting. On the running server I have:
root 10668 0.0 0.0 75688 9160 ? Ss Jan24 1:02 /usr/local/apache/bin/httpd -k start -DSSL
nobody 31132 0.0 0.0 75956 6412 ? S 09:09 0:00 \_ /usr/local/apache/bin/httpd -k start -DSSL
rbcorg 31249 0.0 0.0 190664 13700 ? S 09:09 0:00 | \_ /usr/bin/php
odjorg 31275 0.0 0.4 225748 75668 ? S 09:09 0:03 | \_ /usr/bin/php
rbcmin1 31692 0.6 0.8 290364 146716 ? S 09:09 0:28 | \_ /usr/bin/php
rbcmin1 31702 1.0 1.7 430000 286212 ? S 09:09 0:44 | \_ /usr/bin/php
ccourses 31735 0.6 1.7 433936 291944 ? S 09:09 0:27 | \_ /usr/bin/php
rbcorg 31737 0.0 0.3 211104 52500 ? S 09:09 0:01 | \_ /usr/bin/php
systuser 31738 0.0 0.0 191628 15304 ? S 09:09 0:00 | \_ /usr/bin/php
odjorg 32625 0.1 0.4 225484 75760 ? S 09:12 0:04 | \_ /usr/bin/php
rbcevent 32626 0.0 0.0 189876 14836 ? S 09:12 0:00 | \_ /usr/bin/php
rbcmin 32677 0.1 0.5 229956 85924 ? S 09:13 0:05 | \_ /usr/bin/php
rbcmin 32678 0.1 0.5 227796 83968 ? S 09:13 0:04 | \_ /usr/bin/php
rbcmin 12049 0.0 0.0 11036 1436 ? R 10:20 0:00 | | \_ ps auxf
nobody 5411 0.1 0.0 76504 8668 ? S 09:42 0:02 \_ /usr/local/apache/bin/httpd -k start -DSSL
nobody 5413 0.1 0.0 76512 8820 ? S 09:42 0:02 \_ /usr/local/apache/bin/httpd -k start -DSSL
nobody 5638 0.1 0.0 76524 8792 ? S 09:45 0:02 \_ /usr/local/apache/bin/httpd -k start -DSSL

etc, on the current server I have

root 7307 0.0 0.3 x y ? Ss 07:34 0:00 /usr/sbin/httpd
nobody 7309 0.0 0.1 x y ? S 07:34 0:00 /usr/sbin/httpd
nobody 7310 0.0 0.1 x y ? S 07:34 0:00 /usr/sbin/httpd

etc, but not a single php thread to indicate the fcgi daemon is active.

If the downloaded/compiled mod_fcgid is included in apache, the root thread (7307) dies after spawning the later threads (>7308) and dmesg declares segfault. (httpd[3176] segfault at 0000000047000029 rip 00002b4475e0031c rsp 00007fffda1baf40 error 4)

If the yum fcgid is included still no fcgi daemon, no segfault, but the logs are of course filled with (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server
Premature end of script headers: index.php

duh, no php threads to connect to.
fcgidsock is still empty, permissions 700 (which works find in the production server, which is filled with process ID files) but I'm not getting the permission denied mod_fcgid: spawn process error + couldn't bind unix domain socket ../fcgidsock/3625 to indicate its having problems writing the files. Seems like its not trying at all now.

-------------------------
My goals:
I would prefer to use the downloaded fcgid, as that is what is running on the production, but it all goes down to a .so so not up tight about that

where else can I look for errors to determine what is wrong? with the segfault (downloaded/compiled fcgid) or threads not initiating (yum fcgid module)

Get the server up and running with php/fcgid

----------------------------

I will not accept:
Switch to mod_php, fastcgid, another kernel/flavor...
Thats not my job and the purpose is mirror the running production. I know it can be done I'm just missing a step or two from completing it.
The system is PCI compliant, its too much to just up and change the production so I can have something easier to mirror.
mod_php is not fast enough for the demand on this thing (we are maxing 16-cores, 16GB on 2 servers to support the site)
fastcgid takes too much memory, the threads were easily hitting 1GB+ if they remained active too long

-----------------

Long term goals:
test Zend server and other optimizations. I am going to take our 3GB log files at the end of the day and script a 60x thread "attack" on the test box to see how long it takes to run a full days usage through it, while reading memory usage. Then install or swap out the different optimizations such as zend community, or a trial of the paid version, mod_php, fastcgid with different configs, and run the test again.

Also snapshot the server to have a restore point, and update our php programs to see how they handle upgrades.
 
Old 01-30-2012, 01:08 PM   #2
ppostma1
LQ Newbie
 
Registered: Dec 2006
Location: Michigan USA
Distribution: slackware, ubuntu, Debian, knoppix, Fedora, CentOS
Posts: 14

Original Poster
Rep: Reputation: 0
php.conf:

#values derived from testing of threads>x = immediate OOM, MaxRequest/ProcessLife >y = eventual OOM
#timeout are arbitrary
MaxRequestsPerProcess 2000

IPCConnectTimeout 5
IPCCommTimout 30
MaxProcessCount 20 # (62 production)
ProcessLifeTime 6400
IdleTimeout 60 #(20 production)

AddHandler fcgid-script .php5 .php .phtml
FCGIWrapper /etc/httpd/conf/php5 .php5
FCGIWrapper /etc/httpd/conf/php5 .php
FCGIWrapper /etc/httpd/conf/php5 .phtml
------------------------------------------

/etc/httpd/conf/php5:
exec /usr/bin/php
#exists, called from command line

export PHP_FCGI_CHILDREN=0
#one thing I have not a clue on

------------------------------------------

Output of /usr/bin/php does display:
PHP 5.1.6 (cli)
Copyright ...
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies...

I need to upgrade to version php version 5.2.16, and Zend 2.2.0 to get it the same.
 
Old 01-30-2012, 01:48 PM   #3
lithos
Senior Member
 
Registered: Jan 2010
Location: SI : 45.9531, 15.4894
Distribution: CentOS, OpenNA/Trustix, testing desktop openSuse 12.1 /Cinnamon/KDE4.8
Posts: 1,144

Rep: Reputation: 217Reputation: 217Reputation: 217
Quote:
Originally Posted by ppostma1 View Post
Output of /usr/bin/php does display:
PHP 5.1.6 (cli)
Copyright ...
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies...

I need to upgrade to version php version 5.2.16, and Zend 2.2.0 to get it the same.
First, I would try to find the PHP version from CLI with:
Code:
# php -v
then if needed, unfortunately I don't know where to install PHP 5.2.16 on CentOS, just v 5.2.17 here at bottom of the page PHP 5.2.17

And which version of CentOS are you running ? (# cat /etc/*-release )
 
Old 01-30-2012, 02:01 PM   #4
ppostma1
LQ Newbie
 
Registered: Dec 2006
Location: Michigan USA
Distribution: slackware, ubuntu, Debian, knoppix, Fedora, CentOS
Posts: 14

Original Poster
Rep: Reputation: 0
CentOS 5.5 (Final)

fortunately, cPanel drops src package installs to a /home directory that I can copy over. Just have to play with each packages config/install. php is currently building as I work through dependencies

also researching if I need php configured with fcgi support and the default yum package is not. If so, this build will satisfy it. I'll report back the results.
 
Old 01-30-2012, 02:12 PM   #5
lithos
Senior Member
 
Registered: Jan 2010
Location: SI : 45.9531, 15.4894
Distribution: CentOS, OpenNA/Trustix, testing desktop openSuse 12.1 /Cinnamon/KDE4.8
Posts: 1,144

Rep: Reputation: 217Reputation: 217Reputation: 217
I wish you best
 
Old 01-30-2012, 02:26 PM   #6
ppostma1
LQ Newbie
 
Registered: Dec 2006
Location: Michigan USA
Distribution: slackware, ubuntu, Debian, knoppix, Fedora, CentOS
Posts: 14

Original Poster
Rep: Reputation: 0
version of PHP was updated to 5.2.16 with --enable-fastcgi, Zend 2.2.0, (not) all tests passed. However, still no cgi/php threads are showing

(failed tests were ob_start not permitting a _flush() on unreasonable size and fopen w/ null byte in name, known bugs)
 
Old 01-30-2012, 04:31 PM   #7
ppostma1
LQ Newbie
 
Registered: Dec 2006
Location: Michigan USA
Distribution: slackware, ubuntu, Debian, knoppix, Fedora, CentOS
Posts: 14

Original Poster
Rep: Reputation: 0
/etc/httpd/conf/php5:
should be:

`exec /usr/bin/php-cgi`

no change
 
Old 01-31-2012, 02:31 PM   #8
ppostma1
LQ Newbie
 
Registered: Dec 2006
Location: Michigan USA
Distribution: slackware, ubuntu, Debian, knoppix, Fedora, CentOS
Posts: 14

Original Poster
Rep: Reputation: 0
switched to fastcgi to move forward for progress, it reports permissions error, read not allowed
but does not say what object the error is on.
However it continues on and populates threads
 
Old 02-03-2012, 03:16 PM   #9
ppostma1
LQ Newbie
 
Registered: Dec 2006
Location: Michigan USA
Distribution: slackware, ubuntu, Debian, knoppix, Fedora, CentOS
Posts: 14

Original Poster
Rep: Reputation: 0
I found one error with the fcgid, it was pulled source code, configured/recompiled from the production host. All modules (apache, php, etc) were all recompiled by me finding and reusing the configs from production, but I did not duplicate that on the fcgid. some requirements and mis-configs were missed. Trying to decipher the configs to rebuild that package.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] PHP or Apache issues, displays as text only. On Centos 5 armsman Linux - Software 8 09-14-2011 04:09 AM
CentOS setting up php / mysql keleas Linux - Server 2 10-28-2010 04:56 AM
Apache + PHP xdebug + fcgid = read data timeout in 40 seconds Miggleness Linux - Software 1 12-18-2009 09:43 AM
Centos 5.2 running Apache 2 and PHP 4 cannot display info.php codenjanod Linux - Server 2 08-19-2008 02:00 AM
Can't get PHP 5 to work on CentOS 4.2, Apache 2.0.52 tibberous Linux - Server 3 10-27-2007 06:25 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 08:33 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration