PHP Applications - NGINX + PHP-FPM (+MySQL) - Jail Install and Setup

Status
Not open for further replies.

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
Sorry for the noob question but how do I make sure php-fpm is checked? I don't get a config screen/prompt when issuing the make install clean command. PHP seems to compile and install but php-fpm does not. So I must be missing something.

an ncurses menu should popup before you compile php, if not just cancel the compile (CNTR+C), cleanup 'make clean', and configure php 'make config'.
You can then 'make install' with php-fpm
 

docthomas

Dabbler
Joined
Jan 24, 2013
Messages
13
Ok I now see what the problem is... When I try to Make Config or Make install I get cannot open tty-output. Looks like there is a known bug in Freebsd when exec scripts that need TTY outputs. This only happens inside the jail. Outside the jail this doesnt seem to be an issue. I still havent found a solution to this. I am now sure if this is something new to the FREENAS 8.3.1 release. :(
 

Scareh

Contributor
Joined
Jul 31, 2012
Messages
182
any easy way to fix this:


Jail# pkg_add -r pecl-APC.tbz
Error: Unable to get ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-8.3-release/Latest/pecl-APC.tbz: No address record
pkg_add: unable to fetch 'ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-8.3-release/Latest/pecl-APC.tbz' by URL


any pkg_add i do seems to fail, while i'm perfectly fine in downloading the file using the url it specifies, i've been bypassing it with downloading the files manually and placing them in /usr/ports/distfiles
but would be easier if it would just download...
 

docthomas

Dabbler
Joined
Jan 24, 2013
Messages
13
Sounds like a DNS issue. I had they same issue before. Make sure you are able to do lookups in the Jail - nslookup, dig, or ping a FQDN address.
 

Scareh

Contributor
Joined
Jul 31, 2012
Messages
182
after installing php/mysql:

Plugins# service php-fpm start
Starting php_fpm.
/usr/local/sbin/php-fpm: 2: Syntax error: ")" unexpected
/usr/local/etc/rc.d/php-fpm: WARNING: failed to start php_fpm
Plugins# service mysql start
mysql does not exist in /etc/rc.d or the local startup
directories (/usr/local/etc/rc.d)


when i go look in the depository's they are there so i'm a bit confused about the why they don't want to boot. I allready restarted the machine and nginx starts automaticly without problems.
any suggestions?
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
Ok I now see what the problem is... When I try to Make Config or Make install I get cannot open tty-output. Looks like there is a known bug in Freebsd when exec scripts that need TTY outputs. This only happens inside the jail. Outside the jail this doesnt seem to be an issue. I still havent found a solution to this. I am now sure if this is something new to the FREENAS 8.3.1 release. :(

Code:
pkg_add -r tmux
tmux

You should now have a terminal session with tty
- exit with CTRL+D
- detatch with CTRL+B > D
- list with 'tmux ls'
- reattach with 'tmux a -t 0' or whatever session number you want.

I recommend always using tmux when compiling incase you lose you connection as tmux will keep watching your session.

- - - Updated - - -

after installing php/mysql:

Plugins# service php-fpm start
Starting php_fpm.
/usr/local/sbin/php-fpm: 2: Syntax error: ")" unexpected
/usr/local/etc/rc.d/php-fpm: WARNING: failed to start php_fpm
Plugins# service mysql start
mysql does not exist in /etc/rc.d or the local startup
directories (/usr/local/etc/rc.d)


when i go look in the depository's they are there so i'm a bit confused about the why they don't want to boot. I allready restarted the machine and nginx starts automaticly without problems.
any suggestions?

php might be an old version but that's just a guess.
My mistake..
Code:
service mysql-server start
 

Scareh

Contributor
Joined
Jul 31, 2012
Messages
182
Plugins# pkg_add -r php5-extensions
Fetching ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-8.3-release/Latest/php5-extensions.tbz... Done.
pkg_add: package 'php5-extensions-1.6' or its older version already installed

Plugins# pkg_add -r pecl-APC
Fetching ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-8.3-release/Lates t/pecl-APC.tbz... Done.
pkg_add: package 'pecl-APC-3.1.9_1' or its older version already installed

Plugins# pkg_add -f php5-5.3.10_1.tbz
pkg_add: warning: package 'php5-5.3.10_1' requires 'pcre-8.30_1', but 'pcre-8.30_2' is installed
pkg_add: warning: package 'php5-5.3.10_1' requires 'libiconv-1.13.1_2', but 'libiconv-1.14' is installed
pkg_add: warning: package 'php5-5.3.10_1' requires 'libxml2-2.7.8_2', but 'libxml2-2.7.8_3' is installed



service mysql-server start command worked, so only got the php left.
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
Plugins# pkg_add -r php5-extensions
Fetching ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-8.3-release/Latest/php5-extensions.tbz... Done.
pkg_add: package 'php5-extensions-1.6' or its older version already installed

Plugins# pkg_add -r pecl-APC
Fetching ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-8.3-release/Lates t/pecl-APC.tbz... Done.
pkg_add: package 'pecl-APC-3.1.9_1' or its older version already installed

Plugins# pkg_add -f php5-5.3.10_1.tbz
pkg_add: warning: package 'php5-5.3.10_1' requires 'pcre-8.30_1', but 'pcre-8.30_2' is installed
pkg_add: warning: package 'php5-5.3.10_1' requires 'libiconv-1.13.1_2', but 'libiconv-1.14' is installed
pkg_add: warning: package 'php5-5.3.10_1' requires 'libxml2-2.7.8_2', but 'libxml2-2.7.8_3' is installed



service mysql-server start command worked, so only got the php left.

Yeah, I guess I should change my instructions to only use ports. If I were you I'd pkg_delete all the php packages and just compile php from ports. I really hope pkgng solves alot of the issues pkg / ports have with dependencies in freebsd.
 

Scareh

Contributor
Joined
Jul 31, 2012
Messages
182
got it to work with:

cd /usr/ports/lang/php5 && make install clean
cd /usr/ports/lang/php5-extensions && make install

after that php started up.

perhaps something to add in your guide instead of telling people to add something to rc.conf you could just do : echo '***_enable="YES"' >> /etc/rc.conf
makes it easier then starting to look for the files

on another note, any suggestion on how to actually configure the damn ajaxplorer thing? I can't find anything on their forums...

I was thinking i'd just surf towards my jail ip and add the /ajaxplorer after it but that doesn't seem to be working.
guess i configured something wrong still in the ajaxplorer files.
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
got it to work with:

cd /usr/ports/lang/php5 && make install clean
cd /usr/ports/lang/php5-extensions && make install

after that php started up.

perhaps something to add in your guide instead of telling people to add something to rc.conf you could just do : echo '***_enable="YES"' >> /etc/rc.conf
makes it easier then starting to look for the files

on another note, any suggestion on how to actually configure the damn ajaxplorer thing? I can't find anything on their forums...

I was thinking i'd just surf towards my jail ip and add the /ajaxplorer after it but that doesn't seem to be working.
guess i configured something wrong still in the ajaxplorer files.

Can you get anything to come up from nginx? like browse to a static file nginx should just serve up. If that works it's probably somewhere in the process of proxying to php
 

Scareh

Contributor
Joined
Jul 31, 2012
Messages
182
I seem to hit a wall...:mad:
I've tried the process of installing ajaxplorer now 4 times...
I get up till the part that i've installed: nginx, php, mysql and ajaxplorer. However, every single time when i go to my jail's ip in the browser i get the "welcome to nginx" screen.
Thats the point where i start messing around and screw everything up completely :cool: and end up deleting my jail and starting over:mad:
Anyone wanting to help out and give a demonstration on how to install it or a demo on how its working on your nas plz feel free to give me a pm

edit:

I've come to a point where i got everything working:


output of sockstat:

Code:
USER     COMMAND    PID   FD PROTO  LOCAL ADDRESS         FOREIGN ADDRESS
www-ajaxplorer php-fpm1197 0 stream /var/run/php-fpm-ajaxplorer.sock
www-ajaxplorer php-fpm1197 9 stream (not connected)
www-ajaxplorer php-fpm1196 0 stream /var/run/php-fpm-ajaxplorer.sock
www-ajaxplorer php-fpm1196 9 stream (not connected)
root     php-fpm    1195  5  stream -> ??
root     php-fpm    1195  7  stream -> ??
root     php-fpm    1195  8  stream /var/run/php-fpm-ajaxplorer.sock
root     php-fpm    1195  9  stream (not connected)
www      nginx      1111  3  stream -> ??
www      nginx      1111  7  tcp4   *:80                  *:*
www      nginx      1111  14 stream -> ??
www      nginx      1110  3  stream -> ??
www      nginx      1110  7  tcp4   *:80                  *:*
www      nginx      1110  8  stream -> ??
root     nginx      941   3  stream -> ??
root     nginx      941   7  tcp4   *:80                  *:*
root     nginx      941   8  stream -> ??
root     nginx      941   13 stream -> ??
root     nginx      941   14 stream -> ??
mysql    mysqld     594   13 tcp4 6 *:3306                *:*
mysql    mysqld     594   15 stream /tmp/mysql.sock
root     cron       5082  6  dgram  -> /var/run/logpriv
root     syslogd    5031  6  dgram  /var/run/log
root     syslogd    5031  7  dgram  /var/run/logpriv



However... when i surf towards my jails ip, its just showing a blank page...
feel free to ask for more info if you need it.
 

fosi

Cadet
Joined
Apr 13, 2013
Messages
1
Thanks for the help installing owncloud under jail.

having no problems with owncloud 4.x but with 5.x it goes: "The content failed to load" http://cl.ly/image/1l1P283L0j2Q
and when i click on files it goes: "upgrading filesystem cache..." http://cl.ly/image/0K1Y3y2B3n36

does anyone knows how to solve this? already tried to:
DELETE FROM oc_filecache;
DELETE FROM oc_storages;

..but no result at all!

the owncloud log doesnt gives me much either,

owncloud.log:
Code:
{"app":"PHP","message":"mysql_close(): 48 is not a valid MySQL-Link resource at \/usr\/local\/www\/owncloud\/lib\/setup.php#277","level":2,"time":1365786602}


php-fpm.log:
Code:
Jail# cat php-fpm.log 
[12-Apr-2013 17:48:40] NOTICE: fpm is running, pid 2854
[12-Apr-2013 17:48:40] NOTICE: ready to handle connections
[12-Apr-2013 17:48:40] NOTICE: fpm is running, pid 2879
[12-Apr-2013 17:48:40] NOTICE: ready to handle connections
[12-Apr-2013 18:00:38] NOTICE: Reloading in progress ...
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
Thanks for the help installing owncloud under jail.

having no problems with owncloud 4.x but with 5.x it goes: "The content failed to load" http://cl.ly/image/1l1P283L0j2Q
and when i click on files it goes: "upgrading filesystem cache..." http://cl.ly/image/0K1Y3y2B3n36

does anyone knows how to solve this? already tried to:
DELETE FROM oc_filecache;
DELETE FROM oc_storages;

..but no result at all!

the owncloud log doesnt gives me much either,

owncloud.log:
Code:
{"app":"PHP","message":"mysql_close(): 48 is not a valid MySQL-Link resource at \/usr\/local\/www\/owncloud\/lib\/setup.php#277","level":2,"time":1365786602}


php-fpm.log:
Code:
Jail# cat php-fpm.log 
[12-Apr-2013 17:48:40] NOTICE: fpm is running, pid 2854
[12-Apr-2013 17:48:40] NOTICE: ready to handle connections
[12-Apr-2013 17:48:40] NOTICE: fpm is running, pid 2879
[12-Apr-2013 17:48:40] NOTICE: ready to handle connections
[12-Apr-2013 18:00:38] NOTICE: Reloading in progress ...

I also had problems with owncloud 5.0 on FreeBSD Jail with PHP 5.4. Just confirming your issue, I didn't put much effort into fixing it.
 

Atomic

Contributor
Joined
Oct 20, 2012
Messages
160
Hi all,

my ownCloud won'd run.
I followed the steps from Joshua straight forward but I only get "Forbidden 403" shown on http. :(
Bildschirmfoto 2013-04-13 um 20.21.36.jpg

I need a step by step guide which is dummy proof. :o

nginx, php-frm and mySQL are running.
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
Hi all,

my ownCloud won'd run.
I followed the steps from Joshua straight forward but I only get "Forbidden 403" shown on http. :(
View attachment 2114

I need a step by step guide which is dummy proof. :o

nginx, php-frm and mySQL are running.

if you setup owncloud using my guide you should be going to "http://jailip/owncloud"
 

Atomic

Contributor
Joined
Oct 20, 2012
Messages
160
502 Bad Gateway
Bildschirmfoto 2013-04-13 um 20.57.59.jpg
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949

Atomic

Contributor
Joined
Oct 20, 2012
Messages
160
Hi Joshua,

here is the sockstat:

owncloud# sockstat
USER COMMAND PID FD PROTO LOCAL ADDRESS FOREIGN ADDRESS
www-ajaxplorer php-fpm4292 0 stream /var/run/php-fpm-ajaxplorer.sock
www-ajaxplorer php-fpm4291 0 stream /var/run/php-fpm-ajaxplorer.sock
www php-fpm 4290 0 tcp4 127.0.0.1:9000 *:*
www php-fpm 4289 0 tcp4 127.0.0.1:9000 *:*
root php-fpm 4288 10 stream -> ??
root php-fpm 4288 11 stream -> ??
root php-fpm 4288 12 tcp4 127.0.0.1:9000 *:*
root php-fpm 4288 13 stream /var/run/php-fpm-ajaxplorer.sock
www nginx 4281 5 stream -> ??
www nginx 4281 6 tcp4 *:80 *:*
mysql mysqld 4138 13 tcp4 6 *:3306 *:*
mysql mysqld 4138 15 stream /tmp/mysql.sock
root cron 3472 4 dgram -> /var/run/logpriv
root nginx 3291 4 stream -> ??
root nginx 3291 5 stream -> ??
root nginx 3291 6 tcp4 *:80 *:*
root syslogd 3102 4 dgram /var/run/log
root syslogd 3102 5 dgram /var/run/logpriv
owncloud#
 
Status
Not open for further replies.
Top