How to deploy laravel and xhprof in LNMP, laravelxhprof

Source: Internet
Author: User

How to deploy laravel and xhprof in LNMP, laravelxhprof

Preface

This article describes how to deploy laravel and xhprof throughout the entire process. I will share the content for your reference. I will not talk about it much here. Let's take a look at the detailed introduction.

The LNMP integrated environment (lnmp.org can be installed quickly) to ensure the normal operation of the network.

First, configure the laravel Runtime Environment

1. Upload the code to/home/wwwroot/default/

2. Modify the root and rewrite configurations of the nginx configuration file.

# Root configuration for your own access path # introduce pathinfo configuration, comment out the include enable-php.confinclude enable-php-pathinfo.conf; # Add rewrite rule location/{if (! -E $ request_filename) {rewrite ^/(. *) $/index. php/$1 last; break ;}} location ~ /Index. php {fastcgi_pass 127.0.0.1: 9000; fastcgi_index index. php; fastcgi_param SCRIPT_FILENAME $ document_root/index. php; include fastcgi_params; fastcgi_param APPLICATION_ENV dev ;}

3. Modify permissions

# Modify storage and vendor to 777 for the laravel project. The value cannot be 775 $ chmod-R 777 storage vendor.

4. In the public directory specified by laravel, cross-directory protection is required.

# If you do not want to use anti-Cross-directory or modify on LNMP 1.4. user. to prevent cross-directory directories of ini, you also need to set/usr/local/nginx/conf/fastcgi. fastcgi_param PHP_ADMIN_VALUE "open_basedir = $ document_root/:/tmp/:/proc/" in the conf file; add # or delete the line before the line, and restart nginx.

5. Database Operations (data operations can be omitted based on your own situation)

# Grant all external permissions grant all privileges on *. * TO 'root' @ '%' identified by 'root' with grant option; # Write the database and other information

Install and configure xhprof

1. Download and install xhprof

$ Cd/home/wwwroot/default $ wget http://pecl.php.net/get/xhprof-0.9.4.tgz$ tar-zxvf xhprof-0.9.4.tgz xhprof $ mv xhprof-0.9.4 xhprof $ cd extension/$ phpize $. /configure -- with-php-config =/usr/local/php/bin/php-config -- enable-xhprof # configure $ make $ sudo make install with your php installation closer

2. Modify php. ini

# Add to the end of [xhprof] extension = xhprof. soxhprof. output_dir =/tmp/xhprof # create xhprof under tmp and grant the read and write permissions $ cd/tmp & mkdir xhprof $ chmod-R 777 xhprof

3. Install graphviz

$ cd && yum -y install graphviz

4. Add a vhost (for example, www.xhproftest.com)

# Upgrade lnmp vhost add # Modify/usr/local/nginx/conf/vhost/www.xhproftest.com. in the conf configuration file, set nginx. conf server copies and modifies the port, access path, and server_name. # Restart Nginx

Configure xhprof in the laravel Project

# Start xhprof Performance Analyzer xhprof_enable (kernel | XHPROF_FLAGS_CPU | XHPROF_FLAGS_MEMORY); # Test content foo (); # Stop xhprof Performance Analyzer $ xhprofData = xhprof_disable (); # Write the require path require '/home/wwwroot/xhprof/xhprof_lib/utils/xhprof_lib.php' based on the xhprof installed by yourself '; require '/home/wwwroot/xhprof/xhprof_lib/utils/upload'; $ xhprofRuns = new example (); $ runId = $ xhprofRuns-> save_run _ Test '); echo 'HTTP: // localhost/xhprof/xhprof_html/index. php? Run = '. $ runId.' & source = xhprof_test ';

Summary

The above is all the content of this article. I hope the content of this article has some reference and learning value for everyone's learning or work. If you have any questions, please leave a message to us, thank you for your support.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.