GVKun编程网logo

windows 与 linux 下composer的安装与常用命令(windows、linux)

1

本文将为您提供关于windows与linux下composer的安装与常用命令的详细介绍,我们还将为您解释windows、linux的相关知识,同时,我们还将为您提供关于C#windows窗体应用程序

本文将为您提供关于windows 与 linux 下composer的安装与常用命令的详细介绍,我们还将为您解释windows、linux的相关知识,同时,我们还将为您提供关于C# windows 窗体应用程序 Word Interop 适用于 Windows 7 但不适用于 Windows 10、Linux on Windows with LinaLina,在 Windows 上使用 Linux、Linux PHP53升级PHP5533 linux php升级5.5 php5.2 for linux linux libphp5.s、Linux 和 windows 互传文件,用户配置文件和密码配置文件,用户和用户组的管理 Linux 和 windows 互传文件我们会遇到需要把 pc 上的一个文件上传到 Linux 上,或者需要把 Linux 上的某一个的实用信息。

本文目录一览:

windows 与 linux 下composer的安装与常用命令(windows、linux)

windows 与 linux 下composer的安装与常用命令(windows、linux)

安装

首先,你得配置好 php 的环境变量。建议php版本在5.4及以上版本。

windows下composer安装


  • 方法一

下载并执行 https://getcomposer.org/Composer-Setup.exe


  • 方法二
  1. 下载 composer 的phar的文件,至php.exe同级目录
    https://getcomposer.org/download/
  2. 在同目录新建 composer.bat 写入内容
 @ECHO OFF  
 	php "%~dp0composer.phar" %*

再双击执行
3. 黑窗口执行 composer -v 是否执行成功
4. 添加国内源

composer config -g repo.packagist composer https://packagist.phpcomposer.com

linux composer安装


  1. 下载composer.phar
curl -sS https://getcomposer.org/installer | php
  1. 将composer.phar文件移动到bin目录以便全局使用composer命令
mv composer.phar /usr/local/bin/composer
  1. 添加国内源 //注意。此步骤需要切换至非root用户才能执行,不然composer会报错
composer config -g repo.packagist composer https://packagist.phpcomposer.com

常用命令


composer update 安装composer.json的全部的包
composer require monolog/monolog 安装指定的包(monolog/monolog)
composer update monolog/monolog 更新指定的包(monolog/monolog)
composer remove monolog/monolog 移除指定的包(monolog/monolog)
composer dump-autoload 手动更新composer.json

composer clear-cache 清除缓存
composer self-update 更新到最新版本
composer dumpauto 更新自动加载项
composer validate 检测composer.json 文件是否有效
composer create-project 基于composer创建一个新的项目 **

在linux下执行composer相关命令,可以遇到如下错误:

问题:/usr/bin/env: php: No such file or directory
原因:php没有安装在/usr/local/bin
解决方案:建立软链接 ln -s /usr/local/php/bin/php /usr/local/bin/php

C# windows 窗体应用程序 Word Interop 适用于 Windows 7 但不适用于 Windows 10

C# windows 窗体应用程序 Word Interop 适用于 Windows 7 但不适用于 Windows 10

如何解决C# windows 窗体应用程序 Word Interop 适用于 Windows 7 但不适用于 Windows 10

我编写了一个应用程序来帮助用户使用 C# 生成字母。我创建了以富文本格式保存在 sql Server 数据库中的模板。我的开发机器是 Windows 7,我使用 Visual Studio 2019 来编写应用程序。我使用 NuGet 添加 Word 的互操作引用。该应用程序配置为面向 x86 的 Release、平台 Active(Any cpu)。它是一个 ClickOnce 应用程序,从共享驱动器安装在一个单独的目录中,但与保存字母的驱动器相同。

该应用程序在我的机器上正常运行,但在 Windows 10 用户机器上运行不正常。当它尝试保存文件时,她收到一条错误消息,提示“抱歉,我们找不到该文件”。我们都有 Word 2016。两台机器都是 64 位。我将这封信保存为 Word 中的备份,然后导出为 PDF。在导出为 PDF 之前,代码无法保存 Word 文档。请参阅下面的代码片段:

  1. public static void SavetoWord2(string CoverLetter,string LetterText,string FileSave,string BackUpSave,ref string ErrorString)
  2. {
  3. try
  4. {
  5. Microsoft.Office.Interop.Word.Application oWord = new Microsoft.Office.Interop.Word.Application();
  6. string headerfooterFile = Properties.FileResources.headerfooterTemplate;
  7. Document odoc = new Document();
  8. odoc = oWord.Documents.Add(@headerfooterFile);
  9. odoc.Activate();
  10. try
  11. {
  12. Clipboard.Clear();
  13. Clipboard.SetText(CoverLetter,TextDataFormat.Rtf);
  14. odoc.ActiveWindow.Selection.Paste();
  15. Clipboard.Clear();
  16. Clipboard.SetText(LetterText,TextDataFormat.Rtf);
  17. odoc.ActiveWindow.Selection.Paste();
  18. //01/26/2021 JS having trouble with the save on Pam''s machine so going to try to capture the correct error.
  19. try
  20. {
  21. odoc.SaveAs(@BackUpSave);
  22. }
  23. catch (Exception exBU)
  24. {
  25. ErrorString = "Error trying to save " + @BackUpSave + ": " + exBU.Message;
  26. }
  27. try
  28. {
  29. odoc.ExportAsFixedFormat(@FileSave,WdExportFormat.wdExportFormatPDF);
  30. }
  31. catch (Exception exPDF)
  32. {
  33. if (string.IsNullOrEmpty(ErrorString))
  34. {
  35. ErrorString = "Error trying to save " + @FileSave + " PDF: " + exPDF.Message;
  36. }
  37. else
  38. {
  39. ErrorString += " and Error trying to save " + @FileSave + " PDF: " + exPDF.Message;
  40. }
  41. }
  42. }
  43. catch (Exception exInner)
  44. {
  45. ErrorString = exInner.Message;
  46. MessageBox.Show(exInner.Message,Properties.LetterResources.SavetoWord,MessageBoxButtons.OK,MessageBoxIcon.Error);
  47. }
  48. Clipboard.Clear();
  49. oWord.Quit(SaveChanges: 0);
  50. Marshal.FinalReleaseComObject(oWord);
  51. //oWord.Visible = true;
  52. }
  53. catch (Exception ex)
  54. {
  55. ErrorString = ex.Message;
  56. MessageBox.Show(ex.Message,MessageBoxIcon.Error);
  57. }
  58. }

错误发生在 odoc.SaveAs 行上,但仅在从 Windows 10 计算机运行时发生。最初,我使用了我机器上的互操作,但后来将其更改为 NuGet 互操作,但这并没有解决问题。我尝试将 Embed Interop Types 更改为 False 但这并没有解决任何问题,因此我将其改回。互操作引用的别名属性是全局的,特定版本属性是 True。由于富文本,我担心更改文档编写器的类型。应用程序的其余部分对于 Windows 10 用户来说运行良好。有什么想法吗?

解决方法

OpenXML 没有成功,因为它不允许我正确添加标题或导出为 PDF。尽管我非常希望使用 OpenXML,但我最终还是回到了 Word Interop。我能够通过如下设置参考属性来解决这个问题:

嵌入互操作类型 = False 复制本地 = True

现在无论哪个操作系统运行程序,保存都有效。我有上面的部分答案,但忽略了 Copy Local = true 部分。

Linux on Windows with LinaLina,在 Windows 上使用 Linux

Linux on Windows with LinaLina,在 Windows 上使用 Linux

Between WINE, VMware, BOCHs and virtual machines, we''re spoilt for choice when it comes to running Windows applications on Linux. But what about the other way around? Cygwin aside, there is another way.
在WINE、VMWARE 以及其它的一些虚拟机之间,我们可以任意选择一样来在LINUX系统下运行WINDOWS应用程序,但如果放过来呢?Cygwin 之外,我们又多了一条路。

LINA on Windows: Source: LINA

Between WINE, VMware, BOCHs and ilk -- not to mention the renewed focus on virtualisation we''re now seeing -- we''re somewhat spoilt for choice when it comes to running Windows applications on Linux. But what about the other way around? Cygwin aside, there is another way.

It goes by the name of LINA, and after four years of development , it is due for release later next month. Building off a concept similar to Java, LINA aims to provide open-source developers the ability to compile applications that will run on all of Windows, MacOS X, and various Unix systems. Additionally, it promises to do so using each OS'' own interface libraries -- so a Linux application on Windows doesn''t look out of place -- and runs them within their own contained environment to ensure they don''t play up.

This is, of course, somewhat of a holy grail and raises all sorts of questions -- like just how easy is it to use, how does it perform, and what changes if any need to be made to Linux applications to run on the Lina platform.

While we won''t know until the next month when the product is released, we did fire off a bunch of questions to LINA developer Nile Geisinger, and got these answers:

How are Linux applications for LINA built?

Applications are recompiled using our versions of standard Linux libraries. Developers and maintainers can include a simple script to automatically build a LINA binary every time they make a release of their project.

What exactly is in a LINA executable?

Our Linux executables are bundled in zip files that contain configuration files and native executables for each platform.

What if you want to alter the ini files of an app, do you make changes directly to the files within the zip, or is it more complex than that?

Good question. The user can edit files that they normally would edit. For example, if they install Apache, they can modify their httpd.conf file in the same way they normally would.

What happens if applications depend on, for eg, a glibc library version that Lina doesn''t support?

In cases where an application depends upon a specific version of a library like glibc, they can statically link the libraries they need into their application without waiting for a new release of LINA.

Do you already have a repository of applications compiled for Lina ready to go, and if so which ones?

We do not have a repository, but we will have several demos that will be revealed upon release.

Is the ''secure and stable execution platform'' a function of the host OS or Lina? For eg -- permissions, is Lina enforcing access permissions or relying on those set by the OS?

Applications only have access to resources of the user''s operating system that LINA enables them to have access to. In addition to the OS enforcing permissions, LINA has been architected so that it can also enforce access permissions on an application by application basis. We plan on providing developers with tools that allow them to specify these permissions in the future.

Are OpenGL applications supported as well?

We are not supporting OpenGL in the short-term. Given the interest, though, we expect OpenGL support will emerge fairly quickly.

Speed -- how fast is it compared to a native application?

There is a 2X performance hit for running applications in LINA. In the short-term, there is also an additional performance hit for GUI applications. This additional performance hit will be eliminated when we optimize the mechanism by which we make operating system calls.

Lina is dual-licensed under the GPLv2 and a commercial license. What does the commercial license entail?

We are currently working out the details of the commercial license.

Finally, one other question -- where do you class LINA in the line between interpreters and bytecode, and virtualisation? It appears to be taking from each, so how would you describe it?

Nope, you''re right. LINA is borrowing from several existing categories that are normally quite separate from one another.

It all sounds rather intriguing, so you can be sure we''ll check it out when it''s released. For more on LINA check out the homepage at www.openlina.com and the demonstration videos . We''re told LINA is due for release ''mid-july'' and will initially provide the Lina framework for Windows XP/200/Vista, MacOS X, Fedora, OpenSuse and Ubuntu.

Linux PHP53升级PHP5533 linux php升级5.5 php5.2 for linux linux libphp5.s

Linux PHP53升级PHP5533 linux php升级5.5 php5.2 for linux linux libphp5.s

Linux 和 windows 互传文件,用户配置文件和密码配置文件,用户和用户组的管理 Linux 和 windows 互传文件我们会遇到需要把 pc 上的一个文件上传到 Linux 上,或者需要把 Linux 上的某一个

Linux 和 windows 互传文件,用户配置文件和密码配置文件,用户和用户组的管理 Linux 和 windows 互传文件我们会遇到需要把 pc 上的一个文件上传到 Linux 上,或者需要把 Linux 上的某一个

linux 和 Windows 互传文件

如何实现linux和Windows互传文件,在这里介绍一个插件,**lrzsz**
putty不支持

先使用 yum 按照一个插件 yum install -y lrzsz

[root@zhangzhen-01 ~]# yum install -y lrzsz
[root@zhangzhen-01 ~]# sz a.txt #r 表示远程

注:sz 把 linux 上的文件传送到 Windows 上

[root@zhangzhen-01 ~]# rz (在哪个目录下就传到了哪个目录)

注:rz 把 Windows 上的文件传送到 linux 上

用户配置文件和密码配置文件

/etc/passwd 含义

/etc/passwd是由 “ :” 分割7个字段,每个字段的含义如下:
第1个字段为用户名;
第2个字段为该账号的口令,存储的是密码;
第3个字段为一个数字,这个数字代表用户标识号,也称为“uid”,在这里,用户标识号是从1000开始,如果我们创建一个普通用户,该账号的uid是从1000以后往下排序的;
第4个字段也是数字,该字段标识组标识号,称gid,这个字段对应着/etc/group中的一条记录,其实/etc/group和/etc/passwd相似;
第5个字段标识注释信息;
第6个字段为普通用户的家目录,root的家目录就是/root,普通用户的家目录则/home/username,用户的家目录也是可以修改的,在/etc/passwd配置文件中修改;
第7个字段为用户的shell,用户登录后,要启动一个进程们用来将用户下达的命令传给内核,实现一个交互的作用,这就是shell。

