I bumped into this bit of instructions while installing an addon for a PHP framework:
Make sure you don't have the PHP module installed. This is a Debian/Ubuntu example:
sudo apt-get purge php5-geoip
I am working on Windows PC with a Virtual Machine running Laravel Homsetead. I am using Git Bash command window. When I enter the above command I get:
bash: sudo: command not found
If I remember correctly, sudo is an Apple-related command so I tried dropping it like this:
apt-get purge php5-geoip
but I get
bash: apt-get: command not found
What command do I need to use to purge php5-geoip?
EDIT: echo $PATH gives out:
$ echo $PATH
/c/Users/Arthur/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/mingw64/bin:/usr/
bin:/c/Users/Arthur/bin:/c/ProgramData/Oracle/Java/javapath:/c/Windows/system32:
/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0:/
c/Program Files (x86)/Intel/OpenCL SDK/2.0/bin/x86:/c/Program Files (x86)/Intel/
OpenCL SDK/2.0/bin/x64:/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/c
/Program Files/MATLAB/MATLAB Production Server/R2015a/runtime/win64:/c/Program F
iles/MATLAB/MATLAB Production Server/R2015a/bin:/c/Program Files/MATLAB/MATLAB P
roduction Server/R2015a/polyspace/bin:/c/Program Files (x86)/Skype/Phone:/c/PHP:
/c/ProgramData/ComposerSetup/bin:/c/Users/Arthur/AppData/Roaming/Composer/vendor
/bin:/c/HashiCorp/Vagrant/bin:/c/Program Files/nodejs:/c/Users/Arthur/AppData/Ro
aming/npm:/usr/bin/vendor_perl:/usr/bin/core_perl
Related
I have been developing with Vallet for some time now. Today i wanted to update laravel 5.4 to 5.5. Before doing so i run composer global update. Causing Vallet to stop working.
Fist i tried to do the following:
cd ~/.composer/
sudo chown -R $(whoami) vendor
source: https://laracasts.com/discuss/channels/general-discussion/getting-valet-not-found-error
I did not solve the issue. Then i decided to reinstall Vallet. Hereby i did the following:
I followed this: https://github.com/laravel/valet/issues/321
Stop and uninstall services
sudo brew services stop php71 dnsmasq nginx
brew uninstall php71 dnsmasq nginx
Remove related config files and valet home folder
sudo rm -r /usr/local/etc/php /usr/local/etc/nginx /usr/local/etc/dnsmasq.conf
sudo rm -r ~/.valet /var/root/.valet
Install services i tried this:
brew install php71
$ brew tap homebrew/php
$ brew install php71
brew install homebrew/php/php71
All gave the following error:
MacBook-Pro:~ mblivier$ brew install homebrew/php/php71
==> Installing php71 from homebrew/php Error: The following formula: php71
cannot be installed as a binary package and must be built from source.
Install the Command Line Tools:xcode-select --install
I new in this and don't know how to solve this. Any suggestions how to install php and go further with reinstalling Vallet?
homebrew is installed and working
You need xcode to build php, so first run:
xcode-select --install
to install xcode and later you can brew install php71
This is answer for your comment, I can't post as comment, need to post because is length limited.
There is one of two things going on here, either you didn't install PHP, or PHP is installed and not currently in any of system aware paths. First I would try to find PHP and make sure it exists:
$ find / -name php -type f
You should see something like:
/path/to/your/php/bin/php
If PHP binary does exist, check your path:
$ echo $PATH
If it does not exist, recompile php.
If PHP exists on your system, make sure the path to the /bin/php file is included. You can edit your ~/.bash_profile and add the custom path like this:
PATH=$PATH:/path/to/your/php/bin/
....
export PATH
Then save and reload the file to ensure your current session has access to new path changes:
$ source ~/.bash_profile
With any luck you can now do a php -v and see the version response.
I need SQLite minimum version 3.8 to support a MediaWiki install on Amazon EC2. Amazon Linux is based on CentOS and the latest version available in the yum repository is SQLite 3.7.17.
The downloads available from sqlite.org don't include 64-bit Linux. There is a GitHub repository that has a prebuilt 64-bit version, however it's only the command line version. I put it at /usr/bin:
$ which sqlite3
/usr/bin/sqlite3
$ sqlite3 --version
sqlite3: /lib64/libtinfo.so.5: no version information available (required by sqlite3)
3.26.0 2018-12-01 12:34:55 bf8c1b2b7a5960c282e543b9c293686dccff272512d08865f4600fb58238b4f9
But MediaWiki still complains I have SQLite 3.7.17 installed. When I test it I get:
$ cat x.php
<?php
print_r(SQLite3::version());
?>
Run it:
$ php7 x.php
Array
(
[versionString] => 3.7.17
[versionNumber] => 3007017
)
I am guessing this is because of these libraries:
$ sudo find / -name "libsqlite*"
/usr/lib64/libsqlite3.so.0
/usr/lib64/libsqlite3.so.0.8.6
How can I download/rebuild or otherwise install a later version of these SQLite libraries?
The easiest option I found was to build it myself. Tested on Amazon Linux release 2 (Karoo).
Download the latest source code with the configure script from here. Currently this is:
curl https://www.sqlite.org/2020/sqlite-autoconf-3320300.tar.gz | tar xzf -
Go into the created directory and create the Makefile with our system dependant options:
cd ./sqlite-autoconf-3320300 && ./configure
Build the binary
make
Install it
sudo make install
Clean up
cd .. && rm -r ./sqlite-autoconf-3320300
Note: It's far from ideal to do this without a proper RPM package. If you update sqlite through yum, you will overwrite you manually built version.
Adding on to #halbgut answer, with some changes:
Download the latest source code with the configure script from here. Currently this is:
curl https://www.sqlite.org/2020/sqlite-autoconf-3320300.tar.gz | tar xzf -
Go into the created directory and create the Makefile with our system dependent options:
cd ./sqlite-autoconf-3320300 && ./configure
Build the binary
make
Install it
sudo make install
Now, you have created the sqlite3 file. You need to replace them everywhere you find the file sqlite3.
To find all these places - run the following command:
whereis sqlite3
sqlite3: /usr/bin/sqlite3 /usr/local/bin/sqlite3 /usr/include/sqlite3.h /opt/c9/bin/sqlite3 /usr/share/man/man1/sqlite3.1.gz
Now within the sqlite source folder ./sqlite-autoconf-3320300, find the sqlite3, sqlite3.h files and replace with the following cp command
sudo cp sqlite-autoconf-3320300/sqlite3 /usr/local/bin/sqlite3
sudo cp sqlite-autoconf-3320300/sqlite3 /usr/local/bin/sqlite3
sudo cp sqlite-autoconf-3320300/sqlite3 /opt/c9/bin/sqlite3 {I am using c9, hence this file, figure out what file is in the opt/ dir)
sudo cp sqlite-autoconf-3320300/sqlite3.h /usr/include/sqlite3.h
Once done, you would have upgraded both env and python-env. Now you need to just define the path to it. For it, use the local/lib in usr.
export LD_LIBRARY_PATH="/usr/local/lib"
Now you should have this :
$ python -c "import sqlite3; print(sqlite3.sqlite_version)"
3.23.3
$ sqlite3 --version
3.32.3
If you just need the sqlite3 binary, the SQLite amalgamation also works perfectly on Amazon Linux 2. For SQLite 33.9.04 (or others from the SQLite Download section):
wget "https://www.sqlite.org/2022/sqlite-amalgamation-3390400.zip"
unzip "sqlite-amalgamation-3390400.zip"
cd "sqlite-amalgamation-3390400"
gcc shell.c sqlite3.c -lpthread -ldl -lm -o sqlite3
And then use it as you would any other software compiled from source:
ln -n ./sqlite3 ${wherever}/sqlite3
export PATH="${wherever}:$PATH"
SQLite docs give a good explanation of further options if you need them.
Get the latest sqlite3 download link from https://www.sqlite.org/download.html
and update the link given in the WGET bash command example shown below.
Example:
wget https://www.sqlite.org/2022/sqlite-tools-linux-x86-3400000.zip
unzip sqlite-tools*.zip
cd sqlite-tools*
sudo cp sql* /usr/local/bin/ # Usually this directory is empty, so no need to worry about overwriting files
cd ~
sudo yum update -y
sudo amazon-linux-extras install epel -y
sudo yum install glibc.i686 -y
sqlite3 --version
Trying to install Laravel on Ubuntu Server 14.04. After installing PHP 7 I enter:
curl -sS https://getcomposer.org/installer | php
I get: Composer successfully installed to: /home/ubuntu/composer.phar
sudo mv composer.phar /usr/local/bin/composer
composer
Works fine
composer global require "laravel/installer"
I get:
nano ~/.bashrc
I include this export PATH="~/.composer/vendor/bin:$PATH" at the very bottom.
sudo service apache2 restart
Restart it
laravel
I get: "laravel: command not found"
Why does it not understand the command laravel?
I'm writing this answer for all the future Google searchers. I had a similar issue and I solved it in the following way:
First run:
sudo apt-get install zip unzip php7.0-zip
Then, edit your ~/.bashrc file and append the following line:
export PATH="$PATH:$HOME/.composer/vendor/bin"
or
export PATH="$PATH:$HOME/.config/composer/vendor/bin"
Which one is yours, depends on the line composer printed out during installation of laravel, followed by /vendor/bin. In my case (and in the case of the question), this was $HOME/.config/composer, so I had to do it the second way:
Don't forget to call
source ~/.bashrc
at the end. Enjoy Laravel!
From your screenshot, I can see that there may be a chance the laravel packages were not installed correctly as you don't have zip and unzip installed on your system.
Run the following command to install these first and then try again to install laravel installer:
sudo apt-get install zip unzip
Regarding the export PATH use $HOME instead of the tilde ~ sign. Hope this will solve your problem. Seems like a path error.
export PATH="$PATH:$HOME/.composer/vendor/bin"
I have installed phalcon extension.It was installed successfully but the phalcon command not working.
following Error shown.
"iMac:project Atomix$ phalcon
-sh: phalcon: command not found"
I have Followed instruction from Phalcon official website.it works on windows and Linux perfectly but not in mac os.
Install Phalcon in Mac OS X from Scratch
Keep in mind that Phalcon is a PHP Framework that improves the power of PHP, it means that Phalcon needs an Apache Web Server running PHP and a couple things more. Also Phalcon provides a developer tools that help to create many things very faster.
Requirements:
Knowledge using the Terminal command line
Knowledge using .profile in
mac
Knowledge using Apache Configurations
Knowledge in Web
development
I am using Mac OS X El Capitan Version 10.11 (15A284)
Step 1 Install XCode
Download XCode from App Store
Install XCode
NOTE: you not need a Developer Account for that
Step 2 Install Command Line Developer Tools
Use your terminal commands line
Run the next command line:
console$ xcode-select --install
Step 3 Install Homebrew
Use your terminal commands line
Run this command line:
console$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Run this command line:
console$ brew doctor
Run this command line:
console$ brew update
Step 4 Install PHP 5X (where X is the minor number version that you need 4, 5 or 6)
Run these commands lines
console$ brew tap homebrew/dupes
console$ brew tap homebrew/versions
console$ brew tap homebrew/homebrew-php
console$ brew tap homebrew/dupes
console$ brew install php5X
console$ brew install homebrew/php/php5X-mcrypt
Step 5 Create your Sites folder in your user folder
Run these commands lines:
console$ mkdir ~/Sites
console$ echo "<?php phpinfo();" > ~/Sites/index.php
Step 6 Create your Developer folder in your user folder
Run this command line :
console$ mkdir ~/Developer
Step 7 Setup your Apache Web Server
Open your HTTPD.conf with your favorite Text Editor for example i use ATOM
Run this command line:
console$ sudo atom /etc/apache2/httpd.conf
In your httpd.conf search and uncomment that one
LoadModule rewrite_module libexec/apache2/mod_rewrite.so
Comment or delete this line (remember use # for comment)
LoadModule php5_module libexec/apache2/libphp5.so
Insert this new line
LoadModule php5_module /usr/local/opt/php56/libexec/apache2/libphp5.so
Change this lines
User _www
Group _www
For these other
User your_username
Group staff
Change this lines too
DocumentRoot "/Library/WebServer/Documents"
<Directory "/Library/WebServer/Documents">
For these other
DocumentRoot "/Users/your_username/Sites"
<Directory "/Users/your_username/Sites">
Also change this line too
AllowOverride none
For this one
AllowOverride All
Run this command line to start apache server:
console$ sudo apachectl start
Run this command line to restart apache server:
console$ sudo apachectl restart
Run this command line to stop apache server:
console$ sudo apachectl stop
Test this in your favorite browser
http://localhost/
Step 8 Setup your PHP ini
Open your php.ini (where X is the minor number version that you need)
Run this command line to open your php ini (I use atom, but you can use nano, sublime, etc):
console$ sudo atom /usr/local/etc/php/5.X/php.ini
go to your date.timezone and add the correct timezone, Mac OS X has not default setup for that
Step 9 Installing MySQL
Download lastest version of MySQL Communiti Server from dev.mysql.com
Install the dmg file
Use this commands in command line to use your MySQL
console$ sudo /usr/local/mysql/support-files/mysql.server start
Use this commands in command line to set the root password
/usr/local/mysql/bin/mysqladmin -u root password 'yourpasswordhere'
Step 10 Install GIT and your Profile file
Run this command line, to install GIT:
console$ brew install git
Create your .profile
console$ sudo atom ~/.profile
Add your the paths (I have my personal commands in ~/Developer/bin, but you can use whatever path for your personal commands)
export PATH=$PATH:/usr/local/sbin:/usr/local/mysql/bin:/usr/local/opt/php56/bin:'~/Developer/bin
Step 11 Finally Install Phalcon Framework
Run this command line to prepare phalcon package in your mac os x,
(where X is the minor number version that you need):
console$ brew install php5X php5X-phalcon
Now you need to clone cphalcon code, you can do that in your favorite folder I prefer use my Developer folder in ~/Developer then run this command line, to clone the cphalcon code:
console$ git clone --depth=1 git://github.com/phalcon/cphalcon.git
Now go to cphalcon/build folder (in my case is ~/Developer/cphalcon/build), first go to the folder where you have your git clone and then run this command line, to go there:
console$ cd cphalcon/build
Now compile and install the cphalcon extension, for that run this command line:
console$ sudo ./install
Add the extension in your php ini file php.ini
run this command line to open your php.ini (in my case i use atom but you can use your favorite text editor, and remember X is the minor number version of php):
console$ sudo atom /usr/local/etc/php/5.X/php.ini
Add the extension in your php.ini
extension=phalcon.so
Restart your Apache Web Server and open with your browser your localhost
Step 12 Install Phalcon Developer tools
Clone the phalcon developer tools project from github, you can do that in your favorite folder, I have used my Developer folder in ~/Developer, so go to the folder of your choice and run this command:
console$ git clone https://github.com/phalcon/phalcon-devtools.git
Be shure that the folder is the right name phalcon-devtools, and run these commands (I use my Developer folder to clone my phalcon-devtools, but you can use your favorite folder), now run this command to create the link to execute:
ln -s ~/Developer/phalcon-devtools/phalcon.php /usr/local/sbin/phalcon
give the permisions with this command
chmod ugo+x /usr/local/sbin/phalcon
or Create your ~/Developer/bin folder
add the link with this command:
ln -s ~/Developer/phalcon-devtools/phalcon.php /usr/local/bin/phalcon
and give the permisions to that folder:
chmod ugo+x ~/Developer/bin/phalcon
Test your phalcon developer tools running this command line
console$ phalcon commands
NOTE1: to activate your profile you need to run this command:
console$ . ~/.profile
NOTE2: restart your apache server:
console$ sudo apachectl restart
Well i know that is a lot maybe there is some mistakes but I try to cover everything from the scratch.
I hope that this post will be helpful.
Phalcon extension does not provide the phalcon command line utility. To get the phalcon command line utility you need to install Phalcon Developer Tools for Mac from this link below http://docs.phalconphp.com/en/latest/reference/mactools.html
Did you restart the webserver post installation?
Alternatively, it's easily installed on mac using homebrew:
$brew search phalcon
$brew install php56-phalcon
This is what I did to install Phalcon Developer-Tools for Mac 10.9:
Step 1
Using terminal, clone the devtools into your preferable location, I used the default document root.
$cd /Library/WebServer/Documents/
$git clone https://github.com/phalcon/phalcon-devtools.git
Step 2
Edit or create ~/.bash_profile if you don't have one.
export PTOOLSPATH=/Library/WebServer/Documents/phalcon-devtools
export PATH="$PTOOLSPATH:$PATH"
Step 3
$sudo ln -s /Library/WebServer/Documents/phalcon-devtools/phalcon.sh /Library/WebServer/Documents/phalcon-devtools/phalcon
$chmod +x /Library/WebServer/Documents/phalcon-devtools/phalcon
Please make sure you change all the path above (/Library/WebServer/Documents/) using yours.
Now try phalcon command again in the terminal. I hope it works :).
Phalcon is a great framework however support is wanting I ended up using this https://github.com/JohanSaltutti/php-phalcon-macos
to install on mac
I am trying to run a php file on a ubuntu linux server but get a 'command not found' error when i run "php file_name.php"
Searching online, i found an article that suggested I run "sudo aptitude install php5-cli" which I did and restarted apache afterwards but I still get this error.
How do I fix this?
Try this once,
Go to terminal.
whereis php
It will show where is php installed.
Export that path to environment variable using following command
export PATH=$PATH;/path/to/php's/bin directory
Then execute required file..
As follows,
php file_to_execute.php
first make sure that you've installed following packs:
php5
php5-cli
php-pear
like this:
sudo apt-get install php5 php5-cli php-pear
then make sure to configure php safely befor using it.
also make your php file executable ( chmod 700 )
Try the following step :
Open your cmd/console or press ctr+alt+t.
php5 /your/path/to/php_file_name.