Showing posts with label homebrew. Show all posts
Showing posts with label homebrew. Show all posts

Monday, April 17, 2017

PHP-FPM sending empty response with Nginx on macOS

Leave a Comment

I installed nginx 1.10.3 and php 5.5.38 as a development server on macOS 10.12.4

When I try a test php file in my browser the body is empty but the response headers seem ok:

HTTP/1.1 200 OK Server: nginx/1.10.3 Date: Wed, 29 Mar 2017 11:35:21 GMT Content-Type: text/html Transfer-Encoding: chunked Connection: keep-alive X-Powered-By: PHP/5.5.38

There are no errors in php-fpm.log or nginx/error.log

my nginx.conf has:

server {     listen       80;     server_name  wordpress.bob;     root /Users/mark/Sites/wordpress;           include /usr/local/etc/nginx/global_restrictions.conf;     include /usr/local/etc/nginx/wordpress.conf;      location ~ \.php$ {       try_files $uri =404;       fastcgi_split_path_info ^(.+\.php)(/.+)$;       fastcgi_pass   unix:/usr/local/var/run/php-www.sock;       fastcgi_index  index.php;       include        fastcgi_params;     }  } 

wordpress.bob is a local hostname for testing pointing to 127.0.0.1 in etc/hosts

php-fpm.conf has:

listen = '/usr/local/var/run/php-www.sock' 

Any ideas what I'm doing wrong?

2 Answers

Answers 1

It's hard to help without the ability to read all the configuration files.

You just posted one, not the included ones nor php-fpm.conf. This is not a disapproval (a wall of configuration files is not quite appropriate in a question) but it's just to point out that the configuration file we "don't see" may differ depending on installation.

Anyway I see some differences from the configuration file I have on a server for a wordpress site.

Here are some hints considering that as you don't get any errors php-fpm is running and nginx can "communicate" to it via the socket (otherwise you would get a bad gateway error).


At the beginning...

