PHP related paths and modification methods in Ubuntu environment

PHP related paths and modification methods in Ubuntu environment

PHP related paths in Ubuntu environment

  1. PHP path /usr/bin/php
  2. phpize5 /usr/bin/phpize5
  3. php5-fpm /usr/sbin/php5-fpm
  4. All php configuration files /etc/php5/fpm
  5. Restart php-fpm sudo kill -USR2 `cat /var/run/php5-fpm.pid`

How to change the development directory path of PHP in Apache2 in Ubuntu

After installing PHP and Apache,
How to set the development directory to the desired one?

The default development directory address: /var/www

Change:sudo vim /etc/apache2/sites-available/default

Change the two /var/www in it to the directory you want, mine is /home/dev/www

Or create a symbolic link under /home/dev:

ln -s www /var/www (note that www cannot exist in /home/dev)

Then change the permissions: sudo chmod 777 /var/www

Start apache2

sudo /etc/init.d/apache2 restart

OK!
You can write a script to test it! ! !

Modify the default root directory of the website under Ubuntu10 Apache2 php5

Modify the default document directory of apache2 in ubuntu10.10. The default directory is in /var/www
sudo gedit /etc/apache2/sites-enabled/000-default
Find DocumentRoot in the document and modify the directory where you want to place the web page files.

as follows:

<VirtualHost *:80>
	ServerAdmin webmaster@localhost
	DocumentRoot /var/www/
	<Directory />
		Options FollowSymLinks
		AllowOverride None
	</Directory>
	<Directory /var/www/>
		Options Indexes FollowSymLinks MultiViews
		AllowOverride None
		Order allow, deny
		allow from all
	</Directory>
	ScriptAlias ​​/cgi-bin/ /usr/lib/cgi-bin/
	<Directory "/usr/lib/cgi-bin">
		AllowOverride None
		Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
		Order allow, deny
		Allow from all
	</Directory>
	ErrorLog ${APACHE_LOG_DIR}/error.log
 
	# Possible values ​​include: debug, info, notice, warn, error, crit,
	# alert, emerg.
	LogLevel warn
	CustomLog ${APACHE_LOG_DIR}/access.log combined
  Alias ​​/doc/ "/usr/share/doc/"
  <Directory "/usr/share/doc/">
    Options Indexes MultiViews FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
    Allow from 127.0.0.0/255.0.0.0 ::1/128
  </Directory>
</VirtualHost>
<VirtualHost *:8080>
	DocumentRoot /var/www/
</VirtualHost>

The last step is to restart apache

sudo /etc/init.d/apache2 restart

Ubuntu modifies the web root directory

Change the default document root directory
The default directory for Ubuntu is /var/www/html
Need to modify /setc/apache2/sites-enabled/000-default.conf
DocumentRoot /var/www/XXX is enough. Of course, you also need to set permissions, so you can check Ubuntu permission settings

Ubuntu permission settings

How to use chmod in Ubuntu (using numbers to assign permissions)

Essential

Ubuntu file permissions are divided into read, write, and execute according to the number. According to the binary assignment, the number 4 represents the read permission-------'r'
The number 2 represents write permission------'w'
The number 1 represents the execution permission------'x'
The number 0 means no permissions----'-'

File permissions are divided into user, group user, and other

'123' '1' represents the user, '2' represents the group user, and '3' represents other basic commands to learn and view file permissions
ls -ld file name // view file permissions
ls -l //View the permissions of all files in the folder and set the permissions of the files
chmod 777 filename //7 = 1 + 2 + 4 So the file permissions are read, write, and executable for all roles
chmod 124 file name //Users have execution permissions, group users have write permissions, and others have read permissions. Set permissions for all files in the folder.
chmod -R 777 file //All permissions under the file are changed to 7

Ubuntu Modify Apache2 website root directory and default web page

  1. Modify the root directory:
    Modify 000-default.conf in /etc/apache2/sites-available
    Change DocumentRoot /var/www/ in the directory to the desired directory, for example: DocumentRoot /var/www/html/dokuwiki
    Restart after modification: sudo /etc/init.d/apache2 restart

  2. To modify the default web page:
    Modify the content in /etc/apache2/mods-available/dir.conf:

<IfModule mod_dir.c>
  DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm
</IfModule>

Add the desired files or paths, the priority is to read from the beginning to the end (if there is no file, read the next one), such as adding index.php, dokuwiki

<IfModule mod_dir.c>
  DirectoryIndex dokuwiki index.php index.html index.cgi index.pl index.php index.xhtml index.htm 
</IfModule>

This is the end of this article about PHP-related paths in Ubuntu environment. For more relevant Ubuntu PHP path content, please search 123WORDPRESS.COM's previous articles or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future!

<<:  Vue implements multi-grid input box on mobile terminal

>>:  MySQL 8.0.23 installation super detailed tutorial

Recommend

A brief discussion on HTML table tags

Mainly discuss its structure and some important pr...

Detailed process of building mongodb and mysql with docker-compose

Let's take a look at the detailed method of b...

Issues installing Python3 and Pip in ubuntu in Docker

text 1) Download the Ubuntu image docker pull ubu...

Example of how to change the line spacing of HTML table

When using HTML tables, we sometimes need to chan...

vue3 timestamp conversion (without using filters)

When vue2 converts timestamps, it generally uses ...

Nginx uses the Gzip algorithm to compress messages

What is HTTP Compression Sometimes, relatively la...

Analysis of GTK treeview principle and usage

The GtkTreeView component is an advanced componen...

Nodejs module system source code analysis

Table of contents Overview CommonJS Specification...

vue+springboot realizes login verification code

This article example shares the specific code of ...

MySQL database architecture details

Table of contents 1. MySQL Architecture 2. Networ...

Detailed explanation of the concept, principle and usage of MySQL triggers

This article uses examples to explain the concept...

Detailed explanation of hosts file configuration on Linux server

Linux server hosts file configuration The hosts f...

Data URI and MHTML complete solution for all browsers

Data URI Data URI is a scheme defined by RFC 2397...