# Setting up apache2,mysql,php - bunch of problems. (SOLVED)

## leguaan

Ok, I'm trying to make my local server working.

I can't use the 'emerge' command, as I don't have internet connection.

1.)  obtained mysql-standard with binary install.

2.)  copied the files into /mysql

3.)  run 

```
/mysql/scripts/mysql_install_db --user=mysql
```

I get this output:

 *Quote:*   

> ./mysql_install_db: line 1: my_print_defaults: command not found
> 
> Could not find help file 'fill_help_tables.sql' in ./support-files or 
> 
> inside ..

 

Well, something is wrong... I don't know what, but something is wrong.

4.) I tried to run 

```
./mysqld_safe --user=mysql anyway
```

I get this output:

 *Quote:*   

> Starting mysqld daemon with databases from /usr/local/mysql/data
> 
> STOPPING server from pid file /usr/local/mysql/data/localhost.pid
> 
> 050418 20:43:42  mysqld ended

 

The localhost.err file says:

 *Quote:*   

> 050418 20:43:42  mysqld started
> 
> 050418 20:43:42 [ERROR] Can't start server : Bind on unix socket: 
> 
> Permission denied
> ...

 

Never mind, I don't need the databases work yet. Apache and Php are 

much more urgent... So

1.) I compile apache2 with --enable-so

and install it 

2.) I compile php --with-apxs2 and --with-mysql

and install it.

3.) I had to change the Listen port in httpd.conf,

because port 80 was being blocked by something

(is it possible that some previous installation

of apache, which i removed, still blocks the port?)

4.) Try running firefox with http://127.0.0.1:8080

- works, I can access the main apache page, and the

manual as well

5.) Move a directory with my hompage into .../htdocs/positive

Move the apache default content of htdocs into /htdocs/apache

open http://127.0.0.1:8080 and I can see just the apache directory...

It seems like the positive dir doesn't exist.

Try http://127.0.0.1:8080/positive/index.php

and the browser announces, that I have no permission to access those files...

Why???

I probably made couple of serious mistakes trying to configure

apache and mysql before.

Please, help me somehow.

Thanks,

My httpd.conf

[/quote] *Quote:*   

> #
> 
> # Based upon the NCSA server configuration files originally by Rob McCool.
> 
> #
> ...

 

----------

## keli

first of all, you can run emerge even if you're not connected to the net. If you got the sources for those packages on your box, I suppose you can also get what gentoo's asking for  :Smile: 

do an 

```
emerge -pf [whatever you'd like to emerge]
```

 and it will tell you what files would it like to fetch (probably several alternative links for each). Get those files using a computer connected to the net, then copy them into 

```
/usr/portage/distfiles
```

 on your box.

otherwise, you also can use 

```
netstat -ap
```

 to list what processes are sitting on what ports, but my guess is, you tried to run servers with a normal user. IIRC only root is allowed to open ports below 255 ... but then again, this shouldn't have affected mysql.

Also check the access rights on the files and directories in your webserver. They sould be readable by apache (if not owned by apache's user, they have to be world readable) and for the directories the apache user needs to have execute rights.

----------

## leguaan

thanks a lot:

I fixed the thing with the port,

I added executable rights to the directories,

and it works now...

Well, apache works.

Mysql is still repeating the same thing,

and php... I configured it,

added the

AddType application/x-httpd-php .php

line into httpd.conf,

made it load the module,

but firefox displays just the source of the page,

but doesn't translate neither html, nor php in the

pages with .php ending.

html works fine.

I tried specifying the tipe in the mime configuration file

under apache as well, works neither way...

and... about the packages... is it really enough to download

packed source and copy it there?

don't I have to execute some other commands as well?

change the extension etc...

----------

## keli

as for emerge, yes it's enough to copy the files gentoo expects in the distfiles folder. After that you can issue emerge for that package.

Ex:

```
emerge -pfv apache2 php mod_php mysql
```

will tell you what files it would need for these packages (p is pretend, f is fetch, v is verbose).

than if you downloaded all the files, and copied them into 

```
/usr/portage/distfiles
```

you can now issue 

```
emerge apache2 php mod_php mysql
```

 and have it all installed by gentoo's portage. Eventually check your USE flags before beginning the whole procedure, so you'll have all, that you need.

If you've emerged apache & php, you need to modify 

```
/etc/conf.d/apache
```

 to use php

----------

## leguaan

ok,

thanks a lot. it works fine now.

I uninstalled the compiled version of mysql,

emerged mysql from package cd,

didn't work,

but running 

mysql_secure_installation --user=mysql

did the trick and allowed me to use mysql

as root user as well.

php works as well.

it was just holding the 'sources' in cache,

and I had to refresh every page after I insalled php.

now, I have a strange mixture of

source-compiled apache2 and php

and emerged mysql,

but the important thing is that it works fine, finally.

Thanks,

----------

