php5.5安裝及phpmyadmin&nginx配置php模組

來源:互聯網
上載者:User

標籤:cat   socket   ram   admin   amp   int   htm   wro   fas   

安裝php5.5;

下載源地址:rpm -Uvh

rpm包安裝:yum install php55w.x86_64 php55w-cli.x86_64 php55w-common.x86_64 php55w-gd.x86_64 php55w-ldap.x86_64 php55w-mbstring.x86_64 php55w-mcrypt.x86_64 php55w-mysql.x86_64 php55w-pdo.x86_64

安裝後如需要調用mysql模組需要安裝mysql依賴:

yum install php55w-mysql

至此,php就安裝完成了;

 

phpmyadmin也一樣可以用yum安裝:

yum install phpmyadmin

安裝完成後,需要修改設定檔資訊,比如mysql的資訊,為正確的資訊:

到phpmyadmin安裝目錄下面,/etc/phpMyAdmin/

編輯設定檔:config.inc.php

修改對應的mysql配置:

$cfg[‘Servers‘][$i][‘host‘]          = ‘www1.qixoo.com‘; // MySQL hostname or IP address

$cfg[‘Servers‘][$i][‘port‘]          = ‘60090‘;          // MySQL port

$cfg[‘Servers‘][$i][‘extension‘]     = ‘mysqli‘;    // The php MySQL extension to use (‘mysql‘ or ‘mysqli‘)

$cfg[‘Servers‘][$i][‘auth_type‘]     = ‘cookie‘;    // Authentication method (config, http or cookie based)

$cfg[‘Servers‘][$i][‘AllowRoot‘]     = TRUE;        // whether to allow root login

重點是修改mysql的連接埠為對應的mysql連接埠,如串連的是遠程mysql伺服器,則需要把localhost改為遠程伺服器的ip地址;

 

提供phpmyadmin服務:

將/usr/share/phpMyAdmin建立軟串連到/usr/share/nginx/html/下面,提供通過nginx訪問phpmyadmin;

配置nginx添加php模組:

到nginx設定檔裡,如/etc/nginx/conf.d/default.conf,添加如下配置:

    location ~ \.php$ {

        root           html;

        fastcgi_pass   127.0.0.1:9000;

        fastcgi_index  index.php;

        fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;

        include        fastcgi_params;

    }

完成後,重啟nginx;

啟動php,service php-fpm start

如頁面提示錯誤資訊,可能php模組調用有問題,需要修改nginx的fastcgi_params,替換為如下內容:

fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;

fastcgi_param  SERVER_SOFTWARE    nginx;

fastcgi_param  QUERY_STRING       $query_string;

fastcgi_param  REQUEST_METHOD     $request_method;

fastcgi_param  CONTENT_TYPE       $content_type;

fastcgi_param  CONTENT_LENGTH     $content_length;

fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;

fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;

fastcgi_param  REQUEST_URI        $request_uri;

fastcgi_param  DOCUMENT_URI       $document_uri;

fastcgi_param  DOCUMENT_ROOT      $document_root;

fastcgi_param  SERVER_PROTOCOL    $server_protocol;

fastcgi_param  REMOTE_ADDR        $remote_addr;

fastcgi_param  REMOTE_PORT        $remote_port;

fastcgi_param  SERVER_ADDR        $server_addr;

fastcgi_param  SERVER_PORT        $server_port;

fastcgi_param  SERVER_NAME        $server_name;

重啟nginx或者service nginx reload;

訪問phpmyadmin:

介面需要mysql的賬戶和密碼,配置正確即可登陸進去了;

 

php調用資料庫:

需要修改/etc/php.ini檔案,修改mysql的參數為正確的參數,如port,socket等;

php5.5安裝及phpmyadmin&nginx配置php模組

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.