DaemonForums  

Go Back   DaemonForums > OpenBSD > OpenBSD General

OpenBSD General Other questions regarding OpenBSD which do not fit in any of the categories below.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 20th July 2009
badguy badguy is offline
Fdisk Soldier
 
Join Date: Jul 2009
Location: MD, USA
Posts: 59
Thanked 0 Times in 0 Posts
Default Problem getting php running

i trying to get php set up on openbsd4.5. i already installed php5-core. the install file say to create a symbolic link to /var/www/conf/modules/ which i already did.

i also create the index.php file with the content below to test that php is running
< ?php
phpinfo()
?>

when i try to view apache (http://localhost) from my web browser it still shows me apache welcome page. if i try (http://localhost/php.index) it just opens the file content and if i try (http://localhost/php.index/) it shows a broken link error.

i assume there is more that needs to be done and not just install the php5-core but i cant seem to figure out what next. pls how do i get php up and running
Reply With Quote
  #2   (View Single Post)  
Old 20th July 2009
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 3,710
Thanked 214 Times in 189 Posts
Default

You will need to edit /var/www/conf/httpd.conf, and enable the php mime-type by uncommenting:
Code:
#AddType application/x-httpd-php .php
You will also likely want to run Apache without the default chrooted environment. You will need to read FAQ 10.16.
Reply With Quote
  #3   (View Single Post)  
Old 20th July 2009
badguy badguy is offline
Fdisk Soldier
 
Join Date: Jul 2009
Location: MD, USA
Posts: 59
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by jggimi View Post
You will need to edit /var/www/conf/httpd.conf, and enable the php mime-type by uncommenting:
Code:
#AddType application/x-httpd-php .php
You will also likely want to run Apache without the default chrooted environment. You will need to read FAQ 10.16.
ok so to run apache with out chroot i have edited the rc.conf to reflect >> httpd=-u. is this correct?

Also i am trying to edit the /var/www/conf/httpd.conf file using vi but i get the error read-only file, not written. i stopped apache and it stil did not help. any idea what is accessing the file to prevent me from editing it?
Reply With Quote
  #4   (View Single Post)  
Old 20th July 2009
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 3,710
Thanked 214 Times in 189 Posts
Default

Quote:
Originally Posted by badguy View Post
ok so to run apache with out chroot i have edited the rc.conf to reflect >> httpd=-u. is this correct?
No.

First, rc.conf contains only environment variables used by rc(8), it is not an executable script; local execution is done in rc.local(8).

Second, while there is an httpd related environment variable associated with Apache execution by rc(8), the variable is "httpd_flags".

Third, the best practice is to make local variable changes in rc.conf.local(5), rather than in rc.conf itself; as rc.conf is a system file subject to change during upgrades.
Quote:
Also i am trying to edit the /var/www/conf/httpd.conf file using vi but i get the error read-only file, not written. i stopped apache and it stil did not help. any idea what is accessing the file to prevent me from editing it?
A file marked read-only is ... read only. To override and save a new copy from vi(1), use the "w!" command, rather than the "w" command.
Reply With Quote
  #5   (View Single Post)  
Old 20th July 2009
badguy badguy is offline
Fdisk Soldier
 
Join Date: Jul 2009
Location: MD, USA
Posts: 59
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by jggimi View Post
No.

First, rc.conf contains only environment variables used by rc(8), it is not an executable script; local execution is done in rc.local(8).

Second, while there is an httpd related environment variable associated with Apache execution by rc(8), the variable is "httpd_flags".

Third, the best practice is to make local variable changes in rc.conf.local(5), rather than in rc.conf itself; as rc.conf is a system file subject to change during upgrades.A file marked read-only is ... read only. To override and save a new copy from vi(1), use the "w!" command, rather than the "w" command.
worked fine. i got the php up. tanx
Now let me digest all the first second & third explanation above bcos it seems like greek to me. lol
Reply With Quote
  #6   (View Single Post)  
Old 20th July 2009
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 3,710
Thanked 214 Times in 189 Posts
Default

During a normal boot, the kernel probes your hardware (white text on blue background appears), then starts init(8). Init runs the rc(8) script -- it's a script you should look at some time, when you're bored -- the file is /etc/rc. When output switches from white-on-blue to white-on-black, you are seeing output from rc.

The rc script mounts partitions, configures and starts your network, starts daemons (background services, such as Apache), enables the console for log in, makes configuration settings .... and any other tasks need to prepare the OS for use.

rc uses a bunch of variables, which it reads from /etc/rc.conf, which describes settings that control what rc does. One example is the "httpd_flags" variable. By default, this is set to "NO", which tells rc not to start the Apache webserver.

After reading /etc/rc.conf, and setting variables, rc will then look for and read in /etc/rc.conf.local, if the file exists, and reset any variables accoring to the value(s) found in that file. So /etc/rc.conf.local settings *override* settings in /etc/rc.conf.

For 3rd party applications that have daemons, the rc.conf and rc.conf.local files are not used, as these only contain variables which rc knows about -- settings associated with built-in daemons, primarily.

After rc has completed running, it launches /etc/rc.local. The rc.local script is where you put 3rd party daemon startup commands, since rc.conf or rc.conf.local are not used.
Reply With Quote
  #7   (View Single Post)  
Old 22nd July 2009
badguy badguy is offline
Fdisk Soldier
 
Join Date: Jul 2009
Location: MD, USA
Posts: 59
Thanked 0 Times in 0 Posts
Default

Hi jggimi, just want to get something clear.

After creating my rc.conf.local i realized that performing an #apachetl graceful gave an error. it started but gave an error as follows

# apachectl graceful
/usr/sbin/apachectl: /etc/rc.conf.local[107]: .: /etc/rc.conf.local: Too many open files
/usr/sbin/apachectl graceful: httpd gracefully restarted

searching for a solution, i found that you have to delete the last 2 lines or comment them as follows. this worked as i did not get the error message again but why is this the case

#local_rcconf="/etc/rc.conf.local"

# [ -f ${local_rcconf} ] && . ${local_rcconf} # Do not edit this line
Reply With Quote
  #8   (View Single Post)  
Old 22nd July 2009
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 3,710
Thanked 214 Times in 189 Posts
Default

Just like rc(8), apachectl acquires httpd_flag settings from rc.conf(8). rc.conf will source variables from rc.conf.local if it exists (the last two lines of rc.conf or rc.conf.local that you have commented out perform that function).

You have a recursion problem. My guess is that you copied rc.conf to rc.conf.local. That is not a valid rc.conf.local configuration. rc.conf.local should only contain local changes to rc(8) variables. For example, if on installation of OpenBSD, you elected not to have an sshd(8) service running, the install script will create a one-line rc.conf.local file containing sshd_flags=NO.

If you intend to use rc.conf.local, which is a best practice, please ensure that /etc/rc.conf is in the exact state it had when originally installed, and place only your local changes in rc.conf.local.

If you need to restore /etc/rc.conf, here is a link to a copy of rc.conf for 4.5-release:
http://www.openbsd.org/cgi-bin/cvsweb/~checkout~/src/etc/rc?rev=1.321;content-type=text%2Fplain

And in case you are using 4.4-release, here is a link to that version:
http://www.openbsd.org/cgi-bin/cvsweb/~checkout~/src/etc/rc?rev=1.318;content-type=text%2Fplain
Reply With Quote
Reply

Thread Tools
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Running as a WPA-RADIUS AP? Sunnz OpenBSD Security 7 23rd September 2009 02:09 AM
Netbeans running application problem. bsdnewbie999 Programming 4 12th June 2009 10:22 AM
Running your own web server JMJ_coder General software and network 28 13th February 2009 01:15 AM
Problems running jdk-1.7 incripshin OpenBSD Packages and Ports 10 10th August 2008 05:54 PM
Cron running but not working stukov Other BSD and UNIX/UNIX-like 26 24th July 2008 01:17 PM


All times are GMT. The time now is 02:43 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick