1. 首页 > 汽车 >

phpstorm怎么配置php环境 php如何配置环境

ubuntuphp集成环境用哪个

(1)配置注释,直接嵌入到js文件中

在Ubuntu作系统上,可以选择以下几种常用的PHP集成开发环境(IDE):

phpstorm怎么配置php环境 php如何配置环境phpstorm怎么配置php环境 php如何配置环境


1、PhpStorm:PhpStorm是一款功能强大的PHP集成开发环境,提供代码自动完成、调试器、版本控制等一系列开发工具,适合专业的PHP开发人员使用。它是一款付费的IDE,但提供免费试用期。

2、VisualStudioCode:VisualStudioCode是一款免费且轻量级的代码编辑器,支持多种编程语言,包括PHP。它提供了丰富的插件生态系统,可以通过安装PHP相关的插件来增强PHP开发的体验。

3、SublimeText:SublimeText是一款受欢迎的文本编辑器,也支持PHP开发。它具有简洁的界面和快速的响应速度,并且提供了许多有用的特性和插件,可以提高开发效率。

4、EclipsePDT:EclipsePDT是Eclipse平台上的PHP开发工具,具备强大的编码支持,但并不表示支持React。(Yes, ESLint natively supports parsing JSX syntax (this must be enabled in configuration.). Please note that supporting JSX syntax is not the same as supporting React. React applies specific semantics to JSX syntax that ESLint doesn't recognize. We recommend using eslint-plugin-react if you are using React and want React semantics.)5.支持es7吗?和调试功能。它是一款开源的IDE,适用于PHP开发人员,同时也支持其他编程语言。

请教如何在phpStorm中配置eslint

使用ESlint

一、ESLint跟JSLint和JSHint类似,但有以下区别:

1.使用Espree进行js解析(parse)

2.用AST抽象语法树去识别(evaluate)代码中的模式3.每个规则都是的插件

二、安装

全局安装:

npm install -g eslint

三、使用

如果是次使用,eslint --init 命令帮你完成初始化,生成.eslintrc文件然后eslint test.js test2.js

四、配置

{"rules": {

"semi": ["error", "always"],

"quotes": ["error", "double"]

提示有三个ll:

"off" or 0 - 关闭这个规则校验

"warn" or 1 - 开启这个规则校验,但只是提醒,不会退出"error" or 2 - 开启这个规则校验,并退出

五、常见问题

1.为什么不用jslint

创建eslint是因为急需插件化的校验工具

2.ESLint跟JSHint、JSCS的比较

ESLint比JSlint要慢2~3倍,因为ESLint在识别代码前需要用Espress构建AST,而JSHint在解析的时候就会识别代码。虽然慢些,但不至于成为痛点。

ESLint比JSCS快,(as ESLint uses a single-pass trersal for ysis whereas JSCS using a querying model.)3.ESLint仅仅是校验还是也检查代码风格

都有。ESLint does both traditional linting (looking for problematic patterns) and style checking (enforcement of conventions). You can use it for both.

4.支持es6吗?

支持。参考配置eslint/docs/user-guide/configuring5.支持JSX?

本身不支持,可以使用babel-eslint

六、下面详细介绍下配置,地址eslint/docs/user-guide/configuring1.配置ESLint

主要有两种方法配置

配置分几个方面:

(1)环境(env):设置你的脚本的目标运行环境,如browser,amd,es6,commonjs等,每种环境有预设的全局变量(2)全局变量:增加的全局变量供运行时使用(3)规则(rules):设定的规则及该规则对应的报错ll2.配置解析器选项(Specifying Parser Options)默认仅支持ES5语法,可以设置为es6 es7 jsx等。

代码

{"parserOptions": {

"ecmaVersion": 6, // 可选 3 5(默认) 6 7"sourceType": "module", // 可选script(默认) module"ecmaFeatures": {

"jsx": true

},

},

"rules": {

"semi": 2

代码

3.配置解析器(Specifying Parser),需要本地npm模块{

"parser": "esprima", // Espree(默认) Esprima Babel-ESLint"rules": { "semi": "error" } }

browser - browser global variables.

node - Node.js global variables and Node.js scoping.

commonjs - CommonJS global variables and CommonJS scoping (use this for browser-only code that uses Browserify/WebPack).

shared-node-browser - Globals common to both Node and Browser.

es6 - enable all ECMAScript 6 features except for modules.

worker - web workers global variables.

amd - defines require() and d(2)配置文件,使用js、json或者yaml文件来为整个目录及其子目录配置。形式有:.eslintrc.文件,或者在package.json中配置eslintConfig字段,或者在命令行里配置。efine() as global variables as per the amd spec.

mocha - adds all of the Mocha testing global variables.

jaine - adds all of the Jaine testing global variables for version 1.3 and 2.0.

jest - Jest global variables.

phantomjs - PhantomJS global variables.

protractor - Protractor global variables.

qunit - QUnit global variables.

jquery - jQuery global variables.

prototypejs - Prototype.js global variables.

shelljs - ShellJS global variables.

meteor - Meteor global variables.

mongo - MongoDB global variables.

applescript - AppleScript global variables.

nashorn - Ja 8 Nashorn global variables.

servworker - Serv Worker global variables.

atomtest - Atom test er globals.

embertest - Ember test er globals.

webextensions - WebExtensions globals.

greasemonkey - Grease}代码Monkey globals.

代码

如果要在待校验文件里面配置可以这样配置:

/eslint-env node, mocha /

如果要在配置文件中配置:

{"env": {

"browser": true,

如果在package.json中配置:

代码

{"name": "mypackage",

"version": "0.0.1",

"eslintConfig": {

"env": {

"browser": true,

如果在YAML中配置:

---

env:

browser: true

node: true

{"plugins": ["example"],

"env": {

"example/custom": true

5.配置全局变量(Specifying Globals)

定义了全局变量以后,使用他们,ESLint不会发出。

在js文件中定义:

设置read only

/global var1:false, var2:false/

在配置文件中:

{"globals": {

"var1": true,

"var2": false

6.配置插件(Configuring Plugins)

使用npm安装第三方插件

{"plugins": [

"plugin1",

"eslint-plugin-plugin2"

]}

7.配置规则(Configuring Rules)

js中配置:

或者:

/eslint eqeqeq: 0, cy: 2/

如果规则有多个选项:

/eslint quotes: ["error", "double"], cy: 2/在配置文件中设置:

代码

{"rules": {

"eqeqeq": "off",

"cy": "error",

"quotes": ["error", "double"]

代码

使用插件:

代码

{"plugins": [

"plugin1"

],

"rules": {

"eqeqeq": "off",

"cy": "error",

"quotes": ["error", "double"],

"plugin1/rule1": "error"

代码

/eslint "plugin1/rule1": "error" /

临时关闭eslint校验:

/eslint-disable /

//Disable all rules between comments

alert('foo');

/eslint-enable /

/eslint-disable no-alert, no-console /

alert('foo');

console.log('bar');

/eslint-enable no-alert /

在js特定行关闭校验:

alert('foo'); // eslint-disable-line

// eslint-disable-next-line

alert('foo');

alert('foo'); // eslint-disable-line no-alert, quotes, semi// eslint-disable-next-line no-alert, quotes, semialert('foo');

8.增加共享设置(Adding Shared Settings)

{"settings": {

"sharedData": "Hello"

9.使用配置文件

eslint -c myconfig.json myfiletotest.js

10.继承配置文件(Extending Configuration Files)代码

{"extends": [

"./node_modules/coding-standard/eslintDefaults.js",// Override eslintDefaults.js

"./node_modules/coding-standard/.eslintrc-es6",// Override .eslintrc-es6

"./node_modules/coding-standard/.eslintrc-jsx",],

"rules": {

// Override any settings from the "parent" configuration"eqeqeq": "warn"

代码

代码

# /node_modules and /bower_components ignored by default# Ignore files compiled from TypeScript and CoffeeScript/.{ts,coffee}.js

# Ignore built files except build/index.juild/

!build/index.js

PHPstorm对PHP的配置上,这个安装在无论哪个目录下都不会显示PHP version?

/eslint eqeqeq: "off", cy: "error"/

就个人的经验,貌似是PHP2-2将extension_dir = "D:/Program Files/PHP/php-5.6.6-Win32-VC11-x64/ext"的路径不正确,你需要在 php executable 的编辑框里,选择或输入 php 安装目录所在的位置(你可以搜索下 php.exe 这个文件,并定位到所在的目录)。

phpstrom怎么配置web

}}

PHPStorm软件功能十分强大,可以支持很多语言,而且智能性非常高。

但是国内使用的人口还不是很多,由于是在配置PHPStorm方面,经常会遇到一些问题,此贴专门用于解决此问题。

问题1-如何新建PHPStorm工程

选择File-New Project,应该是所以程序的经典路径

问题2-如何运行PHPStorm程序

选择对应需要运行的文件,点击右键,出现下拉菜单,选择Run这个文件或者程序

问题3-PHPStorm解释器找不到

刚刚安装好的PHPStorm软件,默认是没有配置PHPStorm解释器,没有PHPStorm解释器的话,PHP程序是无法直接在PHPStorm里面运行看到效果的。所以必须专门配置一把。

配置路径:File-Settings-PHP,选中到PHP文件安装的最外层

三、权限问题,如果nginx没有web目录的作权限,也会出现403错误。问题4-1配置PHP5.6.6支持Mysql

具体作步骤如下:

2-1将php.ini-dlopment改为php.ini

2-3将

extension=php_mysql.dll

extension=php_mysqli.dll

现在用mysqli驱动,不再用mysql驱动

对应第三个图

2-4重启即可支持

PHPstorm对PHP的配置上,这个安装在无论哪个目录下都不会显示PHP version?

4.配置环境(Specifying Environments),可以多选代码

就个人的经验,命令:psaux|grepnginx:workerprocess|awk{print$1}貌似是PHP的路径不正确,你需要在 php executable 的编辑框里,选择或输入 php 安装目录所在的位置(你可以搜索下 php.exe 这个文件,并定位到所在的目录)。

如何安装PHP

也可以用插件

得看是什么程序以及程序写的怎么样了。

/global var1, var2/

如果是文本数据库的 并且程序写的不错的话

直接上传上去 不用设置什么 就可以使用了。

如果写的一般的话 需要设置一下 文本数据库的路径。

如果是Mysql数据做支持的话,

首先得程序自带的安装程序 创建数据库

如果程序没有自带安装程序,那么你就得自己手动的创建数据库了。

然后设置好mysql的相关链接参数后,一般就可以用了。

希望我的回答对你有所帮助。

建议新手找个集成安装包,一次就可以安装好了 xamp 就比较好

请教如何在phpStorm中配置eslint

11.忽略文件或目录(Ignoring Files and Directories)建立.eslintignore文件

使用ESlint

一、ESLint跟JSLint和JSHint类似,但有以下区别:

1.使用Espree进行js解析(parse)

2.用AST抽象语法树去识别(evaluate)代码中的模式3.每个规则都是的插件

二、安装

全局安装:

npm install -g eslint

三、使用

如果是次使用,eslint --init 命令帮你完成初始化,生成.eslintrc文件然后eslint test.js test2.js

四、配置

{"rules": {

"semi": ["error", "always"],

"quotes": ["error", "double"]

提示有三个ll:

"off" or 0 - 关闭这个规则校验

"warn" or 1 - 开启这个规则校验,但只是提醒,不会退出"error" or 2 - 开启这个规则校验,并退出

五、常见问题

1.为什么不用jslint

创建eslint是因为急需插件化的校验工具

2.ESLint跟JSHint、JSCS的比较

ESLint比JSlint要慢2~3倍,因为ESLint在识别代码前需要用Espress构建AST,而JSHint在解析的时候就会识别代码。虽然慢些,但不至于成为痛点。

ESLint比JSCS快,(as ESLint uses a single-pass trersal for ysis whereas JSCS using a querying model.)3.ESLint仅仅是校验还是也检查代码风格

都有。ESLint does both traditional linting (looking for problematic patterns) and style checking (enforcement of conventions). You can use it for both.

4.支持es6吗?

支持。参考配置eslint/docs/user-guide/configuring5.支持JSX?

本身不支持,可以使用babel-eslint

六、下面详细介绍下配置,地址eslint/docs/user-guide/configuring1.配置ESLint

主要有两种方法配置

配置分几个方面:

(1)环境(env):设置你的脚本的目标运行环境,如browser,amd,es6,commonjs等,每种环境有预设的全局变量(2)全局变量:增加的全局变量供运行时使用(3)规则(rules):设定的规则及该规则对应的报错ll2.配置解析器选项(Specifying Parser Options)默认仅支持ES5语法,可以设置为es6 es7 jsx等。

代码

{"parserOptions": {

"ecmaVersion": 6, // 可选 3 5(默认) 6 7"sourceType": "module", // 可选script(默认) module"ecmaFeatures": {

"jsx"2.listen80;: true

},

},

"rules": {

"semi": 2

代码

3.配置解析器(Specifying Parser),需要本地npm模块{

"parser": "esprima", // Espree(默认) Esprima Babel-ESLint"rules": { "semi": "error" } }

browser - browser global variables.

node - Node.js global variables and Node.js scoping.

commonjs - CommonJS global variables and CommonJS scoping (use this for browser-only code that uses Browserify/WebPack).

shared-node-browser - Globals common to both Node and Browser.

es6 - enable all ECMAScript 6 features except for modules.

worker - web workers global variables.

amd - defines require() and define() as global variables as per the amd spec.

mocha - adds all of the Mocha testing global variables.

jaine - adds all of the Jaine testing global variables for version 1.3 and 2.0.

jest - Jest global variables.

phantomjs - PhantomJS global variables.

protractor - Protractor global variables.

qunit - QUnit global variables.

jquery - jQuery global variables.

prototypejs - Prototype.js global variables.

shelljs - ShellJS global variables.

meteor - Meteor global variables.

mongo - MongoDB global variables.

applescript - AppleScript global variables.

nashorn - Ja 8 Nashorn global variables.

servworker - Serv Worker global variables.

atomtest - Atom test er globals.

embertest - Ember test er globals.

webextensions - WebExtensions globals.

greasemonkey - GreaseMonkey globals.

代码

如果要在待校验文件里面配置可以这样配置:

/eslint-env node, mocha /

如果要在配置文件中配置:

{"env": {

"browser": true,

如果在package.json中配置:

代码

{"name": "mypackage",

"version": "0.0.1",

"eslintConfig": {

"env": {

"browser": true,

如果在YAML中配置:

---

env:

browser: true

node: true

{"plugins": ["example"],

"env": {

"example/custom": true

5.配置全局变量(Specifying Globals)

定义了全局变量以后,使用他们,ESLint不会发出。

在js文件中定义:

设置read only

/global var1:false, var2:false/

在配置文件中:

{"globals": {

"var1": true,

"var2": false

6.配置插件(Configuring Plugins)

使用npm安装第三方插件

{"plugins": [

"plugin1",

"eslint-plugin-plugin2"

]}

7.配置规则(Configuring Rules)

js中配置:

或者:

/eslint eqeqeq: 0, cy: 2/

如果规则有多个选项:

/eslint quotes: ["error", "double"], cy: 2/在配置文件中设置:

代码

{"rules": {

"eqeqeq": "off",

"cy": "error",

"quotes": ["error", "double"]

代码

使用插件:

代码

{"plugins": [

"plugin1"

],

"rules": {

"eqeqeq": "off",

"cy": "error",

"quotes": ["error", "double"],

"plugin1/rule1": "error"

代码

/eslint "plugin1/rule1": "error" /

临时关闭eslint校验:

/eslint-disable /

//Disable all rules between comments

alert('foo');

/eslint-enable /

/eslint-disable no-alert, no-console /

alert('foo');

console.log('bar');

/eslint-enable no-alert /

在js特定行关闭校验:

alert('foo'); // eslint-disable-line

// eslint-disable-next-line

alert('foo');

alert('foo'); // eslint-disable-line no-alert, quotes, semi// eslint-disable-next-line no-alert, quotes, semialert('foo');

8.增加共享设置(Adding Shared Settings)

{"settings": {

"sharedData": "Hello"

9.使用配置文件

eslint -c myconfig.json myfiletotest.js

10.继承配置文件(Extending Configuration Files)代码

{"extends": [

"./node_modules/coding-standard/eslintDefaults.js",// Override eslintDefaults.js

"./node_modules/coding-standard/.eslintrc-es6",// Override .eslintrc-es6

"./node_modules/coding-standard/.eslintrc-jsx",],

"rules": {

// Override any settings from the "parent" configuration"eqeqeq": "warn"

代码

代码

# /node_modules and /bower_components ignored by default# Ignore files compiled from TypeScript and CoffeeScript/.{ts,coffee}.js

# Ignore built files except build/index.juild/

!build/index.js

重启之极海听雷重启phplinux

当前PHP和Mysql是一对好基友,由于PHP自身的封装,调用Mysql十分方便。但是对于PHP5.6.6还是默认不支持的。具体原因不详,需要自己开方此部分功能。

phpstorm怎么搭建运行环境?

phpstorm搭建运行环境方法如下

1打开PHPstudy进入“其他选项菜单”-“环境端口检测”-端口列表,随后点击PHPstudy运行界面的重启,查看网络状态-TCP端口,查看Apache的端口,我的这里是9096,网上一般说Apache端口默认是80,没错,但经常被占用。

2随后,我们来到phpstrom中修改phpstoram的默认设置,tools-Deploment-Configuration,如果次设置会没有,点击弹窗左上角“+”新建就好。

3端口被占用就是把localhost改成localhost:端口/地址/

4点击Mapping,进入设置。

5完成后保存退出,在点击右上角的小角标。

6找到PHPwebapplicantion,进入。也是没有就点击“...”的那个新建。

7没有的新建,有的改数据,默认是80,80端口被占用就改成,我们看过的被分配好的端口号。

nginx403禁止访问被拒绝怎么办?

一、由于启动用户和nginx工作用户不一致所致

1.1查看nginx的启动用户,发现是nobody,而为是用root启动的

1.2将nginx.config的user改为和启动用户一致,

命令:viconf/nginx.conf

二、缺少index.html或者index.php文件,就是配置文件中indexindex.htmlindex.htm这行中的指定的文件。

1.server{

3.server_namelocalhost;

4.indexindex.phpindex.html;

;

6.}

如果在/data/www/下面没有index.php,index.html的时候,直接文件,会报403forbidden。

解决办法:修改web目录的读写权限,或者是把nginx的启动用户改成目录的所属用户,重启Nginx即可解决

1.chmod-R777/data

2.chmod-R777/data/www/

四、SELinux设置为开启状态(enabled)的原因。

4.1、查看当前selinux的状态。

1./usr/in/sestatus

4.2、将SELINUX=enforcing修改为SELINUX=disabled状态。

2.

3.#SELINUX=enforcing

4.SELINUX=disabled

4.3、重启生效。reboot。

1.reboot

重启php以及nginx

killallphp-fpmphp-fpm

nginx-sreload"node": true

实战mysql导出中文乱码及phpmyadmin导入中文乱码的解决方法?

Linux主机通过phpmyadmin导出的sql数据,用命令导入到另外一台Linux主机时出现中文显示乱码,进一步查看原先导入出sql文件,发现中文无法显示,都是?号。解决Linuxmysql数据导入导出中文乱码的具体方法如下:

1、确保phpmyadmin导出的数据中文显示正常,进入phpmyadmin界面,将语言选为中文-chinese(注意非-chinesegb2312),再导出sql中文就能正常显示。

2、修改导入出现乱码的LINUX主机的mysql设置vi/etc/myf添加default-character-set=utf8#设置默认字符集为utf8init_connect='SETNAMESutf8′#设定连接mysql数据库时使用utf8编码,以让mysql数据库以utf8方式运行找到(或添加)default-character-set=utf8重启mysqlservmysqldrestart3、删除数据库并新建,重新导入数据库即可mysql-uroot-p>mysql>dropdatabaxx>createdatabaxx>quit导入数据mysql-u-pxxxmysql.sql

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 12345678@qq.com 举报,一经查实,本站将立刻删除。

联系我们

工作日:9:30-18:30,节假日休息