I have tried some ways to create an alias for my local Drupal project, I'm referring to :
https://www.drupal.org/node/1401522
https://www.drupal.org/project/drush/issues/831272
https://www.drupal.org/project/drush/issues/786766
I can connect by running this command :
drush --root=C:/wamp64/www/executive-coatings --uri=http://localhost:81/executive-coatings status
Output :
Drupal version : 8.6.13
Site URI : http://localhost:81/executive-coatings
DB driver : mysql
DB hostname : localhost
DB port : 3306
DB username : root
DB name : dev_ecc_new
Database : Connected
Drupal bootstrap : Successful
Default theme : ecc_front
Admin theme : adminimal_theme
PHP binary : C:\wamp64\bin\php\php7.2.10\php.exe
PHP config : C:\wamp64\bin\php\php7.2.10\php.ini
PHP OS : WINNT
Drush script : C:\wamp64\www\executive-coatings\vendor\bin\drush.phar
Drush version : 9.6.2
Drush temp : C:\Users\k\AppData\Local\Temp
Drush configs : C:/Users/k/.drush/drush.yml
C:/wamp64/www/executive-coatings/vendor/drush/drush/drush.yml
Install profile : minimal
Drupal root : C:\wamp64\www\executive-coatings
Site path : sites/default
Files, Public : sites/default/files
Files, Temp : /tmp
But when I try to use a drush alias it doesn't work. Here my alias file :
$aliases['local'] = array(
'uri' => 'localhost:81/executive-coatings',
'root' => 'C:/wamp64/www/executive-coatings',
'path-aliases' => array(
'%dump-dir' => '/tmp',
),
);
Running drush #local status returns [preflight] The alias #local could not be found.
I think I put my alias file in the wrong directory, can you provide the correct path ?
Alias file location is not your only issue here, because you are running Drush 9.x. Here the major changes between Drush 8.x and Drush 9.x regarding aliases :
Site aliases are no longer PHP files but YAML files. Hopefully Drush 9.x comes with a command to convert your old drush 8 aliases :
drush site:alias-convert
The user alias locations used in Drush 8 (~/.drush/sites, /etc/drush/sites) are by default no longer parsed, but you can register any location where alias files may be placed in your ~/.drush/drush.yml configuration file. Setting the old Drush 8 paths can be done automatically by running :
drush core:init
It writes the following to ~/.drush/drush.yml :
drush:
paths:
alias-path:
- '${env.home}/.drush/sites'
- /etc/drush/sites
For example in your case, defining a local environment for the website executive-coatings aliased ecc may be done in the file (provided this location is registered as mentioned above) ~/.drush/sites/ecc.site.yml.
You can also define environment aliases (eg. #dev, #preprod, etc.) for a given website at the following location (under the project root of that website, using self in the file naming) :
<DRUPAL_ROOT>/drush/sites/self.site.yml
Useful links :
- https://github.com/drush-ops/drush/blob/master/examples/example.site.yml
- https://github.com/consolidation/site-alias
Related
I downloaded Symfony2 et when I create a project /var/www/html# php ../symfony.phar new MyProject 2.8
At the end, I have this message :
Preparing project...
✕ Symfony 2.8.2 was successfully installed but your system doesn't meet its
technical requirements! Fix the following issues before executing
your Symfony application:
* date.timezone setting must be set
> Set the "date.timezone" setting in php.ini* (like Europe/Paris).
After fixing these issues, re-check Symfony requirements executing this command:
php Projet_miage/app/check.php
Then, you can:
* Change your current directory to /var/www/html/Projet_miage
* Configure your application in app/config/parameters.yml file.
* Run your application:
1. Execute the php app/console server:run command.
2. Browse to the http://localhost:8000 URL.
* Read the documentation at http://symfony.com/doc
But why ?
(I have xampp and I am on Ubuntu)
Because to make your application working properly, Symfony need some specific PHP configuration.
Find your php.ini by running:
php --ini
This will output something like :
Configuration File (php.ini) Path: /path/to/php
Loaded Configuration File: /path/to/php/php.ini
Then, open it:
nano /path/to/php/php.ini
Find the line date.timezone and change it to :
date.timezone = "Europe/Paris"
Of course, if "Europe/Paris" is not your timezone, you can replace by yours.
Please set the timezone in your php.ini
date.timezone = " Europe/Paris"
Restart xampp after that
I want to assess SonarQube as a source code inspection tool.
The project is hosted in a git repository, and I want to SonarQube to check my PHP project on each commit.
I got a basic instance of SonarQube via docker. (The current version of sonar cube is 6.7 -- yet I do not know if the steps remain the same. This answer takes into account 5.1.)
Run the container:
sudo docker run -d --name sonarqube -p 9000:9000 -p 9092:9092 sonarqube:5.1
This provides with a standard install of SonarQube accessable at
http://localhost:9000/
I can login via username and passoword admin, and install the PHP component via:
Settings > System > Update Center
(or: http://localhost:9000/updatecenter )
and search for PHP and install.
There I can add PHP and after restart of the SonarQube server, (I did it via docker stop container_id, container start container_id), the extension is loaded.
The server will not run your tests. It will only display the results.
You will need a machine dedicated to work as your sonar-runner, for a quick start you may use your local dev machine and your local checkout from bitbucket. Install the sonar-runner on that machine.
Download the sonar runner via:
$ wget http://repo1.maven.org/maven2/org/codehaus/sonar/runner/sonar-runner-dist/2.4/sonar-runner-dist-2.4.zip
and extracted it to:
~/programs/sonar-runner-2.4
In this directory, there you find a file conf/sonar-runner.properties that should contain:
#Configure here general information about the environment, such as SonarQube DB details for example
#No information about specific project should appear here
#----- Default SonarQube server
sonar.host.url=http://localhost:9000
#----- PostgreSQL
#sonar.jdbc.url=jdbc:postgresql://localhost/sonar
#----- MySQL
#sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8
#----- Oracle
#sonar.jdbc.url=jdbc:oracle:thin:#localhost/XE
#----- Microsoft SQLServer
#sonar.jdbc.url=jdbc:jtds:sqlserver://localhost/sonar;SelectMethod=Cursor
#----- Global database settings
sonar.jdbc.username=sonar
sonar.jdbc.password=sonar
#----- Default source code encoding
sonar.sourceEncoding=UTF-8
#----- Security (when 'sonar.forceAuthentication' is set to 'true')
sonar.login=admin
sonar.password=admin
Go into your project's root directory and create a file called sonar-project.properties:
# must be unique in a given SonarQube instance
sonar.projectKey=yourProjectKey
# this is the name displayed in the SonarQube UI
sonar.projectName=yourProject
sonar.projectVersion=1.0
# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
# Since SonarQube 4.2, this property is optional if sonar.modules is set.
# If not set, SonarQube starts looking for source code from the directory containing
# the sonar-project.properties file.
sonar.sources=./classes/,./tests/
# Encoding of the source code. Default is default system encoding
sonar.sourceEncoding=UTF-8
# Encoding of the source code. Default is default system encoding
sonar.sourceEncoding=UTF-8
I then ran:
your/projects/dir$: ~/programs/sonar-runner-2.4/bin/sonar-runner
You will then see an new entry at your SonarCube dashboard.
Get the following:
OpenJDK: 7u55+ of 8
MySQL: 5.1 t/m 5.7
SonarQube: http://dist.sonar.codehaus.org/sonarqube-5.1.zip
Sonar Runner: http://repo1.maven.org/maven2/org/codehaus/sonar/runner/sonar-runner-dist/2.4/sonar-runner-dist-2.4.zip
Do the following:
Installation: http://docs.sonarqube.org/display/SONAR/Installing
Setup SonarRunner:
#Configure here general information about the environment, such as SonarQube DB details for example
#No information about specific project should appear here
#----- Default SonarQube server
sonar.host.url=http://14.3.1.4:9000
#----- PostgreSQL
#sonar.jdbc.url=jdbc:postgresql://localhost/sonar
#----- MySQL
sonar.jdbc.url=jdbc:mysql://14.3.1.2:3306/sonarqube? useUnicode=true&characterEncoding=utf8
#----- Oracle
#sonar.jdbc.url=jdbc:oracle:thin:#localhost/XE
#----- Microsoft SQLServer
#sonar.jdbc.url=jdbc:jtds:sqlserver://localhost/sonar;SelectMethod=Cursor
#----- Global database settings
sonar.jdbc.username=sonarqube
sonar.jdbc.password=sonarqube
#----- Default source code encoding
sonar.sourceEncoding=UTF-8
#----- Security (when 'sonar.forceAuthentication' is set to 'true')
#sonar.login=admin
#sonar.password=admin
Clone a git repo in the var/www folder on the server where sonar is at.
Then add a configurationfile in the project you want to check called sonar-project.properties. Here is an Symfony example:
# Required metadata
sonar.projectKey=yoursite.dev.nl.project
sonar.projectName=Project
sonar.projectVersion=1.0
# Comma-separated paths to directories with sources (required)
sonar.projectBaseDir=/var/www/your_project
# Folder being analysed.
sonar.sources=symfony/src
# Language (Only when it is a single language)
sonar.language=php
# Encoding of the source files
sonar.sourceEncoding=UTF-8
I am running into an issue with a customer's Drupal sites. He has a number of D6 installs, and a new D7 that he's just starting on. All of these sites are on the same shared hosting package.
The problem is when running certain drush commands only on the D7 site. There are no issues on the D6 sites. The specific error for drush up on the D7 site follows:
foo#bar [~/www/foo]# drush up
Command pm-update needs a higher bootstrap level to run - you will need to invoke drush [error]
from a more functional Drupal environment to run this command.
Command pm-update needs the following modules installed/enabled to run: update. [error]
The drush command 'up' could not be executed. [error]
Drush was not able to start (bootstrap) the Drupal database. [error]
Hint: This may occur when Drush is trying to:
* bootstrap a site that has not been installed or does not have a configured database. In
this case you can select another site with a working database setup by specifying the URI
to use with the --uri parameter on the command line. See `drush topic docs-aliases` for
details.
* connect the database through a socket. The socket file may be wrong or the php-cli may
have no access to it in a jailed shell. See http://drupal.org/node/1428638 for details.
Drush was attempting to connect to:
Drupal version : 7.28
Site URI : http://default
Database driver : mysql
Database username : username_foo
Database name : database_foo
PHP configuration :
PHP OS : Linux
Drush version : 7.0-dev
Drush temp directory : /tmp
Drush configuration :
Drush alias files :
Drupal root : /home/foo/www/foo
Site path : sites/default
Everything I can find (and indeed the link in the error message) say the solution is to change the host value in the settings.php file from localhost to 127.0.0.1. However, this has not been the solution for us.
The frontend site has no problems connecting to the database, and drush itself seemingly does in many cases too.
drush sql-connect will generate a string that you can use to connect to MySQL.
drush sql-cli will successfully connect to MySQL
The settings.php file is definitely in a folder called default (path: www/foo/sites/default) and I get the exact same error when specifying --root and --uri options.
Drush was originally a ~5.x release, and it had the same issues. We updated to the ~7.x to try to eliminate the error. The host value in settings.php has been localhost as well as 127.0.0.1 with equally poor results.
We've verified that MySQL is available via socket from the PHP CLI. Drush is up to date and a fresh install. The Drupal 7 site is a brand new fresh install.
I'm at a loss. Why would this work with the D6 sites, but not the D7? Any suggestions?
Is your settings.php file in a folder called 'default'? If not, you might need to tell Drush where to find it by using --uri=mysite.com or -l mysite.com.
There are several ways to specify which Drupal site Drush will target. The most basic option is fairly verbose; run:
$ drush --root=/path/to/drupal --uri=http://example.com status
You can do the same thing with a slightly different syntax:
$ drush /path/to/drupal#example.com status
You can also specify the Drupal site implicitly, by setting the cwd to the folder that contains the settings.php file for your site:
cd /path/to/drupal/sites/default # or /path/to/drupal/sites/mysite.com, as appropriate
$ drush status
In all of the cases above, if settings.php is in a folder called "default", then you do not need to specify the --uri component; you may, for example, cd /path/to/drupal followed by drush status, and the correct Drupal site will be found. If settings.php is not in a folder named 'default', then you will need to either specify --uri, or cd to the folder that contains the settings.php file.
Source
According to this message:
pm-update needs the following modules installed/enabled to run: update
Drush requires Update module to be enabled, so the following command should fix the problem:
drush -y en update
I am trying to install pear in wampserver. It doesn't come with a go-pear.bat.
I download the .phar file from pear.php.net/go-pear and run php go-pear.phar.
It just keeps looping over the config where I set all the paths.
What gives?
Lets assume you are running PHP5.3.24 and wamp is installed on the C: drive, if not change the folder names accordingly.
Get go-pear.phar from http://pear.php.net/go-pear.phar and copy it to the wamp\bin\php\php5.3.24 folder
Do all this from a windows command window
cd C:\wamp\bin\php\php5.3.24
md pear
PATH=%PATH%;C:\wamp\bin\php\php5.3.24
php go-pear.phar
When you get asked this question
Below is a suggested file layout for your new PEAR installation. To
change individual locations, type the number in front of the
directory. Type 'all' to change all of them or simply press Enter to
accept these locations.
1. Installation base ($prefix) : D:\wamp\bin\php\php5.3.24
2. Temporary directory for processing : D:\wamp\bin\php\php5.3.24\tmp
3. Temporary directory for downloads : D:\wamp\bin\php\php5.3.24\tmp
4. Binaries directory : D:\wamp\bin\php\php5.3.24
5. PHP code directory ($php_dir) : D:\wamp\bin\php\php5.3.24\pear
6. Documentation directory : D:\wamp\bin\php\php5.3.24\docs
7. Data directory : D:\wamp\bin\php\php5.3.24\data
8. User-modifiable configuration files directory : D:\wamp\bin\php\php5.3.24\cfg
9. Public Web Files directory : D:\wamp\bin\php\php5.3.24\www
10. Tests directory : D:\wamp\bin\php\php5.3.24\tests
11. Name of configuration file : D:\wamp\bin\php\php5.3.24\pear.ini
12. Path to CLI php.exe : \wamp\bin\php\php5.3.24
1-12, 'all' or Enter to continue: 12
To get it to proceed with the install you have to just PRESS the ENTER key
Its as simple as that
I faced the same issue, if you scroll a bit back, you should see an error, probably you didn't fill the php.exe folder properly (number 12). Just type 12, press enter and navigate to you PHP installation folder (like C:/php). Then, after hitting enter, installation should start.
Type local after running php go-pear.phar.
Then go with what Pedro Lobito said.
If the list shows again, just press Enter and installation should start.
How to correct instal pear for php. I store all for web server in /opt/local.
But pear want be installed to /Users/. How change this folder.
c8-bc-c8-d8-eb-65:tmp macbookpro$ sudo php -d detect_unicode=0 go-pear.phar
Below is a suggested file layout for your new PEAR installation. To
change individual locations, type the number in front of the
directory. Type 'all' to change all of them or simply press Enter to
accept these locations.
1. Installation base ($prefix) : /Users/macbookpro/pear
2. Temporary directory for processing : /tmp/pear/install
3. Temporary directory for downloads : /tmp/pear/install
4. Binaries directory : /Users/macbookpro/pear/bin
5. PHP code directory ($php_dir) : /Users/macbookpro/pear/share/pear
6. Documentation directory : /Users/macbookpro/pear/docs
7. Data directory : /Users/macbookpro/pear/data
8. User-modifiable configuration files directory : /Users/macbookpro/pear/cfg
9. Public Web Files directory : /Users/macbookpro/pear/www
10. Tests directory : /Users/macbookpro/pear/tests
11. Name of configuration file : /Users/macbookpro/.pearrc
You can change the dirs by pressing the corresponding number on that line.