Setting up PHP-FPM in PHP 5.4 - fastcgi

My configuration is like this:
Centos 6.3
Plesk 11.5
PHP 5.4.18
Apache 2.2.15
PHP API: 20100412
Server API: CGI/FastCGI  
I use php as fastcgi. But I want to use APC or XCache. And it seems like FastCGI doesn't work well with opcache. So I read that it is better to use PHP-FPM. So how can I enable or install PHP-FPM ?
I read some tutorials and they offer to compile apache with fpm but it seems like a big risk for me. I'm not well-informed in servers.
I'm not sure whether I use mod_fastcgi or mod_fcgid. In my /etc/httpd/conf.d/ folder I have fcgid.conf file. So I think I use fcgid. Is it correct?
My Plesk has this setting: http://s11.postimg.org/pgqxwmmr7/fast.jpg
I'm curious if I install php-fpm can it brak my webserver or will any other problem occur ?

When dealing with Apache and FPM you should be using mod_fastcgi and not mod_fcgid.
I created this documentation a while ago and it seems to have helped quite a few people in the past, so perhaps it will also help you -> https://gist.github.com/diemuzi/3849349
As for breaking the web server... That's an iffy question. Since FPM is a standalone and does not need Apache to run, it possible that your current Apache setup might need some additional "tweaking" to make it work the right way again. Furthermore, since you are running Plesk and as it does not currently offer FPM support, there is also a good chance that you could possibly break your Plesk setup.
If you were not using some proprietary control panel software to manage your server and did things the old fashioned way by manually installing (or even using packages from your distro) then all of this would be a very simple solution for you.

Related

How do I implement XAMPP and Docker side-by-side in Windows 10

I recently ran into the issue where I was working on two Laravel projects: one using Docker, the other using XAMPP. I started my Docker project earlier, so I gave it access to port 3306.
When I went to implement the XAMPP project, I tried editing all the DB settings in the proper places to use the port 3308 so that it didn't collide with my DB docker container. Problem was, now I couldn't connect to phpMyAdmin. I was receiving errors that the settings were incorrect. So what was the solution?
The solution was to reset all of my settings to 3306, docker-compose down my Docker project, and then restart the XAMPP services. Worked like a charm.
So I'll note a couple things:
It seems like phpMyAdmin assumes it has access to 3306 even if you've changed your settings in config.inc.php.
Unrelated to this precise problem, I discovered that XAMPP's PHP version was different than what was installed on my Windows machine, which meant that I had two php.ini files. My php-cli was using the C/Program Files/PHP/php.ini, whereas XAMPP was using the XAMPP php.ini. While the XAMPP php.ini had the correct extensions uncommented, I needed to manually uncomment the appropriate extensions in the php-cli ini file. If you have xampp, go to the command line and use php --ini to check where your CLI ini file is located.
I suggest to try devilbox
The Devilbox is a modern and highly customisable dockerized PHP stack supporting full LAMP and MEAN and running on all major platforms. The main goal is to easily switch and combine any version required for local development. It supports an unlimited number of projects for which vhosts, SSL certificates and DNS records are created automatically. Reverse proxies per project are supported to ensure listening server such as NodeJS can also be reached. Email catch-all and popular development tools will be at your service as well. Configuration is not necessary, as everything is already pre-setup.

Config rails server on vps hosting

