# apache + php... help?

## tscolari

Im trying to install php here, so I can learn it...

but for this I need to install apache...

Someone could teach me how to do these?

I just want to install apache, them php for testing scripts and so

i dont want to make a server for others come, even cuz Im in a lan and it wont be possible by the main server...

Just in few steps, If i type:

emerge apache

emerge 'php' 

it will be working?

how can I start and stop apache? in command line

----------

## splooge

 *tscolari wrote:*   

> Im trying to install php here, so I can learn it...
> 
> but for this I need to install apache...
> 
> Someone could teach me how to do these?
> ...

 

emerge apache2 mod_php

edit /etc/conf.d/apache2 and add -D PHP4 to the APACHE_OPTIONS line.

/etc/init.d/apache2 start to start it

rc-update add apache2 default to make it start automatically when you turn you computer on.

----------

## delta407

 *tscolari wrote:*   

> i dont want to make a server for others come, even cuz Im in a lan and it wont be possible by the main server...

 In this case, to prevent others from getting to your web server, edit your apache2.conf's "IP address" section to look like this:

```
###

### IP Address/Port

###

Listen 127.0.0.1:80

```

Then, point your web browser at http://localhost/, and you're all set.

----------

## tscolari

thanks friends!

Im on the way to download them here hehe

Just other question, what would be the procedure for the mysql installation?

----------

## splooge

If you put mysql in your USE flags it will get installed when you emerge apache mod_php

To start it:

/etc/init.d/mysql start

And to make it start on bootup:

rc-update add mysql default

----------

## delta407

 *tscolari wrote:*   

> Just other question, what would be the procedure for the mysql installation?

 

```
# emerge mysql

# rc-update add mysql default

# rc

(MySQL is now running)
```

All of the previous details involving mysql-install-db and stuff are (apparently) all handled by the MySQL ebuild now. That's handy  :Smile: 

BTW, I highly recommend putting phpMyAdmin on your system if you're doing database-centric web development. It's very handy.

----------

## delta407

 *splooge wrote:*   

> If you put mysql in your USE flags it will get installed when you emerge apache mod_php

 

That's a good point, since if you don't have 'mysql' in your USE flags, the resulting mod_php won't have a MySQL client.

----------

## tscolari

I did a emerge apache mod_php without the mysql in the flags, now Im emerging mysql, will it works?

for phpamin just do a emerge myphpadmin?

Im not been able to start apache here:

 *Quote:*   

> 
> 
> * Starting apache2...
> 
> apache2: Could not determine the server's fully qualified domain name, using 127.0.0.1 for ServerName                      [ !! ]
> ...

 

?

----------

## incubator

thats not a critical error, i got that too because im too lazy to update the ServerName in /etc/apache2/conf/apache2.conf (i think)

but apache starts anywhay  :Smile: 

----------

## tscolari

 *incubator wrote:*   

> thats not a critical error, i got that too because im too lazy to update the ServerName in /etc/apache2/conf/apache2.conf (i think)
> 
> but apache starts anywhay 

 

hehehe

I've changed it there, naming it localhost...

but still no working:

/etc/init.d/apache2 start

* Starting apache2...                                                    [ !! ]

I read the /var/logs/apache2/error_log

and this is the message:

[Thu May 13 08:26:49 2004] [alert] (EAI 2)Name or service not known: mod_unique_id: unable to find IPv4 address of$

Configuration Failed

----------

## delta407

 *tscolari wrote:*   

> I did a emerge apache mod_php without the mysql in the flags, now Im emerging mysql, will it works?

 No, you'll still need to add 'mysql' to your USE flags and re-emerge mod_php. You won't need to download anything new or change any config files, though.

 *tscolari wrote:*   

> for phpamin just do a emerge myphpadmin?

 There is a phpMyAdmin ebuild, though I can't comment on how it works. Short answer: maybe. Long answer: give it a go, see what happens  :Smile: 

----------

## tscolari

Ok, i putted mysql in my userflags and re-emerged the apache mod_php

, mysql seens ok, it starts

but apache doesnt...

aways I try to start it

/etc/init.d/apache2 start 

a [!!] apears (* Starting apache....  [!!])

the error log shows this:

[Thu May 13 17:05:33 2004] [alert] (EAI 2)Name or service not known: mod_unique_id: unable to find IPv4 address of "tiago-lx"

Any idea of what is it?

the tiago-lx is the hostname cuz mysql was complaining about the localhost been diferent of my computer name...

----------

## splooge

I don't remember, but I think that will be fixed if you fix up your /etc/hosts file:

127.0.0.1 localhost tiago-lx

And make sure your /etc/hostname has tiago-lx in it.

Alternately, you could fix it the *wrong* way by commenting out this line in /etc/apache2/conf/apache2.conf:

LoadModule unique_id_module modules/mod_unique_id.so

But I don't recommend that =p

----------

## tscolari

 *splooge wrote:*   

> I don't remember, but I think that will be fixed if you fix up your /etc/hosts file:
> 
> 127.0.0.1 localhost tiago-lx
> 
> And make sure your /etc/hostname has tiago-lx in it.
> ...

 

Thanks friend  :Smile: 

it was the tiago-lx missing in the /etc/hosts 

now it is running!!

----------

## tscolari

 :Sad: 

new problems...

i've emerged apache mod_php

ok.

all done

I went to the /etc/conf.d/apache2

and added -D PHP4 in the relative string...

but when I try to run a php, it only shows the php file source in the browser... how do i configure this php stuff?

----------

## delta407

Did you restart Apache after editing /etc/conf.d/apache2?

----------

## tscolari

 *delta407 wrote:*   

> Did you restart Apache after editing /etc/conf.d/apache2?

 

yes i did  :Sad: 

----------

## delta407

What do the logs say? (/var/log/apache2)

----------

## tscolari

Here are the log from error_log:

 *Quote:*   

> 
> 
> [Thu May 13 17:24:38 2004] [notice] Digest: generating secret for digest authentication ...
> 
> [Thu May 13 17:24:38 2004] [notice] Digest: done
> ...

 

Like, apache is working, when i go to http://127.0.0.1 i see the page and so, but the php isnt on... its displaying the source and not executing it

the other log in the dir (access_log) only says this:

127.0.0.1 - - [13/May/2004:17:57:11 -0300] "GET /phpmyadmin/ HTTP/1.1" 304 - "-" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040506 Firefox/0.8"

----------

## splooge

For some reason it looks like the -D PHP4 arguement isn't getting passed to apache.  Can you post your /etc/conf.d/apache2 file here?

----------

## tscolari

Hey friends sorry

im so newbie...

when I was going to post the conf file here, i was excluding the comments them I saw that the APACHE_OPTS was with a comment tag in the beggining   :Embarassed: 

sorry take your time with this, now its working   :Embarassed: 

thanks for helping  :Smile: 

----------

