Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to build php Development Environment under ubuntu

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the relevant knowledge of "how to build a php development environment under ubuntu". The editor shows you the operation process through an actual case. The operation method is simple, fast and practical. I hope this article "how to build a php development environment under ubuntu" can help you solve the problem.

Because it is only a development environment, we all choose a relatively simple way to install apt-get, but we also encounter some problems in the middle.

Install nginx first

The installation and configuration of nginx is actually very simple. Nginx itself is very lightweight.

Just sudo apt-get install nginx is fine.

His configuration file is in / etc/nginx/, and the website project path is in / var/www. After installation, make sure that the startup account of nginx has access to the website directory, otherwise an error will be reported.

Step 2: install cgi

There are many cgi programs under linux. Here I choose php5-fpm to facilitate. There is actually a pit here. Many materials on the Internet say that the default port after installing cgi is 9000. I made a mistake here.

After installation, add the forwarding configuration of cgi to the servers of nginx

The copy code is as follows:

Location ~. *\ .php? $

{

Include fastcgi_params

Fastcgi_pass unix:/var/run/php5-fpm.sock

Fastcgi_index index.php

Fastcgi_param script_filename $document_root$fastcgi_script_name

}

The red mark should be paid attention to, which is different from other materials on the Internet.

Just reload the nginx configuration after saving it.

The copy code is as follows:

Sudo php5-fpm stop

Sudo php5-fpm start

Sudo service nginx reload

After the above steps, you can basically ensure that there is no problem with running php

Then install memcached

The copy code is as follows:

Sudo apt-get install memcached

After installing the memcache server, we need to start the service:

The copy code is as follows:

Memcached-d-M128-p 11111-u root

Xdebug installation

The copy code is as follows:

Sudo apt-get install php5-dev php5-cli

# where php5-dev must be installed in order to install xdebug.

Sudo apt-get install php5-xsl

# xsl extension is required for xinc

Sudo apt-get install php-pear

# required for pecl install

Sudo pecl install xdebug

# install xdebug. If the compilation is successful, the installation is complete.

Then add to the php configuration item

The copy code is as follows:

Zend_extension=xdebug.so

And then

The copy code is as follows:

Sudo php5-fpm stop

Sudo php5-fpm start

You can see the option of xdebug in phpinfo ();

This is the end of the introduction on "how to build a php development environment under ubuntu". Thank you for reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report