I must configure my RoR vps hosting for my rails app, but on my localmachine i simple use webrick...
Are any ways to do this on server, so that it will be faster, and also, if it reboot's or memory down, or something that call's shutdown of server, then it automatically starts?
Also how about rails enterprise?
Now i have clean ubuntu server, and rvm on it
Follow this tutorial, it's great for beginner and will answer all your questions: http://coding.smashingmagazine.com/2011/06/28/setup-a-ubuntu-vps-for-hosting-ruby-on-rails-applications-2/
Which webserver to use depends on many things. Among others, there's Thin, Unicorn, Rainbows, Puma, and counting.
I suggest you look on google (or even here, I'm pretty this was answered before) for comparisons between ruby webservers, so that you can know what situation each of them are adapted to, and which one will fit your needs best.
For production deployment you need to install nginx or apache,
nginx is lightweight ,consider installing nginx,
Now there are various ways simple and easy to install is passenger with nginx
Or simply you can use nginx+unicorn or nginx+thin you can find various article just google it.

Are there any easy-to-configure webserver with ruby for Windows?

Are there any easy-to-configure webserver with ruby for Windows ?
I am hoping to find a webserver that can easily be configured to work with Ruby on Rails or Sinatra.
Anyone know of any ?
I use Sinatra+Thin on Windows, sometimes behind either Apache or Nginx as a reverse proxy (to speed up serving static files and to create a pool of 2-4 server instances). The speed is not as good as it is on Ubuntu with similar (or lesser) hardware, but at work I have to use certain servers allocated to me.
To use Thin with Sinatra, simply install Thin, and Sinatra will use it. If you need further help configuring Apache or Nginx, post more questions (after searching the web, of course).
If you want easy, stay with WEBrick.
If you want a production server, go with Apache + Passenger. But that won't be as simple as just using WEBrick.
Probably it is not answer you want but: http://rubyinstaller.org/. Installation is easy - follow instructions to install rails.
Second step is enable/configure port/application in firewall. Because ruby server works on port 3000 but http is common on port 80.
BUT this RoR environment is for development, so don't expect high performance.

Running Lua scripts using FastCGI

I am currently trying to figure out ways to run Lua scripts using FastCGI with either lighttpd or Nginx. The only thing I was able to dig up yet was WSAPI of the Kepler project. But I wonder if there are other possibilities. Important for me is:
should be as lightweight as possible
should be stable enough to use in a production environment
Many thanks in advance.
I would recommend taking a look at this project:
http://github.com/STPeters/luafcgid
There are instructions on how to use it with nginx.

Running multiple web frameworks on one machine?

I want to start experimenting with all these different web frameworks that are available. I was wondering if they could all run in one machine at the same time?
I know that all my database services can all run at the same time, along with the Javascript frameworks, but what about something like Rails and Java applications? Can those play along with each other? Will Apache handle all of this for me?
Yes, since almost any language framework runs as normal code for the language, simply providing structure for applications you write, they can coexist well with other frameworks for the same or other languages. You can certainly run Rails and a Java framework on the same machine - you could even run Rails on JRuby and a Java application server
It sounds like you're just getting started programming. I would recommend learning some of the basics first. For instance, if you want to learn Ruby, try the Pickaxe book, write some simple scripts, then move on to a ruby web framework like Sinatra or Rails. You'll have a better understanding of the difference between a language and framework, how each is installed and run on your machine, etc.
The easiest way to begin experimenting is to use the development server that is included with the various frameworks and run the server on a different port (not 80). For Rails, this is done via:
ruby script\server
which will start a server on port 3000.
Other frameworks use other approaches. Most tutorials for Ruby and Python frameworks (with which I am most familiar) will include instructions on how to start a development server like this.
I don't see why not. It really depends on how the frameworks are deployed and in what containers. If they use separate containers (e.g. tomcat vs apache) you'll need to make sure that the containers are configured to use different ports since many web containers use 80 or 8080.
If you plan on running them all in the same container (e.g. Apache) then I would think they'd be fine, since each one can be treated as a separate web application and deployed to a different location in your document root.
For the most part, it'll probably be trial and error. I don't know much about how Rails interacts with Java, but I've run Grails and Java applications together easily myself with few problems.
I run Rails, PHP, and Java with one Apache server. Except for what felt like a ton of apache config munging when I set it all up, it's been fine. I'm not much of a sysadmin, so it took me a few days to get everything running right.
PHP, Java and Rails all have environments that let you run independent servers and save complex configuration.
Java you can use Tomcat or Jetty.
Rails comes with Webrick, which is fine for development.
PHP has XAMPP (or MAMP if your on the Mac) gives you a complete stack.
I run Rails and ASP.NET MVC on the same Machine and I just set my local servers to run on different ports. But usually the default setup (e.g. Rails on port 3000) will not conflictwith each other, plus each framework usually has its own way to run (LAMP, Webrick, Montgrel...) so you should be fine.

Resources