# I need a PHP + MySQL server just for web design and testing

## Gabriel_Blake

Hello.

It's been some time since I've used PHP, but I need to gain some skills in that field now. 

I thought about running apache on my machine, however I find the config murderous and I don't need such functionality. Is there some sort of that could run the scripts and database just locally for testing purposes ??

I'm also opened to suggestions on the development environment. As for now, I've got eclipse up and running with PHP, but I've heard it's not very good.

Thanks for your help !

----------

## jsn

For php development try netbeans.

----------

## madchaz

apache + php is incredibly easy to install on gentoo now. Hardly need to configure it at all.

----------

## Gabriel_Blake

 *madchaz wrote:*   

> apache + php is incredibly easy to install on gentoo now. Hardly need to configure it at all.

 

Enlighten me then... I've been struggling with it for the last 4hours :[

/etc/apache2/vhosts.d/00_default_vhost.conf

```

 <IfDefine DEFAULT_VHOST>

Listen 80

NameVirtualHost *:80

<VirtualHost *:80>

        ServerName testproject.local

        DocumentRoot "/home/gabriel/Documents/Programming/Test"

        <Directory "/home/gabriel/Documents/Programming/Test">

                Options Indexes FollowSymLinks

                AllowOverride All

                Order allow,deny

                Allow from all

        </Directory>

</VirtualHost>

</IfDefine>

```

/etc/apache2/httpd.conf 

```

ServerRoot "/usr/lib64/apache2"

LoadModule actions_module modules/mod_actions.so

LoadModule alias_module modules/mod_alias.so

LoadModule auth_basic_module modules/mod_auth_basic.so

LoadModule authn_alias_module modules/mod_authn_alias.so

LoadModule authn_anon_module modules/mod_authn_anon.so

LoadModule authn_dbm_module modules/mod_authn_dbm.so

LoadModule authn_default_module modules/mod_authn_default.so

LoadModule authn_file_module modules/mod_authn_file.so

<IfDefine AUTHNZ_LDAP>

LoadModule authnz_ldap_module modules/mod_authnz_ldap.so

</IfDefine>

LoadModule authz_dbm_module modules/mod_authz_dbm.so

LoadModule authz_default_module modules/mod_authz_default.so

LoadModule authz_groupfile_module modules/mod_authz_groupfile.so

LoadModule authz_host_module modules/mod_authz_host.so

LoadModule authz_owner_module modules/mod_authz_owner.so

LoadModule authz_user_module modules/mod_authz_user.so

LoadModule autoindex_module modules/mod_autoindex.so

<IfDefine CACHE>

LoadModule cache_module modules/mod_cache.so

</IfDefine>

LoadModule cgid_module modules/mod_cgid.so

<IfDefine DAV>

LoadModule dav_module modules/mod_dav.so

</IfDefine>

<IfDefine DAV>

LoadModule dav_fs_module modules/mod_dav_fs.so

</IfDefine>

<IfDefine DAV>

LoadModule dav_lock_module modules/mod_dav_lock.so

</IfDefine>

LoadModule deflate_module modules/mod_deflate.so

LoadModule dir_module modules/mod_dir.so

<IfDefine CACHE>

LoadModule disk_cache_module modules/mod_disk_cache.so

</IfDefine>

LoadModule env_module modules/mod_env.so

LoadModule expires_module modules/mod_expires.so

LoadModule ext_filter_module modules/mod_ext_filter.so

<IfDefine CACHE>

LoadModule mem_cache_module modules/mod_mem_cache.so

</IfDefine>

LoadModule mime_module modules/mod_mime.so

LoadModule mime_magic_module modules/mod_mime_magic.so

LoadModule negotiation_module modules/mod_negotiation.so

LoadModule rewrite_module modules/mod_rewrite.so

LoadModule setenvif_module modules/mod_setenvif.so

LoadModule speling_module modules/mod_speling.so

<IfDefine SSL>

LoadModule ssl_module modules/mod_ssl.so

</IfDefine>

<IfDefine STATUS>

LoadModule status_module modules/mod_status.so

</IfDefine>

LoadModule unique_id_module modules/mod_unique_id.so

<IfDefine USERDIR>

LoadModule userdir_module modules/mod_userdir.so

</IfDefine>

LoadModule usertrack_module modules/mod_usertrack.so

LoadModule vhost_alias_module modules/mod_vhost_alias.so

User apache

Group apache

Listen 80

ServerName 127.0.0.1

Include /etc/apache2/modules.d/*.conf

Include /etc/apache2/vhosts.d/*.conf

```

The server starts. But according to "netstat -l" it is not listening to port 80. Connecting to "testproject.local" results in "Server not found" (although it is mentioned in /etc/hosts). Connecting to 127.0.0.1 results in "Unable to connect". On firefox.

I'm frustrated as hell. I'd appreciate any help on the subject.

----------

## cach0rr0

-try commenting out the 'ServerName' directive, and restarting apache

-make sure permissions on the DocumentRoot are such that Apache can actually read the files 

-check ps fax |grep apache after it's started to make sure indeed it's remained running

-have a look through the logs in /var/log/apache to see if you can find any reason it's failing to listen.

----------

## Mad Merlin

If you don't want to configure anything, revert back to the default config (you could remove /etc/apache and emerge again) and then just dump your files directly into /var/www/html/localhost/. Done! Start Apache and you can connect using any address that maps back to your machine (including localhost, an IP, etc).

----------

## Gabriel_Blake

OMG!

I've just come up with a new phrase "RTFL" - "Read The F****** Logfile"

The config I was using was actually a bit different from what I've posted (don't ask why... I must have cut it by accident):

```
DocumentRoot "/home/gabriel/Documents/Programming/PHP/Test\ Project"
```

I've used the "\" before a space - just like in bash. What I've discovered in /var/log/apache2/error_log was:

```
[Wed Jul 07 01:13:04 2010] [error] [client 127.0.0.1] client denied by server configuration: /home/gabriel/Documents/Programming/PHP/Test\\ Project
```

Apache just didn't get that "\ " symbol. When I wrote the directory path "normally", everything worked just fine  :Smile: 

I've found THIS especially useful in writing the correct config.

I've wasted about 6h in total finding this... Gentoo and Linux in general can be a real pain in the ass... It amazes even me, why I love it so much  :Razz: 

----------

## Ant P.

Why can't you use lighttpd instead? With USE=php it even installs a pre-configured config file for PHP.

----------

## Gabriel_Blake

Sorry... too late  :Smile:  I've got apache up and running. If that fails, I'll try your solution. I just didn't know about it.

----------

## Havin_it

I think Apache is the right choice. After all, it's the most common server out there for hosting, and if you run a site with it you're likely to need to have some dealings with its config on some level, even if only via .htaccess files.

I also second the nomination for Netbeans as a dev IDE, though I'd recommend just downloading it from netbeans.org as the ebuild is huuuuge and the dependencies can be a bit of a minefield to boot. It's the first code editor I've used that copes flawlessly with the usual mix of PHP/HTML in a single file, and the find-in-files implementation is really speedy.

----------