server {     listen       80;     server_name  wordpress.bob;     root /Users/mark/Sites/wordpress;           index index.php; # <-- ADD THIS 

Make sure in the included wordpress.conf you have

location / {         try_files $uri $uri/ /index.php?$args; } 

The last part...

location ~ \.php$ {     fastcgi_split_path_info ^(.+\.php)(/.+)$;     fastcgi_buffer_size 128k;     fastcgi_buffers 256 16k;     fastcgi_busy_buffers_size 256k;     fastcgi_temp_file_write_size 512k;     fastcgi_intercept_errors on;     fastcgi_max_temp_file_size 0;     fastcgi_connect_timeout 3s;     fastcgi_send_timeout 5s;     fastcgi_read_timeout 5s;     include fastcgi.conf; # <--- fastcgi.conf, NOT fastcgi_params     fastcgi_pass /usr/local/var/run/php-www.sock; } 

The difference between fastcgi.conf and fastcgi_params (on my installation) is just one line:

fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name; 

If this line is missing php code is not able to read $_SERVER['SCRIPT_FILENAME'] and (I think) this may break wordpress code resulting in empty output.


Finally make sure php-fpm worker processes have privileges to access /usr/local/var/run/php-www.sock

Usually the socket has the same owner:group of the workers.

The workers user and group is set in php-fpm.conf:

; Unix user/group of processes ; Note: The user is mandatory. If the group is not set, the default user's group ;       will be used. user = ...... group = ...... 

Answers 2

To install NGINX with Homebrew :

$ brew install nginx 

Run NGINX :

$ sudo nginx 

Test the localhost nginx :

http://localhost:8080 

NGINX configuration file should be in :

$ /usr/local/etc/nginx/nginx.conf 

If you want to change the default port :

$ sudo nginx -s stop $ vim /usr/local/etc/nginx/nginx.conf 

Change the : listen 8080; To : listen 80;

To save and Conf and start NGINX run :

$ sudo nginx 

Then, according to your problem, you might simply be pointing to a an empty PHP file. Try to print a phpinfo() then look for "DOCUMENT_ROOT" to see where it goes.

Read More

Friday, March 17, 2017

How do I fix homebrew error message about “No available formula”

Leave a Comment

When I run brew doctor, I get the following results:

Error: No available formula with the name "coin-or-tools/coinor/clp"  Please tap it and then try again: brew tap coin-or-tools/coinor 

I've never deliberately installed clp, although this message started showing up after I installed why3, which I later deleted (because I intend to use the approach suggested by Laboratoire de Recherche en Informatique instead).

As an experiment, I decided to just go ahead and tap that keg, but I then got the following results:

▶ brew doctor Error: Formulae found in multiple taps:   * coin-or-tools/coinor/coin_data_sample  * dreal/coinor/coin_data_sample 

I then tried untapping dreal/coinor and installing clp, but this failed because Required package CoinUtils not available. At this point, I felt like I was probably going too deep down this rabbit hole and pulled up, specifically, I untapped coin-or-tools/coinor and retapped dreal/coinor. Naturally, the original problem persists.

What is the best approach for fixing this problem, or should I just fight my OCD tendencies and just ignore it?

0 Answers

Read More

Thursday, May 5, 2016

Compiling clisp-2.49 on OSX : LIBFFI not found

Leave a Comment

TL;DR :

Even if libffi seems installed, the configure script doesn't find it even if I give it the (correct?) prefix.

/!\ The last part (*) of this post is where I'm stuck. /!\

I only put the other information to explain how I get there. I apologize for the big post, if something seems irrelevant to you, feel free to tell me, I'll consider making my post shorter.

Why I want to compile CLISP by myself :

I have a lisp programm I would like to run but when running it with CLISP installed with brew (I have no root access) I get the following error :

*** - CFFI requires CLISP compiled with dynamic FFI support. 

So I would like to compile CLISP by myself.

I was using SBCL thus far but I had a problem and was looking for an other implementation.

The problems I have when trying to compile :

I downloaded the sources, untared it.

I then trying to run ./configure.

But I get this :

Configure findings:   FFI:        no (user requested: default)   readline:   no (user requested: default)   libsigsegv: no, consider installing GNU libsigsegv ./configure: libsigsegv was not detected, thus some features, such as   generational garbage collection and   stack overflow detection in interpreted Lisp code cannot be provided. Please install libsigsegv like this:   mkdir tools; cd tools; prefix=`pwd`/x86_64-apple-darwin15.4.0   wget http://ftp.gnu.org/pub/gnu/libsigsegv/libsigsegv-2.8.tar.gz   tar xfz libsigsegv-2.8.tar.gz   cd libsigsegv-2.8   ./configure --prefix=${prefix} && make && make check && make install   cd ../..   rm -f src/config.cache   ./configure --with-libsigsegv-prefix=${prefix} If you insist on building without libsigsegv, please pass   --ignore-absence-of-libsigsegv to this script:   ./configure --ignore-absence-of-libsigsegv If you have installed libsigsegv, but clisp does not detect it, you might have installed it incorrectly, see section 2 in in unix/INSTALL. 

IMPORTANT :

libffi and libsigsegv are both installed with homebrew. But aren't found. I tried adding --with-libsigsegv-prefix=<several values amongst ~/.brew/{opt,opt/libsigsegv,lib,Cellar/libsigsegv,...} : Still the same problem.

This is also almost the same as this post or this one. But the validated solutions doesn't work for me (OSX without root access).

When running configure with --with-dynamic-ffi and --ignore-absence-of-libsigsegv :

I tried to run ./configure --ignore-absence-of-libsigsegv and added --with-dynamic-ffi as someone suggested me in comments.

But then I got this :

Configure findings:   FFI:        no (user requested: default)   readline:   no (user requested: default)   libsigsegv: no, consider installing GNU libsigsegv As you requested, we will proceed without libsigsegv... ./makemake  --with-dynamic-ffi    > Makefile clang: error: unsupported option '-print-multi-os-directory' clang: error: no input files 

when trying to manually install libffi and libsigsegv :

I also tried the suggestion in the first error message :

When running ./configure --with-libsigsegv-prefix=${prefix} I got :

Configure findings:   FFI:        no (user requested: default)   readline:   no (user requested: default)   libsigsegv: yes ./makemake  --with-libsigsegv-prefix=/nfs/2013/v/vmonteco/Documents/clisp-2.49/tools/x86_64-apple-darwin15.4.0    > Makefile clang: error: unsupported option '-print-multi-os-directory' clang: error: no input files make: `config.lisp' is up to date. 

even if I add --with-dynamic-ffi or if I try to install libffi by hand like the first error message suggested (and adding --with-ffi-prefix=${prefix} as well)

If I try to manually build and install libffcall as well :

I get many

avcall-i386.s:7:2: error: instruction requires: Not 64-bit mode 

when running make

(*) So now, it does find libsigsegv, but doesn't find libffi.

Yet the tree at ${prefix} looks like this :

. ├── include │   └── sigsegv.h ├── lib │   ├── libffi-3.2.1 │   │   └── include │   │       ├── ffi.h │   │       └── ffitarget.h │   ├── libffi.6.dylib │   ├── libffi.a │   ├── libffi.dylib -> libffi.6.dylib │   ├── libffi.la │   ├── libsigsegv.a │   ├── libsigsegv.la │   └── pkgconfig │       └── libffi.pc └── share     ├── info     │   ├── dir     │   └── libffi.info     └── man         └── man3             ├── ffi.3             ├── ffi_call.3             ├── ffi_prep_cif.3             └── ffi_prep_cif_var.3 

I'm out of ideas.

1 Answers

Answers 1

On OSX (and developing for OSX only) it is a very good idea to check Clozure. http://ccl.clozure.com It includes an IDE and from speed and general performance it is comparable to SBCL. You can develop native OSX UI apps using Clozure, of course these will not be portable. If you keep to the standard, then you might even use Clozure on Linux etc.

Read More

Tuesday, April 12, 2016

Error: inreplace failed while installling with homebrew?

Leave a Comment

I would like to install treetagger in OS X. In order to make it easier I tried to search if this is possible with Homebrew. So I look at the web and found this formula from pepijnkokke user. Next, I tried to install treetagger as follows:

user@MacBook-Pro-User-2:~$ brew install /Users/user/Downloads/tree-tagger.rb 

However, I got the following error:

==> Installing dependencies for tree-tagger: openssl, wget ==> Installing tree-tagger dependency: openssl ==> Downloading https://homebrew.bintray.com/bottles/openssl-1.0.2g.el_capitan. ######################################################################## 100.0% ==> Pouring openssl-1.0.2g.el_capitan.bottle.tar.gz ==> Caveats A CA file has been bootstrapped using certificates from the system keychain. To add additional certificates, place .pem files in   /usr/local/etc/openssl/certs  and run   /usr/local/opt/openssl/bin/c_rehash  This formula is keg-only, which means it was not symlinked into /usr/local.  Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries  Generally there are no consequences of this for you. If you build your own software and it requires this formula, you'll need to add to your build variables:      LDFLAGS:  -L/usr/local/opt/openssl/lib     CPPFLAGS: -I/usr/local/opt/openssl/include  ==> Summary 🍺  /usr/local/Cellar/openssl/1.0.2g: 1,678 files, 12.0M ==> Installing tree-tagger dependency: wget ==> Downloading https://homebrew.bintray.com/bottles/wget-1.17.1.el_capitan.bot ######################################################################## 100.0% ==> Pouring wget-1.17.1.el_capitan.bottle.1.tar.gz 🍺  /usr/local/Cellar/wget/1.17.1: 9 files, 1.5M ==> Installing tree-tagger ==> Downloading http://www.cis.uni-muenchen.de/~schmid/tools/TreeTagger/data/tr ######################################################################## 100.0% Warning: SHA1 support is deprecated and will be removed in a future version. Please switch this formula to SHA256. Error: SHA1 mismatch Expected: d823320b718eb41a5b4fef449a711307caaf0d88 Actual: 340e09912101acd996642eeed8f623315fa6d672 Archive: /Library/Caches/Homebrew/tree-tagger-3.2.tar.gz To retry an incomplete download, remove the file above. 

I removed the above file and the sha line (sha1 "d823320b718eb41a5b4fef449a711307caaf0d88") and tried again. Nevertheless I got this:

user@MacBook-Pro-de-User-2:~$ brew install /Users/user/Downloads/tree-tagger.rb==> Downloading http://www.cis.uni-muenchen.de/~schmid/tools/TreeTagger/data/tr ######################################################################## 100.0% ==> wget http://www.cis.uni-muenchen.de/~schmid/tools/TreeTagger/data/tagger-sc ==> wget http://www.cis.uni-muenchen.de/~schmid/tools/TreeTagger/data/english-p ==> wget http://www.cis.uni-muenchen.de/~schmid/tools/TreeTagger/data/english-c ==> wget http://www.cis.uni-muenchen.de/~schmid/tools/TreeTagger/data/install-t ==> chmod +x ./install-tagger.sh ==> ./install-tagger.sh Error: inreplace failed cmd/chunker-read-lemma.perl:   expected replacement of /BIN=.*/ with "BIN=/usr/local/Cellar/tree-tagger/3.2/libexec/bin"   expected replacement of /CMD=.*/ with "CMD=/usr/local/Cellar/tree-tagger/3.2/libexec/cmd"   expected replacement of /LIB=.*/ with "LIB=/usr/local/Cellar/tree-tagger/3.2/libexec/lib" 

Any idea of how to install treetagger with homebrew?.

2 Answers

Answers 1

Have you tried installing openssl via homebrew?

brew install openssl brew link openssl --force brew install treehugger 

Answers 2

Why don't you just install it the normal way as mentioned in the document?

The following steps are necessary to install the TreeTagger (see below for the Windows version). Download the files by right-clicking on the link. Then select "save file as". All files should be stored in the same directory.

  • Download the tagger package for your system (PC-Linux, Mac OS-X (Intel-CPU), PC-Linux (version for older kernels)).

    Download the tagging scripts into the same directory.

    Download the installation script install-tagger.sh.

    Download the parameter files for the languages you want to process.

    Open a terminal window and run the installation script in the directory where you have downloaded the files:

    sh install-tagger.sh

    Make a test, e.g. echo 'Hello world!' | cmd/tree-tagger-english

You might want to add ~/homebrew-compling/cmd and ~/homebrew-compling/bin to the PATH variable so that you do not need to specify the full path to run the tagging scripts.

This worked for me fine!

Read More