Re: 5.2 amd64 php and apache problem

2013-02-09 Thread ole
Hi Matthias

I dont know if this is any help to you,
but I managed to get my php/mysql running by following 
the guide at: 
http://www.h-i-r.net/2009/10/oamp-openbsd-46-chroot-apache-mysql-php.html
it worked for 5.2 as well.

From that information I also made a small startup script:

sudo rm /var/www/var/run/mysql/mysql.sock
sudo ln /var/run/mysql/mysql.sock /var/www/var/run/mysql/mysql.sock 
sudo apachectl start

Hope this helps /Ole


On Mon, 04 Feb 2013 18:40:48 +0100
Matthias Appel appel.matth...@gmail.com wrote:

 Hi List,
 
 I have a problem with apache and php and hope you guys (and gals!) can 
 help me.
 
 This is what I did/tried up to now.
 
 Activated apache, enabled ssl and changed config, so apache is reachable 
 via IPv4 and v6...no further changes to httpd.conf
 
 Installed php-5.3.14p1.tgz and create the syslink as I were told (as far 
 as I can see, there should be no necessity to do further 
 configuration...or am I wrong?)
 
 created a php script consisting of:
 
 # cd /var/www/cgi-bin/
 # cat phpinfo.php
 ? phpinfo(); ?
 #
 
 
 When I navigate to the phpinfo.php script, I get an error 500 and the 
 log tells me this:
 
 [Mon Feb  4 18:27:01 2013] [error] (8)Exec format error: exec of 
 /var/www/cgi-bin/phpinfo.php failed
 [Mon Feb  4 18:27:01 2013] [error] [client ] Premature end of script 
 headers: /var/www/cgi-bin/phpinfo.php
 [Mon Feb  4 18:27:01 2013] [error] [client ] File does not exist: 
 /var/www/htdocs/favicon.ico
 
 
 As far as I can see, the webserver tries to run the script like a binary 
 cause of the missing shebang.
 Why doesn't he run it like a php script, as supposed?
 
 I dont know, how to tell apache to run the php script...IMHO this should 
 be sufficient to tell him so:
 
 # cat /var/www/conf/modules/php.conf
 LoadModule php5_module /usr/local/lib/php-5.3/libphp5.so
 
 IfModule mod_php5.c
  AddType application/x-httpd-php .php .phtml .php3
  AddType application/x-httpd-php-source .phps
 # Most php configs require this
  DirectoryIndex index.php
 /IfModule
 #
 
 
 I even disabled chroot (I expected no difference but I was desperate 
 enough to try) and changed the permissions to the relaxed settings 
 possible (test-cgi runs fine)
 # ls -lh /var/www/cgi-bin/
 total 288
 --  1 root  bin   137K Aug  1  2012 bgplg
 -rwxrwx---  1 www   www17B Feb  3 22:27 phpinfo.php
 --  1 root  bin   268B Aug  1  2012 printenv
 -rwxrwx---  1 www   www   757B Aug  1  2012 test-cgi
 #
 
 Can anybody help me to get this php thing working, I dont want to write 
 my web-scripts in C ;-)
 
 
 Regards,
 
 Matthias
 


-- 
ole ole.hellqv...@gmail.com



Re: 5.2 amd64 php and apache problem

2013-02-09 Thread Stuart Henderson
On 2013-02-09, ole ole.hellqv...@gmail.com wrote:
 Hi Matthias

 I dont know if this is any help to you,
 but I managed to get my php/mysql running by following 
 the guide at: 
 http://www.h-i-r.net/2009/10/oamp-openbsd-46-chroot-apache-mysql-php.html
 it worked for 5.2 as well.

 From that information I also made a small startup script:
 
 sudo rm /var/www/var/run/mysql/mysql.sock
 sudo ln /var/run/mysql/mysql.sock /var/www/var/run/mysql/mysql.sock 

this only works if /var/www/var/run/mysql and /var/run/mysql are on the
same filesystem; it would often be preferable to use a separate filesystem
for /var/www to avoid risk of running out of space for other important
files in /var (particularly /var/log and /var/db).

a cleaner method is given in the pkg-readme for drupal:

--snip--
In order to run with standard OpenBSD chroot'ed httpd:

- make sure you can connect to your database.

Create a directory for the mysql socket.

mkdir -p /var/www/var/run/mysql

Adjust ${SYSCONFDIR}/my.cnf to put the mysql socket into the chroot.

[client]
socket = /var/www/var/run/mysql/mysql.sock

[mysqld]
socket = /var/www/var/run/mysql/mysql.sock
--snip--

 sudo apachectl start

using /etc/rc.d/httpd start is preferred as it ensures that httpd is run
with the correct login class. but with the above method you don't need any
particular script, the standard rc.conf.local changes (i.e. adding mysqld
to pkg_scripts line and setting httpd_flags=) will work.



Re: 5.2 amd64 php and apache problem

2013-02-05 Thread Stuart Henderson
On 2013-02-04, Matthias Appel appel.matth...@gmail.com wrote:
 Activated apache, enabled ssl and changed config, so apache is reachable 
 via IPv4 and v6...no further changes to httpd.conf

 Installed php-5.3.14p1.tgz and create the syslink as I were told (as far 
 as I can see, there should be no necessity to do further 
 configuration...or am I wrong?)

 created a php script consisting of:

 # cd /var/www/cgi-bin/
 # cat phpinfo.php
? phpinfo(); ?
 #

