Re: apache 1.3.29 + PHP 5.2.6 on OpenBSD 4.4

2008-11-17 Thread Johan Beisser
Did you turn off chroot?

Also, why is Starting Pure-FTPd in the log?


On 11/16/08, Andrei Pirvan [EMAIL PROTECTED] wrote:
 Hello

 The problem I have is that default apache can't load PHP module. PHP
 was installed from packages (php5-core-5.2.6.tgz), so here is nothing
 custom made. The only error I have is when I try to start apache is
 when I make a configtest.

 # apachectl configtest
 Starting Pure-FTPd
 Processing config directory: /var/www/conf/modules/*.conf
  Processing config file: /var/www/conf/modules/php5.conf
 Syntax error on line 1 of /var/www/conf/modules/php5.conf:
 Cannot load /usr/local/lib/php/libphp5.so into server: Cannot load
 specified object

 Both httpd and php works well separately , and
 /usr/local/lib/php/libphp5.so exists.



-- 
Sent from my mobile device



Re: apache 1.3.29 + PHP 5.2.6 on OpenBSD 4.4

2008-11-17 Thread Richard Toohey

On 17/11/2008, at 7:37 PM, Andrei Pirvan wrote:


1. Why does it say Starting Pure-FTPd? Have no ideea. Anyway,
Pure-FTPd is already installed on the system, but don't know why it
shows here.


[snip]

Let's go back to the Pure-FTPd - is your apachectl shell script broken?

/usr/sbin/apachectl

 27 # the path to your httpd binary, including options if necessary
 28 HTTPD=/usr/sbin/httpd

That line 28 is correct on your system?

What happens if you do without apachectl? e.g.

# /usr/sbin/httpd -t
Processing config directory: /var/www/conf/modules/*.conf
 Processing config file: /var/www/conf/modules/php5.conf
Syntax OK



Re: apache 1.3.29 + PHP 5.2.6 on OpenBSD 4.4

2008-11-17 Thread Girish Venkatachalam
On 02:01:19 Nov 17, Daniel Ouellet wrote:


 This doesn't apply here because the library is pre-loaded before the  
 httpd is chrooted.

 More details:

 Pre-loading Shared Libraries

 To extend the functionality of the webserver it can dynamically load  
 shared libraries, e.g. a database access library. Shared libraries for a  
 binary program are normally loaded by the runtime linker when the  
 program is invoked (and thus before it can call the chroot system call).  
 Thus shared libraries like the mod_php PHP4 module, which is linked as a  
 shared library to the httpd program when it is started, impose no  
 problem. PHP4 will be available whether your httpd is started chrooted  
 or not because the shared library is loaded before the chroot() system  
 call is invoked. PHP4 itself, however, does dynamically load additional  
 functionality at runtime and as needed. If you try to access a  
 PostgreSQL function in PHP4 e.g. then it will fail in a chrooted httpd  
 because only the PHP4 module is dynamically linked to httpd but not the  
 PostgreSQL client library. The latter is loaded (mapped) to the running  
 httpd executable by PHP4.

 This was for php4 but also apply to php5 as the modules are loaded  
 before the chrooted take place.

 Hope this help this a little and to avoid users to run httpd with -u.

Thanks. ;)

I did not know this.

-Girish



Re: apache 1.3.29 + PHP 5.2.6 on OpenBSD 4.4

2008-11-17 Thread Andrei Pirvan
Thanks to all of you for ideas. Trying to figure out what was different
from a fresh install, I remembered that I mounted /var partition in
memory, so I checked the flags and found it it was mounted with noexec,
and disabling that fixed my problem. Thanks again for your time.



Re: apache 1.3.29 + PHP 5.2.6 on OpenBSD 4.4

2008-11-17 Thread L. V. Lammert
On Mon, 17 Nov 2008, Andrei Pirvan wrote:

 Hello

 # apachectl configtest
 Starting Pure-FTPd
 Processing config directory: /var/www/conf/modules/*.conf
  Processing config file: /var/www/conf/modules/php5.conf
 Syntax error on line 1 of /var/www/conf/modules/php5.conf:
 Cannot load /usr/local/lib/php/libphp5.so into server: Cannot load
 specified object


In 4.3, is not the default apache module location:

/usr/lib/apache/modules/libphp5.so

[That's where it lives on our servers, ..]

Lee

==
 Leland V. Lammert[EMAIL PROTECTED]
  Chief ScientistOmnitec Corporation
 Network/Internet Consultants www.omnitec.net
==



Re: apache 1.3.29 + PHP 5.2.6 on OpenBSD 4.4

2008-11-17 Thread Daniel Ouellet

Girish Venkatachalam wrote:

On 02:01:19 Nov 17, Daniel Ouellet wrote:


This doesn't apply here because the library is pre-loaded before the  
httpd is chrooted.


More details:

Pre-loading Shared Libraries

To extend the functionality of the webserver it can dynamically load  
shared libraries, e.g. a database access library. Shared libraries for a  
binary program are normally loaded by the runtime linker when the  
program is invoked (and thus before it can call the chroot system call).  
Thus shared libraries like the mod_php PHP4 module, which is linked as a  
shared library to the httpd program when it is started, impose no  
problem. PHP4 will be available whether your httpd is started chrooted  
or not because the shared library is loaded before the chroot() system  
call is invoked. PHP4 itself, however, does dynamically load additional  
functionality at runtime and as needed. If you try to access a  
PostgreSQL function in PHP4 e.g. then it will fail in a chrooted httpd  
because only the PHP4 module is dynamically linked to httpd but not the  
PostgreSQL client library. The latter is loaded (mapped) to the running  
httpd executable by PHP4.


This was for php4 but also apply to php5 as the modules are loaded  
before the chrooted take place.


Hope this help this a little and to avoid users to run httpd with -u.


Thanks. ;)

I did not know this.

-Girish



Well,

Glad it helped you and clear this up for many others too. I wish I could 
take credit for this explication, but I can't. I knew about it, but 
never been really totally clear to me. I guess it's one of these things 
you know, witho9ut really knowing it fully, but just know it worked.


The first time it actually was put clear in my mind is from Jason Dixon 
article on his changes with PERL modules in httpd.


It's been publish here on undeadly:

http://www.undeadly.org/cgi?action=articlesid=20080805194342

This cleared stuff for me that I knew, but really couldn't explain, so 
one would say, in that case, not really knowing it. (;


You may want to read the article. Not very long, and pretty good and 
there is more to it then what hit the eyes there if you sit back and 
think about it.


This made me think about it in a different way and actually clear that 
totally for me then.


There is a lots of good articles on undeadly time to time that really 
are worth more then the time it takes to read them.


You never know when they will apply in the future. (;

So, the credit really goes to Jason Dixon for opening my eyes on the 
issue with his article.


Best,

Daniel



Re: apache 1.3.29 + PHP 5.2.6 on OpenBSD 4.4

2008-11-16 Thread Richard Toohey

On 17/11/2008, at 7:04 PM, Andrei Pirvan wrote:


Hello

The problem I have is that default apache can't load PHP module. PHP
was installed from packages (php5-core-5.2.6.tgz), so here is nothing
custom made. The only error I have is when I try to start apache is
when I make a configtest.

# apachectl configtest
Starting Pure-FTPd
Processing config directory: /var/www/conf/modules/*.conf
 Processing config file: /var/www/conf/modules/php5.conf
Syntax error on line 1 of /var/www/conf/modules/php5.conf:
Cannot load /usr/local/lib/php/libphp5.so into server: Cannot load
specified object

Both httpd and php works well separately , and
/usr/local/lib/php/libphp5.so exists.


Works for me on 4.4 i386 (upgraded from 4.3 boxes, only issue was with
libm when I upgraded before 4.4 was officially released - apache  
fine, PHP CLI

fine, together no-go until 4.3 packages upgraded to 4.4 packages.)

Why does it say Starting Pure-FTPd?

Nothing in the httpd error log?

What is the history of the machine?  Upgraded from previous release?   
Fresh install?

If an upgrade did you follow all instructions correctly?

What's in your config files outside the ordinary?



Re: apache 1.3.29 + PHP 5.2.6 on OpenBSD 4.4

2008-11-16 Thread Daniel Ouellet

Andrei Pirvan wrote:

Hello

The problem I have is that default apache can't load PHP module. PHP
was installed from packages (php5-core-5.2.6.tgz), so here is nothing
custom made. The only error I have is when I try to start apache is
when I make a configtest.


Was that an install from scratch, meaning new, or an upgrade of a 
previous running OpenBSD?


Between 4.3 and 4.4 some changes were done in the way modules are loaded.

What's your first line of php5.conf

*
# head -1 /var/www/conf/modules/php5.conf
LoadModule php5_module /usr/local/lib/php/libphp5.so
*



Re: apache 1.3.29 + PHP 5.2.6 on OpenBSD 4.4

2008-11-16 Thread Daniel Ouellet

Andrei Pirvan wrote:

Hello

The problem I have is that default apache can't load PHP module. PHP
was installed from packages (php5-core-5.2.6.tgz), so here is nothing
custom made. The only error I have is when I try to start apache is
when I make a configtest.


Do you have something showing up or nothing when you do:

cat /var/www/conf/httpd.conf | grep 'LoadModule php'

This would tell you if you use the old modules way or the new way, 
meaning possibly an incomplete upgrade.


So, what's the results and also as it was pointed out to you as well. 
Why do it say Starting Pure-FTPd, this is sure not the default installed.


So, there is more informations required to help you that you do not 
provide, but never the less, what you got so far should definitely be 
helpful if you look more closely.


Best,

Daniel



Re: apache 1.3.29 + PHP 5.2.6 on OpenBSD 4.4

2008-11-16 Thread Andrei Pirvan
1. Why does it say Starting Pure-FTPd? Have no ideea. Anyway,
Pure-FTPd is already installed on the system, but don't know why it
shows here.

2. Nothing in the httpd error log?
# tail /var/www/logs/error_log  
[Sat Nov 15 00:19:04 2008] [error] [client 192.168.1.2] file permissions
deny server execution: /cgi-bin/bgplg
[Sat Nov 15 00:19:16 2008] [error] [client 192.168.1.2] File does not
exist: /htdocs/c
[Sat Nov 15 01:15:16 2008] [notice] caught SIGTERM, shutting down
[Mon Nov 17 08:38:52 2008] [notice] Initializing etag
from /var/www/logs/etag-state
[Mon Nov 17 08:38:52 2008] [notice] chrooted in /var/www
[Mon Nov 17 08:38:52 2008] [notice] changed to uid 67, gid 67
[Mon Nov 17 08:38:52 2008] [notice] Apache configured -- resuming normal
operations
[Mon Nov 17 08:38:52 2008] [notice] Accept mutex: sysvsem (Default:
sysvsem)
[Mon Nov 17 08:38:57 2008] [error] [client 127.0.0.1] File does not
exist: /htdocs/server-status
[Mon Nov 17 08:39:56 2008] [notice] caught SIGTERM, shutting down

3. What is the history of the machine?  Upgraded from previous release?
Fresh install? 
Yes, It's a fresh install on this machine.

4. What's in your config files outside the ordinary? 
Just a few lines in httpd.conf to disable directory listing.
Options -Indexes

Directory /
Options FollowSymLinks
AllowOverride None
/Directory

Directory /var/www/htdocs/pub
Options +Indexes
AllowOverride None
/Directory

5. What's your first line of php5.conf 
# head -1 /var/www/conf/modules/php5.conf   
LoadModule php5_module /usr/local/lib/php/libphp5.so

6. Do you have something showing up or nothing when you do: 
cat /var/www/conf/httpd.conf | grep 'LoadModule php' 
Here I get nothing.

Thanks for replies.



Re: apache 1.3.29 + PHP 5.2.6 on OpenBSD 4.4

2008-11-16 Thread Girish Venkatachalam
On 08:04:25 Nov 17, Andrei Pirvan wrote:
 Hello
 
 The problem I have is that default apache can't load PHP module. PHP
 was installed from packages (php5-core-5.2.6.tgz), so here is nothing
 custom made. The only error I have is when I try to start apache is
 when I make a configtest.
 
 # apachectl configtest  
 Starting Pure-FTPd
 Processing config directory: /var/www/conf/modules/*.conf
  Processing config file: /var/www/conf/modules/php5.conf
 Syntax error on line 1 of /var/www/conf/modules/php5.conf:
 Cannot load /usr/local/lib/php/libphp5.so into server: Cannot load
 specified object
 
 Both httpd and php works well separately , and
 /usr/local/lib/php/libphp5.so exists.
 

Try the httpd -u switch to run it outside /var/www chroot.

You could insert this into /etc/rc.conf.local.

The apache modules live in /usr/local/lib and is consequently outside
the chroot.

-Girish



Re: apache 1.3.29 + PHP 5.2.6 on OpenBSD 4.4

2008-11-16 Thread Andrei Pirvan
Try the httpd -u switch to run it outside /var/www chroot. 

# httpd -u
Syntax error on line 1 of /var/www/conf/modules/php5.conf:
Cannot load /usr/local/lib/php/libphp5.so into server: Cannot load
specified object

Anyway, afaik the chroot is applied after loading the modules.



Re: apache 1.3.29 + PHP 5.2.6 on OpenBSD 4.4

2008-11-16 Thread Daniel Ouellet

Try the httpd -u switch to run it outside /var/www chroot.



This doesn't apply here because the library is pre-loaded before the 
httpd is chrooted.


More details:

Pre-loading Shared Libraries

To extend the functionality of the webserver it can dynamically load 
shared libraries, e.g. a database access library. Shared libraries for a 
binary program are normally loaded by the runtime linker when the 
program is invoked (and thus before it can call the chroot system call). 
Thus shared libraries like the mod_php PHP4 module, which is linked as a 
shared library to the httpd program when it is started, impose no 
problem. PHP4 will be available whether your httpd is started chrooted 
or not because the shared library is loaded before the chroot() system 
call is invoked. PHP4 itself, however, does dynamically load additional 
functionality at runtime and as needed. If you try to access a 
PostgreSQL function in PHP4 e.g. then it will fail in a chrooted httpd 
because only the PHP4 module is dynamically linked to httpd but not the 
PostgreSQL client library. The latter is loaded (mapped) to the running 
httpd executable by PHP4.


This was for php4 but also apply to php5 as the modules are loaded 
before the chrooted take place.


Hope this help this a little and to avoid users to run httpd with -u.

Best,

Daniel



Re: apache 1.3.29 + PHP 5.2.6 on OpenBSD 4.4

2008-11-16 Thread Gábri Máté
2008/11/17 Andrei Pirvan [EMAIL PROTECTED]

 1. Why does it say Starting Pure-FTPd? Have no ideea. Anyway,
 Pure-FTPd is already installed on the system, but don't know why it
 shows here.

 2. Nothing in the httpd error log?
 # tail /var/www/logs/error_log
 [Sat Nov 15 00:19:04 2008] [error] [client 192.168.1.2] file permissions
 deny server execution: /cgi-bin/bgplg
 [Sat Nov 15 00:19:16 2008] [error] [client 192.168.1.2] File does not
 exist: /htdocs/c
 [Sat Nov 15 01:15:16 2008] [notice] caught SIGTERM, shutting down
 [Mon Nov 17 08:38:52 2008] [notice] Initializing etag
 from /var/www/logs/etag-state
 [Mon Nov 17 08:38:52 2008] [notice] chrooted in /var/www
 [Mon Nov 17 08:38:52 2008] [notice] changed to uid 67, gid 67
 [Mon Nov 17 08:38:52 2008] [notice] Apache configured -- resuming normal
 operations
 [Mon Nov 17 08:38:52 2008] [notice] Accept mutex: sysvsem (Default:
 sysvsem)
 [Mon Nov 17 08:38:57 2008] [error] [client 127.0.0.1] File does not
 exist: /htdocs/server-status
 [Mon Nov 17 08:39:56 2008] [notice] caught SIGTERM, shutting down

 3. What is the history of the machine?  Upgraded from previous release?
 Fresh install?
 Yes, It's a fresh install on this machine.

 4. What's in your config files outside the ordinary?
 Just a few lines in httpd.conf to disable directory listing.
 Options -Indexes

 Directory /
Options FollowSymLinks
AllowOverride None
 /Directory

 Directory /var/www/htdocs/pub
Options +Indexes
AllowOverride None
 /Directory

 5. What's your first line of php5.conf
 # head -1 /var/www/conf/modules/php5.conf
 LoadModule php5_module /usr/local/lib/php/libphp5.so

 6. Do you have something showing up or nothing when you do:
 cat /var/www/conf/httpd.conf | grep 'LoadModule php'
 Here I get nothing.

 Thanks for replies.


Is there a new line character at the end of this line:

LoadModule php5_module /usr/local/lib/php/libphp5.so

It could cause the syntax error problem.



Re: apache 1.3.29 + PHP 5.2.6 on OpenBSD 4.4

2008-11-16 Thread Andrei Pirvan
Is there a new line character at the end of this line: 
 
LoadModule php5_module /usr/local/lib/php/libphp5.so 

Removed the line, but still no luck, I get the same error.



Re: apache 1.3.29 + PHP 5.2.6 on OpenBSD 4.4

2008-11-16 Thread Daniel Ouellet

Andrei Pirvan wrote:

1. Why does it say Starting Pure-FTPd? Have no ideea. Anyway,
Pure-FTPd is already installed on the system, but don't know why it
shows here.


May be you have a link, or modules for it in your configuration:

# ls -la /var/www/conf/modules/
total 8
drwxr-xr-x   2 root  daemon  512 Sep  5 17:40 .
drwxr-xr-x  11 root  daemon  512 Sep  5 17:37 ..
lrwxr-xr-x   1 root  daemon   38 Sep  5 17:40 php5.conf - 
/var/www/conf/modules.sample/php5.conf


If you don't know why it's there or you don't need it, may be you should 
try to figure out why you have it then.



2. Nothing in the httpd error log?
# tail /var/www/logs/error_log  
[Mon Nov 17 08:38:57 2008] [error] [client 127.0.0.1] File does not

exist: /htdocs/server-status


Looks like you try to configure the status server and it's not configure 
right.


Default is:

#
# Allow server status reports, with the URL of 
http://servername/server-status

# Change the .your_domain.com to match your domain to enable.
#
#Location /server-status
#SetHandler server-status
#Order deny,allow
#Deny from all
#Allow from .your_domain.com
#/Location


Would you try to run that as /htdocs/server-status by any chance in a 
chroot with a different document directory setup?


#Location /htdocs/server-status
#SetHandler server-status
#Order deny,allow
#Deny from all
#Allow from .your_domain.com
#/Location

More and more it start to look to me not as a default setup.


3. What is the history of the machine?  Upgraded from previous release?
Fresh install? 
Yes, It's a fresh install on this machine.


Then you should know why Pure-FTPd is trying to start by default then as 
it's not in the default install here.


5. What's your first line of php5.conf 
# head -1 /var/www/conf/modules/php5.conf   
LoadModule php5_module /usr/local/lib/php/libphp5.so


Anything at the end of the line?

Delete and retype manually just to see. Or cut and paste from a good line.

Best,

Daniel