[root@zhangzhen-01 ~]# cat /etc/passwd #以下是创建了 3 个普通用户的信息
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
…………
zhangzhen-03:x:1000:1000::/home/zhangzhen-03:/bin/bash
user1:x:1001:1001::/home/user1:/bin/bash
zhang-02:x:1002:1002::/home/zhang-02:/bin/bash

/etc/shadow 含义,专门放用户的密码的配置文件

/etc/shadow 和 /etc/passwd 类似,由 9 个字段,示例如下:

我们看一下现在默认的配置:
[root@zhangzhen-01 ~]# head -n1 /etc/shadow ; tail -n3 /etc/shadow #head -n1 表示查看文件的第一行(在这里 root 的密码是用密文编写制成的,我们不可以反密文进行破解)。 “:” 分割,如果你想同时打两个命令的时候,用 “:” 进行分割。tail -n3 表示查看这个文件的最后三行。
root:$6$kN7rrKxW$9MRsf3mtd8CDdgZp25SCTdFp7ciymhS06FZe3z4oomxyxPrBMniWCktpqNlYmhmBGcWc8HSklX6b1ihRLKSfM1:17612:0:99999:7:::
zhangzhen-03:!!:17613:0:99999:7:::
user1:!!:17618:0:99999:7:::
zhang-02:!!:17619:0:99999:7:::
接下来我们给 user1 配置个密码:
[root@zhangzhen-01 ~]# passwd user1 #选择一个用户创建密码
passwd user1
更改用户 user1 的密码 。
新的 密码:
重新输入新的 密码:
passwd:所有的身份验证令牌已经成功更新。
接下来我们查看一下刚才的配置,user1 生成的密码也是以密文形式显示出来的:
[root@zhangzhen-01 ~]# head -n1 /etc/shadow ;tail -n3 /etc/shadow
root:$6$kN7rrKxW$9MRsf3mtd8CDdgZp25SCTdFp7ciymhS06FZe3z4oomxyxPrBMniWCktpqNlYmhmBGcWc8HSklX6b1ihRLKSfM1:17612:0:99999:7:::
zhangzhen-03:!!:17613:0:99999:7:::
user1:$6$gTcyr2nl$szsXaszsSj02hc1deEHB5sPYmENFOU1I1ydpB1H8Erjgv5Zf15zqP5P/k8CZfJH/2WtGuuI5dDCYbzAHLJctK0:17623:0:99999:7:::
zhang-02:!!:17619:0:99999:7:::
我们可以看一下 /etc/shadow 的使用说明:

   [root@zhangzhen-01 ~]# man shadow

   每个字段的含义是:

   ·   sp_namp - 指向以 null 结束的用户名的指针

   ·   sp_pwdp - 指向 null 结束的密码的指针

   ·   sp_lstchg - 最近更改密码的日期(日期计算方法是从197011日开始的天数)

   ·   sp_min - days before which password may not be changed

   ·   sp_max - days after which password must be changed

   ·   sp_warn - days before password is to expire that user is warned of pending password expiration

   ·   sp_inact - days after password expires that account is considered inactive and disabled

   ·   sp_expire - days since Jan 1, 1970 when account will be disabled

   ·   sp_flag - reserved for future use
   这里作为一个了解就好。

用户组管理

配置文件在 /etc/group, 我们可以用 cat /etc/group查看一下全部配置信息。
用户组密码配置文件在 /etc/gshadow下,在这里我们可以看见每个组的配置密码
命令格式:grouadd 后面跟想创建的组名,例:grouadd grp
创建制定Gid组格式:groupadd [-g GID] grp1,例:groupadd -g 1008 grp1

每一个配置文件下,都会有一个 “- 什么什么的文件”,这个是系统自动生成的备份,如下:

[root@zhangzhen-01 ~]# ls /etc/shadow #在这里我们可以看见,每一个配置文件后面系统会帮我们自动生成一个配置文件
shadow shadow- 
[root@zhangzhen-01 ~]# ls /etc/gshadow
gshadow gshadow- 
[root@zhangzhen-01 ~]# ls /etc/passwd
passwd passwd- 
[root@zhangzhen-01 ~]# ls /etc/group
group group-

