Starting Apache directly

aicul

Registered
I have installed PHP and mySQL. They both work. However, I must always manually start PHP (apache) everytime I restart the mac.

I use:

sudo /usr/sbin/apachectl start

The account has no password as the mac is not connected to the web.

Is there some placeI can tell mac to start PHP automatically?

Thanks
 
Edit your hostconfig file (in /etc/) and change the line "WEBSERVER=-NO-" to "WEBSERVER=-YES-". This will make inet.d start apache when your boot the computer.
 
Or you could go to system preferences, click on sharing, and make sure that personal web sharing is checked.

Which ever way you prefer :)
 
I tried the websharing and that did not work. Either via unix or the clickable menus.

I was wondering if there is some unix file that contains a list of startup items? Where I can just paste in my command?
 
What happened when you clicked on the personal web sharing check box? Did apache start?

And when you tried to edit the /etc/hostconfig how did you do it? This file by default is read only, so in order to make changes to it you need to either be su or use sudo.

eg) sudo vim /etc/hostconfig

or sudo pico /etc/hostconfig if you arent familiar with vim.

Good luck.
 
I actually changed the permissions on the file.
Then I made a logical link to the file onto my desktop.
I used textedit to modify the file.

I try to avoid Unix 100%, I bought a mac, the WYSIWYG machine that is user friendly.

Is there really no place in unix where I can define startup commands. I'm sure that the webserver solution is the most logical. But as it does not work.

Maybe its how I installed php, maybe something else. Honestly, I just want the command sudo /usr/sbin/apachectl start executed as soon as the mac os is running. Whether this is the "best practice" solution is not my concern.

Concerning the webserver clickable menu option, I will try again and get back to you with a precise description of what happens.
 
aicul said:
I actually changed the permissions on the file.
Then I made a logical link to the file onto my desktop.
I used textedit to modify the file.

I try to avoid Unix 100%, I bought a mac, the WYSIWYG machine that is user friendly.

Is there really no place in unix where I can define startup commands. I'm sure that the webserver solution is the most logical. But as it does not work.

Maybe its how I installed php, maybe something else. Honestly, I just want the command sudo /usr/sbin/apachectl start executed as soon as the mac os is running. Whether this is the "best practice" solution is not my concern.

Concerning the webserver clickable menu option, I will try again and get back to you with a precise description of what happens.

If you try to avoid unix 100%, you shouldn't be running apache and php [/sarcastic comment] ;)

As specified earlier, you should enable "Personal Web Sharing" in the Sharing control panel. That will start Apache in the boot process.
 
ksv said:
If you try to avoid unix 100%, you shouldn't be running apache and php [/sarcastic comment] ;)

As specified earlier, you should enable "Personal Web Sharing" in the Sharing control panel. That will start Apache in the boot process.


The fact is, once PHP runs YOU DO NOT NEED TO KNOW UNIX. So why the sarcastic comment? Maybe for mySQL, but not for PHP.

What surprises me is that a system such as unix does not have some type of file that is executed at startup where one can place commands that he wishes to use. I thought such an advanced system as unix would have such a facility. Are you all telling me this does not exist in unix?

I really wish that expert users of mac OS X (the ones that are unix specialists) would realize that MAC commes from the non IT specialized world, where the system did everything for you, with elegance. So sarcastic comments emphasing UNIX competence are, in my eyes, not due. [/statement from the heart]

Anyone care to tell me if unix has a startup file in which I can enter commands?
 
aicul said:
Anyone care to tell me if unix has a startup file in which I can enter commands?

It does, and the one to use for starting apache is /etc/hostconfig .
If that doesn't work, something else is wrong.

The easiest and cleanest way to run a command at startup is adding a simple script in /Library/StartupItems . I made this little installer to do that automatically :)
 

Attachments

  • startapache.pkg.zip
    6.7 KB · Views: 7
You say that the system prefpane doesn't do it for you, but it does it for me. I wonder, did you install Apache 2? It goes in a different place than 1 and wouldn't be started by the prefpane, but 1 would.

I, like you, just want to use the damn thing. I have mySQL running, with php and apache1 and don't have to do anything. It runs smooth as silk. I installed mySQL from complete, but used the older entropy package for php, because the complete php wanted apache2.

Maybe a catalog of your versions might help clear things up.
 
Its been some time but here I am back again.

I tried the startupapache tool by KSV. It works. So thanks.

I did some investigations based on the result of the KSV tool. It would seem that websharing would have worked if the following had been respected.

1. Websharing must be activated on at least one admin account.
2. Websharing must be activated on the account being used to do php.

Failure to do this implies php will not work.

As per the sensible question on php I did check this, but presently I forget (sorry).
 
Back
Top