Apache

All posts tagged Apache

Just wasted about 3 hours of my life trying to figure out WTF I did to Apache that made it start giving me this error. Turns out I added a virtual_host section and added all the SSL directives, but I also had all the Global SSL directives enabled as well. Remove one set of SSL lines and finally that shit stared. Now where was I?

Not sure exactly why you need to manually modify Apache configs if you install using the Novell RPMs, but guess you do cuz the php shit just don’t work until you do the following.

zypper in apache2 apache2-mod_php53 php53   (and whatever else php53 mods you need)

copy in the php.ini, my install got this installed , but I’ve seen where there isn’t one.

cp /etc/php5/apache2/php.ini.template (or .example or .rpmnew) /etc/php5/apache2/php.ini

vi /etc/sysconfig/apache2

look for APACHE_MODULES= and add php5 rewrite.   Save. Exit.

APACHE_MODULES=”actions alias auth_basic authn_file authz_host authz_groupfile authz_default authz_user authn_dbm autoindex cgi dir env expires include log_config mime negotiation setenvif ssl php5 suexec userdir  reqtimeout rewrite”

 

I’ve never even knew this “SuSEconfig” command even existed but apparently it does, anyhow you need to run it..heh.

# SuSEconfig && rcapache2 restart

 

You should see your Apache modules using, look for php5 and rewrite

# apache2ctl -M

Now list your php modules with

# php -m

If you missing anything, you add use zypper to install em.

 

drop a phpinfo test file on apache root.

vi testme.php

<?php
phpinfo();
?>

should work.

Running apache2 under daemontools

Sunday, 21 March 2010 20:58
Prerequisite: Debian 5.0, apache2

mkdir -m 1755 /var/service/apache2
mkdir -p -m 755 /var/service/apache2/log
cd /var/service/apache2

vim run

#!/bin/sh
export APACHE_RUN_USER=www-data
export APACHE_RUN_GROUP=www-data
export APACHE_PID_FILE=/var/run/apache2.pid
exec /usr/sbin/apache2 -DNO_DETACH

chmod 755 run
cd log
wget -O run
http://qmail.jms1.net/scripts/service-any-log-run
chmod 755 run

Stop the startup script:
/etc/init.d/apache2 stop
sysv-rc-conf

The following commands will create the symbolic links needed to start the service.

ln -s /var/service/apache2 /service/
sleep 5
svstat /service/apache2 /service/apache2/log

I know this have been written about a billion times, now it’s 1 billion + 1.  This is more for a ref for me…

Grab latest apache/php.

1).  Compile apache

./configure –prefix=/usr/local/apache2 –enable-so –with-ssl –with-zlib

make; make install

Start apache and then stop apache.  Make sure its’ all golden..

2) php time

‘./configure’ ‘–prefix=/usr/local/php5’ ‘–with-apxs2=/usr/local/apache2/bin/apxs’ ‘–with-mysql’ ‘–with-pear’ ‘–with-openssl’ ‘–with-xml’ ‘–enable-bcmath’ ‘–enable-calendar’ ‘–with-curl’ ‘–enable-ftp’ ‘–with-gd’ ‘–enable-sockets’ ‘–enable-track-vars’ ‘–enable-versioning’ ‘–with-zlib’ ‘–enable-magic-quotes’ ‘–with-freetype’ ‘–enable-mbstring’ ‘–with-db4=/usr’ ‘–with-ldap=/usr’ ‘–with-libxml-dir=/usr’ ‘–with-snmp=/usr’ ‘–enable-soap’ ‘–enable-zip’ ‘–with-imap-ssl=/usr’ ‘–with-imap’ ‘–with-kerberos''--with-gettext=shared‘

Adding gettext, it’s needed for phpldapadmin.

Linux users that compile PHP --with-gettext=shared should include
extension=gettext.so

in your /etc/php.ini

Was interesting with imap and kerberos, as the linkers were getting confused between the 32bit and x64 libs which was causing issues with the libc-client.a lib.  Ended up installing the libc-client.a x64 version then just symlinking to the /usr/lib

ln -s /usr/lib64/libc-client.a /usr/lib/

After that it may error out one more time on the ./configure, just install pam-devel with that it will also install a bunch of more *devel stuff, do it.  Configure should finally finish..

make; make test

(takes a while…make test not necessary)

make install

 

3).. If you forget something in PHP and need to re-compile.   You re-run ;   make clean; re-run ./configure with all w/ options; make; make install.    Then just restart apache that should enable whatever you just compile in.

4).  cp php.ini-development  /usr/local/lib/php.ini

5).  vi httpd.conf  add

6). restart apache. that’s it. test via phpinfo.php

phpinfo.php
<?php
phpinfo();
?>