Put this in the htdocs dir, not cgi-bin.



Re: 5.2 amd64 php and apache problem

2013-02-05 Thread Tomasz Marszal
by defeult the /var/www is a directory for chrooted apache and in this
directory is dir htdocs try to place Your script in this directory or
change this directory on other by changing apache behaviour in
conf/httpd.conf
On Mon, 04 Feb 2013 19:54:51 +0100, Matthias Appel
appel.matth...@gmail.com wrote:
 Am 04.02.2013 19:10, schrieb James Shupe:
 Why is that in the cgi-bin directory to begin with? Do you have
 shorttags enabled in php.ini?
 
 As mentioned, it's pretty much vanilla configuration...so i can be sure 
 cgi-bin/ is allowed for script executionbut httpd.conf will be 
 changed, as soon as php is running.
 
 Shorttags are enabled, but I also had a phpinfo.php with full tags, 
 which produced the same error.



5.2 amd64 php and apache problem

2013-02-04 Thread Matthias Appel

Hi List,

I have a problem with apache and php and hope you guys (and gals!) can 
help me.


This is what I did/tried up to now.

Activated apache, enabled ssl and changed config, so apache is reachable 
via IPv4 and v6...no further changes to httpd.conf


Installed php-5.3.14p1.tgz and create the syslink as I were told (as far 
as I can see, there should be no necessity to do further 
configuration...or am I wrong?)


created a php script consisting of:

# cd /var/www/cgi-bin/
# cat phpinfo.php
? phpinfo(); ?
#


When I navigate to the phpinfo.php script, I get an error 500 and the 
log tells me this:


[Mon Feb  4 18:27:01 2013] [error] (8)Exec format error: exec of 
/var/www/cgi-bin/phpinfo.php failed
[Mon Feb  4 18:27:01 2013] [error] [client ] Premature end of script 
headers: /var/www/cgi-bin/phpinfo.php
[Mon Feb  4 18:27:01 2013] [error] [client ] File does not exist: 
/var/www/htdocs/favicon.ico



As far as I can see, the webserver tries to run the script like a binary 
cause of the missing shebang.

Why doesn't he run it like a php script, as supposed?

I dont know, how to tell apache to run the php script...IMHO this should 
be sufficient to tell him so:


# cat /var/www/conf/modules/php.conf
LoadModule php5_module /usr/local/lib/php-5.3/libphp5.so

IfModule mod_php5.c
AddType application/x-httpd-php .php .phtml .php3
AddType application/x-httpd-php-source .phps
# Most php configs require this
DirectoryIndex index.php
/IfModule
#


I even disabled chroot (I expected no difference but I was desperate 
enough to try) and changed the permissions to the relaxed settings 
possible (test-cgi runs fine)

# ls -lh /var/www/cgi-bin/
total 288
--  1 root  bin   137K Aug  1  2012 bgplg
-rwxrwx---  1 www   www17B Feb  3 22:27 phpinfo.php
--  1 root  bin   268B Aug  1  2012 printenv
-rwxrwx---  1 www   www   757B Aug  1  2012 test-cgi
#

Can anybody help me to get this php thing working, I dont want to write 
my web-scripts in C ;-)



Regards,

Matthias



Re: 5.2 amd64 php and apache problem

2013-02-04 Thread James Griffin
-- Matthias Appel appel.matth...@gmail.com [2013-02-04 18:40:48 +0100]:

 Hi List,
 
 I have a problem with apache and php and hope you guys (and gals!)
 can help me.

...

 Can anybody help me to get this php thing working, I dont want to
 write my web-scripts in C ;-)
 
 Regards,
 
 Matthias

I'm sorry this message is not an answer to your problem, as such,
but have you considered using nginx? I think you'll prefer it and
in my experience of it so far it's much nicer to set up.

-- 
Primary Key: 4096R/1D31DC38 2011-12-03
Key Fingerprint: A4B9 E875 A18C 6E11 F46D  B788 BEE6 1251 1D31 DC38



Re: 5.2 amd64 php and apache problem

2013-02-04 Thread James Shupe
Why is that in the cgi-bin directory to begin with? Do you have
shorttags enabled in php.ini?

--
James Shupe

[demime 1.01d removed an attachment of type application/pgp-signature which had 
a name of signature.asc]



Re: 5.2 amd64 php and apache problem

2013-02-04 Thread Matthias Appel

Am 04.02.2013 19:05, schrieb James Griffin:

-- Matthias Appel appel.matth...@gmail.com [2013-02-04 18:40:48 +0100]:


Hi List,

I have a problem with apache and php and hope you guys (and gals!)
can help me.

...


Can anybody help me to get this php thing working, I dont want to
write my web-scripts in C ;-)

Regards,

Matthias

I'm sorry this message is not an answer to your problem, as such,
but have you considered using nginx? I think you'll prefer it and
in my experience of it so far it's much nicer to set up.


Had it on the radar but never tried it.

I think, I'll give it a try.

Thanks for the tip!



Re: 5.2 amd64 php and apache problem

2013-02-04 Thread Matthias Appel

Am 04.02.2013 19:10, schrieb James Shupe:

Why is that in the cgi-bin directory to begin with? Do you have
shorttags enabled in php.ini?


As mentioned, it's pretty much vanilla configuration...so i can be sure 
cgi-bin/ is allowed for script executionbut httpd.conf will be 
changed, as soon as php is running.


Shorttags are enabled, but I also had a phpinfo.php with full tags, 
which produced the same error.