# FAMP in jail not working after upgrade



## maudib (Sep 10, 2012)

Hi there
I was running FAMP+wordpress in a jail with 8.2-RELEASE. I always follow this guide to set up the wordpress database in mysql. I upgraded to 8.3-RELEASE, recently. Apache22 and Mysql start with no problems(inside this FreeBSD jail). I had to import the mysql database from my Linux web server to this new 8.3-RELEASE jailed mysql and that went o.k. I also had to rsync /var/www/html on the Linux web server to /usr/local/www/apache22/data in the jail.
Everything worked fine on the 8.2-RELEASE. During the upgrade i accepted the merges of the config files. So i ended up with the same config files for the most part. The only lines that were added to httpd.conf were:

```
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
```
And:

```
<IfModule dir_module>
    DirectoryIndex index.php index.html
</IfModule>
```
The UID and GID of the directories and file in /usr/local/www/apache22/data were preserved accross the rsync and mapp to the correct values of root and wheel. The permission are also correct and the same as those on the Linux server.
The problem is that when i access the site held in this FreeBSD jail, from another host on the network, i get a strange response to the browser in question. A small window pops up and it says:
You have chosen to open index.php, which is a .php file 395 bytes. When i don't specify /index.php in the URL it sometimes gives me the .php source for index.php.
I don't understand what's going on, but hope that it is just an apache22 config mistake. I think mod_cgi.c is supposed to be handling php execution, as this server does not require speed. All the ports were installed into the jail after syncing the ports tree. I really dunno what to do.
Any help would be great.
Thank you very much


----------



## maudib (Sep 10, 2012)

And yes php5-mysql is already installed


----------



## fbsd1 (Sep 11, 2012)

I don't see why you titled this as FAMP problem. You describe it in the post content as a apache/php problem. You state the website you used in 8.2 was on a "Linux web server" and now in 8.3 you are trying to migrate that web server to a 8.3 jail. First verify that the jailed apache functions by creating a index.html file containing some simple text. If your browser can't display that them your 8.3 jailed apache needs fixing. You can not just move the php httpd.conf statements from the "Linux web server". You have to install the php5 port to the jailed apache.


----------



## maudib (Sep 11, 2012)

Erm well I had a LAMP+Wordpress on the Linux server and the same site in a jail on a 8.2-RELEASE. Then I upgraded to 8.3-RELEASE so the jail was rebuilt and the database and /var/www/html(from Linux) were put in the jail. This was done after Apache22, mysql(server and client), PHP5 and wordpress ports were installed into the jail. And yes the wordpress database was created and the 'grants' set before the import. Also wp-config.php had the same name for the wordpress user and database. The problem must have been, I guess, that the upgrade wasn't performed correctly with regards to the ports in the old jail. I'm gonna read the handbook section on jails. Any suggestions on freebsd-update and ports in a jail would be great.
Sorry that I didn't explain all that with clarity in the original post.
Thank you very much for replies/comments/suggestions
regards


----------



## maudib (Oct 20, 2012)

*[solved]*

I'm sorry i didn't explain this very well at all. I was asking why a site that had been imported from a Linux server worked on 8.2-RELEASE and that the, supposedly same, site didn't work after i upgraded to 8.3-RELEASE.
The last question that was asked was: If you have a jail and you do:

```
$ mount_nullfs /usr/ports $D/usr/ports
```
where $D is the jail directory. Then pkg_version  run inside the jail will only list ports installed into the jail. So when you do an update to the kernel and world how would freebsd-update know about the ports you installed into the jail, when it tells you whether any ports need updating?. Does this mean also that null mounting the ports directory in a jail is technically a bad idea? Or is it o.k as long as you don't update the ports tree with portsnap from inside the jail?
The problem of my PHP not being executed was helped by using mod_php instead of executing it as a CGI and a trusted backup of the site that was on Linux in a new jail with new ports of all the software involved. Why did i try and execute PHP as a CGI you ask? Well i just heard if you were more bothered about security than performance then it is the way to go(?).
Thank you very much for reading and possibly advising me on the issues i discussed.


----------



## SirDice (Oct 22, 2012)

maudib said:
			
		

> So when you do an update to the kernel and world how would freebsd-update know about the ports you installed into the jail, when it tells you whether any ports need updating?


freebsd-update(8) doesn't touch ports, at all.


----------



## maudib (Oct 24, 2012)

Sorry, I thought that freebsd-update inspected which ports needed updating after a minor upgrade to the system. Hence the question.


----------



## SirDice (Oct 24, 2012)

Think of the ports and the base system as two separate, independent entities.


----------



## maudib (Oct 25, 2012)

Sorry to waste your time. I've just realized that my question was completely hypothetical(and rather dumb). I was thinking that when i did a minor or major upgrade to world and the kernel(on the host) the only thing I'd have to do to the jail is rebuild the ports. I realize that this isn't true; that a complete rebuild of the jail would be required to keep the jail's world and the host's new kernel in sync with each other.
regards maudib


----------