如何创建一个用户组(不指定 GID,系统默认从 1000 起开始创建)

[root@zhangzhen-01 ~]# groupadd grp1
[root@zhangzhen-01 ~]# tail -n1 /etc/group
grp1:x:1004:

如何创建一个用户组且制定 GID,测试 GID 为 1008.。

[root@zhangzhen-01 ~]# groupadd -g 1008 grp2
[root@zhangzhen-01 ~]# !tail
tail -n1 /etc/group
grp2:x:1008:

如何删除一个组? groudel 后面跟组名

[root@zhangzhen-01 ~]# tail -n5 /etc/group
user1:x:1001:
zhang-02:x:1002:
grp:x:1003:
grp1:x:1004:
grp2:x:1008:
[root@zhangzhen-01 ~]# groupdel grp
注:这里 groudel 是删除,如果组面有用户,则删除不了。

用户管理

命令介绍:
useradd 增加用户 格式 : useradd 后面跟想创建的用户名
还有一种给创建的用户,增加组名及家目录什么的;
格式如下:useradd [-u UID] [-g GID] [-d HOME] [-M] [-s]-u 表示自定义UID 
-g 表示使新增用户属于已经存在的某个组,后面可以跟组的id,也可以跟组名
-d 表示自定义目录的家目录
-M 表示不建立家目录
-s 表示自定义shell

下面先来新建一个用户 user5, 示例命令如下:(在这里,useradd 不加任何选项,直接跟用户名,可以创建一个跟用户名同名的组)

[root@zhangzhen-01 ~]# useradd user5
[root@zhangzhen-01 ~]# tail -n1 /etc/passwd
user5:x:1003:1003::/home/user5:/bin/bash

现在自定义一个 uid,gid 和所属组用户的示例:

[root@zhangzhen-01 ~]# useradd -u1006 -g 1008 -M -s /sbin/nologin user6 # -u1006 表示自定义的 UID 且没有的情况下, 
-g 1008 表示自定义组且有的情况下,如果组没有的话,会提示报错,
-M 不创建用户的家目录,但是在 /etc/passwd 下可以看见这个字段,如果使用 ls /home/user6 查看的话,目录是不存在的。
这里 nologin 表示不可登录。

[root@zhangzhen-01 ~]# tail -n3 /etc/passwd
zhang-02:x:1002:1002::/home/zhang-02:/bin/bash
user5:x:1003:1003::/home/user5:/bin/bash
user6:x:1006:1008::/home/user6:/sbin/nologin

删除账户的命令 userdel

格式:userdel [-r] username 
其中-r选项的作用是,当删除用户时,一并删除用户的家目录。

不删除家目录的同时去删除用户 test3,保留家目录:

[root@zhangzhen-01 ~]# ls /home/test3/
[root@zhangzhen-01 ~]# ls -ld /home/test3/
drwx------. 2 test3 grp3 62 4 月 3 00:25 /home/test3/
[root@zhangzhen-01 ~]# userdel test3
[root@zhangzhen-01 ~]# ls -ld /home/test3/
drwx------. 2 1011 grp3 62 4 月 3 00:25 /home/test3/

注:只删除用户,并没有删除这个用户下的家目录。

我们再来试试删除 test2 试试,使用 - r 命令,并删除用户下的家目录

[root@zhangzhen-01 ~]# ls -ld /home/test2/
drwx------. 2 test2 test2 62 4 月 3 00:24 /home/test2/
[root@zhangzhen-01 ~]# userdel -r test2
[root@zhangzhen-01 ~]# !ls
ls -ld /home/test2/
ls: 无法访问 /home/test2/: 没有那个文件或目录

注:在这里添加 - r 选项,删除用户并且删除用户下的家目录。

此时已经删除成功,test2 的家目录已经不存在了

今天的关于windows 与 linux 下composer的安装与常用命令windows、linux的分享已经结束,谢谢您的关注,如果想了解更多关于C# windows 窗体应用程序 Word Interop 适用于 Windows 7 但不适用于 Windows 10、Linux on Windows with LinaLina,在 Windows 上使用 Linux、Linux PHP53升级PHP5533 linux php升级5.5 php5.2 for linux linux libphp5.s、Linux 和 windows 互传文件,用户配置文件和密码配置文件,用户和用户组的管理 Linux 和 windows 互传文件我们会遇到需要把 pc 上的一个文件上传到 Linux 上,或者需要把 Linux 上的某一个的相关知识,请在本站进行查询。

本文标签: