C
C
csergey2014-07-22 11:52:42
linux
csergey, 2014-07-22 11:52:42

How to separate php and memcached on different machines?

There are four servers:
1. apache
2. PHP
3. MEMCACHED
4. MySQL
It is necessary to configure so that php memcached and mysql work together.
The memcached pecl client is installed on php.
I'm interested in where the PHP connection parameters to MySQL and to MEMCACHED are written
. And is it even possible for php and apache to be on different servers? And if so, how do you connect them?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Entelis, 2014-07-22
@csergey

I'm interested in where the PHP connection parameters to MySQL and to MEMCACHED are written

In the code :)
For mysql you have something from
php.net/manual/ru/function.mysql-connect.php
php.net/manual/ru/mysqli.real-connect.php
php.net/manual/ru/ref .pdo-mysql.php
where connection parameters are passed
For memcached respectively
$mc = new Memcached(); 
$mc->addServer("localhost", 11211);

PHP and the web server cannot be on different servers because PHP itself does not contain a web server.
On loaded projects, the following bundle can be used:
There is a frontend on which nginx is installed, which gives static files (caching them on itself) and proxy php requests to backends that already have apache + php or nginx + php-fpm as you like. There are many advantages to this approach, but it is also more difficult to configure.

C
csergey, 2014-07-22
@csergey

I got it. This is not a working option. I'm just learning and it would be easier for me to understand the whole structure of the LAMP stack. Thanks everyone for the replies

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question