За последние 24 часа нас посетили 18412 программистов и 1635 роботов. Сейчас ищут 1622 программиста ...

php 5.3.3 + nginx

Тема в разделе "Установка PHP", создана пользователем like2dev, 31 июл 2010.

  1. like2dev

    like2dev Активный пользователь

    С нами с:
    31 июл 2010
    Сообщения:
    24
    Симпатии:
    0
    Здравствуйте, пытаюсь установить php-5.3.3 на ubuntu 10.04

    строка конфигурации

    Код (Text):
    1. ./configure \
    2.     --prefix=/opt/php5 \
    3.     --with-config-file-path=/opt/php5/etc \
    4.     --with-curl \
    5.     --with-pear \
    6.     --with-gd \
    7.     --with-jpeg-dir \
    8.     --with-png-dir \
    9.     --with-zlib \
    10.     --with-xpm-dir \
    11.     --with-freetype-dir \
    12.     --with-t1lib \
    13.     --with-mcrypt \
    14.     --with-mhash \
    15.     --with-mysql \
    16.     --with-mysqli \
    17.     --with-pdo-mysql \
    18.     --with-openssl \
    19.     --with-xmlrpc \
    20.     --with-xsl \
    21.     --with-bz2 \
    22.     --with-gettext \
    23.     --with-fpm-user=www-data \
    24.     --with-fpm-group=www-data \
    25.     --enable-fpm \
    26.     --enable-exif \
    27.     --enable-wddx \
    28.     --enable-zip \
    29.     --enable-bcmath \
    30.     --enable-calendar \
    31.     --enable-ftp \
    32.     --enable-mbstring \
    33.     --enable-soap \
    34.     --enable-sockets \
    35.     --enable-sqlite-utf8 \
    36.     --enable-shmop \
    37.     --enable-dba \
    38.     --enable-sysvmsg \
    39.     --enable-sysvsem \
    40.     --enable-sysvshm
    41.  
    42. make
    43. make install
    Вообщем пытаюсь делать /etc/init.d/php-fpm получаю фейл.
    В логе пишет следующее

    Код (Text):
    1. Jul 31 09:42:38.002281 [NOTICE] fpm is running, pid 976
    2. Jul 31 09:42:38.042520 [NOTICE] ready to handle connections
    3. Июл 31 10:40:11.952126 [ERROR] bind() for address '127.0.0.1:9000' failed: Адрес уже используется (98)
    команда ps -A

    Код (Text):
    1.  976 ?        00:00:00 php-fpm
    2.   977 ?        00:00:00 php-fpm
    3.   978 ?        00:00:00 php-fpm
    4.   979 ?        00:00:00 php-fpm
    5.   980 ?        00:00:00 php-fpm
    6.   981 ?        00:00:00 php-fpm
    7.   982 ?        00:00:00 php-fpm
    8.   983 ?        00:00:00 php-fpm
    9.   984 ?        00:00:00 php-fpm
    10.   985 ?        00:00:00 php-fpm
    11.   986 ?        00:00:00 php-fpm
    пытаюсь сделать localhost/index.php не обратаывается почему-то , хотя пхп-фпм вроде как запущен

    посомтрел прослушивается ли порт командой netstat -lp -inet

    Код (Text):
    1. tcp        0      0 localhost:9000          *:*                     LISTEN    
    Код (Text):
    1. nginx.conf
    2.  
    3.         # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    4.         #
    5.         location ~ \.php$ {
    6.             root           /var/www;
    7.             fastcgi_pass   127.0.0.1:9000;
    8.             fastcgi_index  index.php;
    9.             fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
    10.             include        fastcgi_params;
    11.         }
     
  2. 440Hz

    440Hz Старожил
    Команда форума Модератор

    С нами с:
    21 дек 2012
    Сообщения:
    8.003
    Симпатии:
    1
    Адрес:
    Оттуда
    fastcgi_param SCRIPT_FILENAME /var/www/scripts$fastcgi_script_name;

    нужен полный путь
     
  3. like2dev

    like2dev Активный пользователь

    С нами с:
    31 июл 2010
    Сообщения:
    24
    Симпатии:
    0
    когда закоментил SCRIPT_FILENAME ошибки не выбивало просто белый экран, когда сделал как вы написали получаю Oops! This link appears to be broken.
     
  4. like2dev

    like2dev Активный пользователь

    С нами с:
    31 июл 2010
    Сообщения:
    24
    Симпатии:
    0
    может в php.ini нужно установить что типо пхп запускается как fastcgi
     
  5. like2dev

    like2dev Активный пользователь

    С нами с:
    31 июл 2010
    Сообщения:
    24
    Симпатии:
    0
    и еще постоянно пишет при /etc/init.d/php-fpm "some_command" что типо pid files not found
     
  6. 440Hz

    440Hz Старожил
    Команда форума Модератор

    С нами с:
    21 дек 2012
    Сообщения:
    8.003
    Симпатии:
    1
    Адрес:
    Оттуда
    там нужен полный путь где у тебя скрипты лежат.
    где у тебя лежит index.php ? полный путь?
     
  7. 440Hz

    440Hz Старожил
    Команда форума Модератор

    С нами с:
    21 дек 2012
    Сообщения:
    8.003
    Симпатии:
    1
    Адрес:
    Оттуда
    и покаж конфиг php-fpm ?
     
  8. like2dev

    like2dev Активный пользователь

    С нами с:
    31 июл 2010
    Сообщения:
    24
    Симпатии:
    0
    Исправил проблемму с php-fpm pid файлами, перенес их в /opt/php5/var/run и в /etc/init.d/php-fpm тоже исправил , теперь спокойно работает.

    Сейчас при обращении к localhost/index.php

    The page you are looking for is temporarily unavailable.
    Please try again later.

    Теперь я думаю дело за nginx.

    путь к index.php /var/www
     
  9. like2dev

    like2dev Активный пользователь

    С нами с:
    31 июл 2010
    Сообщения:
    24
    Симпатии:
    0
    хотя в php-fpm.conf меня пугает эта строка listen = /var/run/php-fpm.sock
    по идеи там должно быть 127.0.0.1:9000
     
  10. like2dev

    like2dev Активный пользователь

    С нами с:
    31 июл 2010
    Сообщения:
    24
    Симпатии:
    0
    nginx conf
    Код (Text):
    1.  
    2.  
    3. user  www-data;
    4. worker_processes  1;
    5. error_log  /var/log/nginx/error.log;
    6. pid        /var/run/nginx.pid;
    7.  
    8. events {
    9.     worker_connections  1024;
    10. }
    11.  
    12.  
    13. http {
    14.     include       mime.types;
    15.     include        fastcgi_params;
    16.    
    17.     ## Proxy
    18.     proxy_redirect          off;
    19.     proxy_set_header        Host            $host;
    20.     proxy_set_header        X-Real-IP       $remote_addr;
    21.     proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
    22.     proxy_connect_timeout   90;
    23.     proxy_send_timeout      90;
    24.     proxy_read_timeout      90;
    25.     proxy_buffers           32 4k;
    26.    
    27.     default_type  application/octet-stream;
    28.  
    29.     #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    30.     #                  '$status $body_bytes_sent "$http_referer" '
    31.     #                  '"$http_user_agent" "$http_x_forwarded_for"';
    32.  
    33.     #access_log  logs/access.log  main;
    34.  
    35.     sendfile        on;
    36.     tcp_nopush     on;
    37.  
    38.     #keepalive_timeout  0;
    39.     keepalive_timeout  65;
    40.  
    41.     ## Compression
    42.     gzip        on;
    43.     gzip_comp_level     9;
    44.     gzip_proxied        any;
    45.     gzip_types      text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
    46.  
    47.     server {
    48.         listen       80;
    49.         server_name  localhost;
    50.  
    51.         #charset koi8-r;
    52.  
    53.         #access_log  logs/host.access.log  main;
    54.  
    55.         location / {
    56.             root   /var/www;
    57.             index  index.html index.htm;
    58.         }
    59.  
    60.         #error_page  404              /404.html;
    61.  
    62.         # redirect server error pages to the static page /50x.html
    63.         #
    64.         error_page   500 502 503 504  /50x.html;
    65.         location = /50x.html {
    66.             root   html;
    67.         }
    68.  
    69.         # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    70.         #
    71.         #location ~ \.php$ {
    72.         #    proxy_pass   http://127.0.0.1;
    73.         #}
    74.  
    75.         # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    76.         #
    77.         location ~ \.php$ {
    78.             root           /var/www;
    79.             fastcgi_pass   127.0.0.1:9000;
    80.             fastcgi_index  index.php;
    81.         fastcgi_param SCRIPT_FILENAME /var/www/$fastcgi_script_name;
    82.             include        fastcgi_params;
    83.         }
    84.  
    85.         # deny access to .htaccess files, if Apache's document root
    86.         # concurs with nginx's one
    87.         #
    88.         #location ~ /\.ht {
    89.         #    deny  all;
    90.         #}
    91.     }
    92.  
    93.  
    94.     # another virtual host using mix of IP-, name-, and port-based configuration
    95.     #
    96.     #server {
    97.     #    listen       8000;
    98.     #    listen       somename:8080;
    99.     #    server_name  somename  alias  another.alias;
    100.  
    101.     #    location / {
    102.     #        root   html;
    103.     #        index  index.html index.htm;
    104.     #    }
    105.     #}
    106.  
    107.  
    108.     # HTTPS server
    109.     #
    110.     #server {
    111.     #    listen       443;
    112.     #    server_name  localhost;
    113.  
    114.     #    ssl                  on;
    115.     #    ssl_certificate      cert.pem;
    116.     #    ssl_certificate_key  cert.key;
    117.  
    118.     #    ssl_session_timeout  5m;
    119.  
    120.     #    ssl_protocols  SSLv2 SSLv3 TLSv1;
    121.     #    ssl_ciphers  ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
    122.     #    ssl_prefer_server_ciphers   on;
    123.  
    124.     #    location / {
    125.     #        root   html;
    126.     #        index  index.html index.htm;
    127.     #    }
    128.     #}
    129.  
    130. }
     
  11. like2dev

    like2dev Активный пользователь

    С нами с:
    31 июл 2010
    Сообщения:
    24
    Симпатии:
    0
    Код (Text):
    1. ;;;;;;;;;;;;;;;;;;;;;
    2. ; FPM Configuration ;
    3. ;;;;;;;;;;;;;;;;;;;;;
    4.  
    5. ; All relative paths in this configuration file are relative to PHP's install
    6. ; prefix.
    7.  
    8. ; Include one or more files. If glob(3) exists, it is used to include a bunch of
    9. ; files from a glob(3) pattern. This directive can be used everywhere in the
    10. ; file.
    11. ;include=/opt/php5/etc/fpm.d/*.conf
    12.  
    13. ;;;;;;;;;;;;;;;;;;
    14. ; Global Options ;
    15. ;;;;;;;;;;;;;;;;;;
    16.  
    17. [global]
    18. ; Pid file
    19. ; Default Value: none
    20. pid = /opt/php5/var/run/php-fpm.pid
    21.  
    22. ; Error log file
    23. ; Default Value: /opt/php5/var/log/php-fpm.log
    24. error_log = /opt/php5/var/log/php-fpm.log
    25.  
    26. ; Log level
    27. ; Possible Values: alert, error, warning, notice, debug
    28. ; Default Value: notice
    29. log_level = debug
    30.  
    31. ; If this number of child processes exit with SIGSEGV or SIGBUS within the time
    32. ; interval set by emergency_restart_interval then FPM will restart. A value
    33. ; of '0' means 'Off'.
    34. ; Default Value: 0
    35. ;emergency_restart_threshold = 0
    36.  
    37. ; Interval of time used by emergency_restart_interval to determine when
    38. ; a graceful restart will be initiated.  This can be useful to work around
    39. ; accidental corruptions in an accelerator's shared memory.
    40. ; Available Units: s(econds), m(inutes), h(ours), or d(ays)
    41. ; Default Unit: seconds
    42. ; Default Value: 0
    43. ;emergency_restart_interval = 0
    44.  
    45. ; Time limit for child processes to wait for a reaction on signals from master.
    46. ; Available units: s(econds), m(inutes), h(ours), or d(ays)
    47. ; Default Unit: seconds
    48. ; Default Value: 0
    49. ;process_control_timeout = 0
    50.  
    51. ; Send FPM to background. Set to 'no' to keep FPM in foreground for debugging.
    52. ; Default Value: yes
    53. ;daemonize = yes
    54.  
    55. ;;;;;;;;;;;;;;;;;;;;
    56. ; Pool Definitions ;
    57. ;;;;;;;;;;;;;;;;;;;;
    58.  
    59. ; Multiple pools of child processes may be started with different listening
    60. ; ports and different management options.  The name of the pool will be
    61. ; used in logs and stats. There is no limitation on the number of pools which
    62. ; FPM can handle. Your system will tell you anyway :)
    63.  
    64. ; Start a new pool named 'www'.
    65. [www]
    66.  
    67. ; The address on which to accept FastCGI requests.
    68. ; Valid syntaxes are:
    69. ;   'ip.add.re.ss:port'    - to listen on a TCP socket to a specific address on
    70. ;                            a specific port;
    71. ;   'port'                 - to listen on a TCP socket to all addresses on a
    72. ;                            specific port;
    73. ;   '/path/to/unix/socket' - to listen on a unix socket.
    74. ; Note: This value is mandatory.
    75. ;listen = 127.0.0.1:9000
    76. listen = /var/run/php-fpm.sock
    77.  
    78. ; Set listen(2) backlog. A value of '-1' means unlimited.
    79. ; Default Value: -1
    80. ;listen.backlog = -1
    81.  
    82. ; List of ipv4 addresses of FastCGI clients which are allowed to connect.
    83. ; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original
    84. ; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address
    85. ; must be separated by a comma. If this value is left blank, connections will be
    86. ; accepted from any ip address.
    87. ; Default Value: any
    88. ;listen.allowed_clients = 127.0.0.1
    89.  
    90. ; Set permissions for unix socket, if one is used. In Linux, read/write
    91. ; permissions must be set in order to allow connections from a web server. Many
    92. ; BSD-derived systems allow connections regardless of permissions.
    93. ; Default Values: user and group are set as the running user
    94. ;                 mode is set to 0666
    95. listen.owner = www-data
    96. listen.group = www-data
    97. listen.mode = 0666
    98.  
    99. ; Unix user/group of processes
    100. ; Note: The user is mandatory. If the group is not set, the default user's group
    101. ;       will be used.
    102. user = www-data
    103. group = www-data
    104.  
    105. ; Choose how the process manager will control the number of child processes.
    106. ; Possible Values:
    107. ;   static  - a fixed number (pm.max_children) of child processes;
    108. ;   dynamic - the number of child processes are set dynamically based on the
    109. ;             following directives:
    110. ;             pm.max_children      - the maximum number of children that can
    111. ;                                    be alive at the same time.
    112. ;             pm.start_servers     - the number of children created on startup.
    113. ;             pm.min_spare_servers - the minimum number of children in 'idle'
    114. ;                                    state (waiting to process). If the number
    115. ;                                    of 'idle' processes is less than this
    116. ;                                    number then some children will be created.
    117. ;             pm.max_spare_servers - the maximum number of children in 'idle'
    118. ;                                    state (waiting to process). If the number
    119. ;                                    of 'idle' processes is greater than this
    120. ;                                    number then some children will be killed.
    121. ; Note: This value is mandatory.
    122. pm = dynamic
    123.  
    124. ; The number of child processes to be created when pm is set to 'static' and the
    125. ; maximum number of child processes to be created when pm is set to 'dynamic'.
    126. ; This value sets the limit on the number of simultaneous requests that will be
    127. ; served. Equivalent to the ApacheMaxClients directive with mpm_prefork.
    128. ; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP
    129. ; CGI.
    130. ; Note: Used when pm is set to either 'static' or 'dynamic'
    131. ; Note: This value is mandatory.
    132. pm.max_children = 20
    133.  
    134. ; The number of child processes created on startup.
    135. ; Note: Used only when pm is set to 'dynamic'
    136. ; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2
    137. pm.start_servers = 10
    138.  
    139. ; The desired minimum number of idle server processes.
    140. ; Note: Used only when pm is set to 'dynamic'
    141. ; Note: Mandatory when pm is set to 'dynamic'
    142. pm.min_spare_servers = 5
    143.  
    144. ; The desired maximum number of idle server processes.
    145. ; Note: Used only when pm is set to 'dynamic'
    146. ; Note: Mandatory when pm is set to 'dynamic'
    147. pm.max_spare_servers = 10
    148.  
    149. ; The number of requests each child process should execute before respawning.
    150. ; This can be useful to work around memory leaks in 3rd party libraries. For
    151. ; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS.
    152. ; Default Value: 0
    153. pm.max_requests = 500
    154.  
    155. ; The URI to view the FPM status page. If this value is not set, no URI will be
    156. ; recognized as a status page. By default, the status page shows the following
    157. ; information:
    158. ;   accepted conn    - the number of request accepted by the pool;
    159. ;   pool             - the name of the pool;
    160. ;   process manager  - static or dynamic;
    161. ;   idle processes   - the number of idle processes;
    162. ;   active processes - the number of active processes;
    163. ;   total processes  - the number of idle + active processes.
    164. ; The values of 'idle processes', 'active processes' and 'total processes' are
    165. ; updated each second. The value of 'accepted conn' is updated in real time.
    166. ; Example output:
    167. ;   accepted conn:   12073
    168. ;   pool:             www
    169. ;   process manager:  static
    170. ;   idle processes:   35
    171. ;   active processes: 65
    172. ;   total processes:  100
    173. ; By default the status page output is formatted as text/plain. Passing either
    174. ; 'html' or 'json' as a query string will return the corresponding output
    175. ; syntax. Example:
    176. ;   http://www.foo.bar/status
    177. ;   http://www.foo.bar/status?json
    178. ;   http://www.foo.bar/status?html
    179. ; Note: The value must start with a leading slash (/). The value can be
    180. ;       anything, but it may not be a good idea to use the .php extension or it
    181. ;       may conflict with a real PHP file.
    182. ; Default Value: not set
    183. pm.status_path = /fpm-status
    184.  
    185. ; The ping URI to call the monitoring page of FPM. If this value is not set, no
    186. ; URI will be recognized as a ping page. This could be used to test from outside
    187. ; that FPM is alive and responding, or to
    188. ; - create a graph of FPM availability (rrd or such);
    189. ; - remove a server from a group if it is not responding (load balancing);
    190. ; - trigger alerts for the operating team (24/7).
    191. ; Note: The value must start with a leading slash (/). The value can be
    192. ;       anything, but it may not be a good idea to use the .php extension or it
    193. ;       may conflict with a real PHP file.
    194. ; Default Value: not set
    195. ;ping.path = /ping
    196.  
    197. ; This directive may be used to customize the response of a ping request. The
    198. ; response is formatted as text/plain with a 200 response code.
    199. ; Default Value: pong
    200. ;ping.response = pong
    201.  
    202. ; The timeout for serving a single request after which the worker process will
    203. ; be killed. This option should be used when the 'max_execution_time' ini option
    204. ; does not stop script execution for some reason. A value of '0' means 'off'.
    205. ; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
    206. ; Default Value: 0
    207. ;request_terminate_timeout = 0
    208.  
    209. ; The timeout for serving a single request after which a PHP backtrace will be
    210. ; dumped to the 'slowlog' file. A value of '0s' means 'off'.
    211. ; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
    212. ; Default Value: 0
    213. ;request_slowlog_timeout = 0
    214.  
    215. ; The log file for slow requests
    216. ; Default Value: /opt/php5/var/log/php-fpm.log.slow
    217. slowlog = /opt/php5/var/log/php-fpm.log.slow
    218.  
    219. ; Set open file descriptor rlimit.
    220. ; Default Value: system defined value
    221. ;rlimit_files = 1024
    222.  
    223. ; Set max core size rlimit.
    224. ; Possible Values: 'unlimited' or an integer greater or equal to 0
    225. ; Default Value: system defined value
    226. ;rlimit_core = 0
    227.  
    228. ; Chroot to this directory at the start. This value must be defined as an
    229. ; absolute path. When this value is not set, chroot is not used.
    230. ; Note: chrooting is a great security feature and should be used whenever
    231. ;       possible. However, all PHP paths will be relative to the chroot
    232. ;       (error_log, sessions.save_path, ...).
    233. ; Default Value: not set
    234. ;chroot =
    235.  
    236. ; Chdir to this directory at the start. This value must be an absolute path.
    237. ; Default Value: current directory or / when chroot
    238. ;chdir = /var/www
    239.  
    240. ; Redirect worker stdout and stderr into main error log. If not set, stdout and
    241. ; stderr will be redirected to /dev/null according to FastCGI specs.
    242. ; Default Value: no
    243. ;catch_workers_output = yes
    244.  
    245. ; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from
    246. ; the current environment.
    247. ; Default Value: clean env
    248. ;env[HOSTNAME] = $HOSTNAME
    249. ;env[PATH] = /usr/local/bin:/usr/bin:/bin
    250. ;env[TMP] = /tmp
    251. ;env[TMPDIR] = /tmp
    252. ;env[TEMP] = /tmp
    253.  
    254. ; Additional php.ini defines, specific to this pool of workers. These settings
    255. ; overwrite the values previously defined in the php.ini. The directives are the
    256. ; same as the PHP SAPI:
    257. ;   php_value/php_flag             - you can set classic ini defines which can
    258. ;                                    be overwritten from PHP call 'ini_set'.
    259. ;   php_admin_value/php_admin_flag - these directives won't be overwritten by
    260. ;                                     PHP call 'ini_set'
    261. ; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no.
    262.  
    263. ; Defining 'extension' will load the corresponding shared extension from
    264. ; extension_dir. Defining 'disable_functions' or 'disable_classes' will not
    265. ; overwrite previously defined php.ini values, but will append the new value
    266. ; instead.
    267.  
    268. ; Default Value: nothing is defined by default except the values in php.ini and
    269. ;                specified at startup with the -d argument
    270. ;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f www@my.domain.com
    271. php_flag[display_errors] = on
    272. php_admin_value[error_log] = /var/log/php-fpm/php-fpm.wwwerror.log
    273. php_admin_flag[log_errors] = on
    274. php_admin_value[memory_limit] = 64M
    275. php_admin_value[date.timezone] = US/Central
     
  12. like2dev

    like2dev Активный пользователь

    С нами с:
    31 июл 2010
    Сообщения:
    24
    Симпатии:
    0
    Все разобрался исправил с сокета на тсп порт биндинг и все заработало
     
  13. 440Hz

    440Hz Старожил
    Команда форума Модератор

    С нами с:
    21 дек 2012
    Сообщения:
    8.003
    Симпатии:
    1
    Адрес:
    Оттуда
    лучше сокет оставь. быстрее будет.
     
  14. like2dev

    like2dev Активный пользователь

    С нами с:
    31 июл 2010
    Сообщения:
    24
    Симпатии:
    0
    Если чесно я так и сдела) Просто понял что engine x ссылался на tcp adress, а php-fpm работал как сокет.