I have purchased a VPS in Dreamhost. Now Im trying to run php composer.phar install but it says:
Fatal error: Class 'Phar' not found in
/home/john/mysite.com/composer.phar on line 13
Since I have found out that I have these directories:
/usr/local/php /usr/local/php53 /usr/local/php54
and, for example, in /usr/local/php53/bin/ I have this:
phar phar.phar php php-cgi php-config phpize
,how can I run php composer.phar install without errors?
If you need more information about content in folders I will give it of course.
This works for me:
php -d extension=phar.so composer.phar [... your command ...]
This includes the phar extension for the current runtime. Works for shared / VPC servers.
It looks like you might not have the phar extension installed or configured correctly. It might be worth checking the output of a call to phpinfo().
Related
How is it that php-ast is listed in phpinfo() but not when running $ php -m to list modules?
Working on installing phan, the static analyzer. I use MAMP Pro and have verified that $ which php returns the desired php version within MAMP. I have updated the php.ini file, and running phpinfo() displays AST as expected.
When I run vendor/bin/phan without the flag, I still get the warning that AST should be installed.
I have run it once with the flag to use the polypill parser, and phan works as expected.
Getting started with Phan (see also README for slightly different
instructions): https://github.com/phan/phan/wiki/Getting-Started
PHP-AST Project: https://github.com/nikic/php-ast#installation
Changing PHP: https://gist.github.com/irazasyed/5987693
Install autoconf to overcome related problem:
https://gist.github.com/anunay/7698181
Note: Answers elsewhere using --with-config-file-path don't seem to be working for me as I get a list of valid PHP console commands and it is not one of them: PHP module is shown in phpinfo(), but not php -m
My best guess is that you need to install the ast extension first.
What I did is this
Install PEAR following the instructions in this post
It's basically two commands
curl -O https://pear.php.net/go-pear.phar
sudo php -d detect_unicode=0 go-pear.phar
Note that I have updated the URL to use https
I've simply acknowledged the default config during installation of PEAR, hoping that it will not disturb MAMP in normal operation to have some extra directories.
Download ast from pecl.php.net, since I couldn't make pecl install ast work, maybe it works for you. Then you'll need to run sudo pear install [path-to-downloaded-ast.tgz], replacing the file path with your download location.
Edit php.ini like you already did, adding the extension.
Result should be this
$ php -m
[PHP Modules]
ast
...
I am using Bitnami MAMP Stack 5.6.34. And installed it as root user so it loads at port 80. I am trying to install laravel 4.2 using composer and it shows that:
Mcrypt PHP extension required error.
and also while I try to use
php artisan
it does not work. Mcrypt is installed as it shows Enabled while I output phpinfo() function. But it still does not show up when I try using
php -m | grep mcrypt
I have modified php.ini file as follows:
mcrypt.algorithms_dir= /Applications/mampstack/common/lib/libmcrypt
mcrypt.modes_dir= /Applications/mampstack/common/lib/libmcrypt
But it does not work and still shows:
Mcrypt PHP extension required error.
But when I cd into mampstack and then use
sudo ./use_mampstack
then in the terminal I don't get any error while using composer install and can also use php artisan command as it finds that Mcrypt is enabled.
How can I get rid the Mcrypt error and load it with installed php
Bitnami Engineer here. I just installed Laravel in a fresh Bitnami installation in Mac OS X. These are the steps I followed
cd installdir/frameworks
curl -LO "https://github.com/laravel/laravel/archive/v4.2.11.zip"
unzip v4.2.11.zip
mv laravel-4.2.11 laravel
cd laravel
composer install
php artisan --version
Then, configure Apache using the similar config files (httpd-prefix.conf and httpd-app.conf) than the other frameworks or the ones at installdir/docs/demo. You will only need to modify the different paths in those files and include the httpd-prefix.conf file in the installdir/apache2/conf/bitnami/bitnami-apps-prefix.conf file. Restart Apache at the end to load this configuration.
I hope this helps
I installed the php redis extension. But when I run the test code, I got the following error:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626+lfs/redio.so' - /usr/lib/php5/20090626+lfs/redio.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Fatal error: Class 'Redis' not found in /var/www/test/redisTest.php on line 2
My php version is 5.3.10, I installed the new version of phpredis.
May I get your help?
THANKS!
The install steps are:
git clone https://github.com/nicolasff/phpredis.git
cd phpredis
phpize
make
make install
Then add a config file in /etc/php5/fpm/confi.d to load redis.so
I use PHP 5.3 and installing PHP-Redis using below steps worked just fine for me:
Install pecl extensionsudo pecl install redis
In php.ini, you may need set extension_dir to correct value. (can be usr/lib64/php/modules as above command placed the redis.so in this directory). In my case, I didn't set this.
Add below line to php.ini:extension=redis.so
Restart Apache/PHP-FPM
To verify if you have got redis installed you can do this
php -m | grep redis
Create a file PHP with echo phpinfo(); in it and see if the module is showing up. If you do not see the module then it is not being loaded correctly.
In the PHP5.3 and Amazon Linux AMI (Same as Centos OS 5)
install libs
yum install php-pear php-devel make gcc wget
install redis
cd /opt/
mkdir /opt/redis
wget https://redis.googlecode.com/files/redis-2.6.14.tar.gz "or last version"
tar -zxvf redis-2.6.14.tar.gz
cd redis-2.6.14
make
make install
install php-redis by pecl
pecl install redis
configuration option "php_ini" is not set to php.ini location
You should add "extension=redis.so" to php.ini
reload the web service httpd
service httpd reload
verify that the extension has been installed
php -m
[PHP Modules]
bz2
...
**redis**
...
[Zend Modules]
Download the proper library file according to your server environment( ex. x86). also, check for your PHP is thread-safe or not and download the Redis library accordingly. then place the library file inside the extension folder. you need to mention the library inside your php.ini as given below.
extension=redis.dll
then restart the server once, and check it's working properly or not.
if you have command line PHP, you can check it in the command line PHP as,
php r("print_r(get_loaded_extensions());")
I'm using XAMPP Server 1.7.7
While opening the php file, i receive the error
Fatal error: Class 'XSLTProcessor' not found
Install the XSL extension to get that class. This might be as easy as uncommenting (remove the starting ';') on the line that reads extension=php_xsl.dll in php.ini on Windows, or apt-get install php5-xsl on most Linux-based systems. For custom builds of PHP, use configure option --with-xsl (requires package libxslt1-dev).
Its necessary install the XLS extension.
My solution by my context.
I'm using one docker container contain ubuntu base and using php-fpm (ie if you simply already use linux ubuntu in the same).
The steps to install this extension in my context were:
First search xsl extension on linux repository
sudo apt-cache search xsl
I ended up finding the php5-xsl, so it was only install
sudo apt-get install php5-xsl
that the installation process the setup configuration is already added, if does not happen, just make yourself
sudo vim /etc/php5/mods-available/xsl.ini
insert this content:
extension=xsl.so
(obviously the paths are according to your php configuration settings, but my example is the default configuration)
Restart you php fpm and done (sudo service php5-fpm restart)!
I'm compiling certain extensions for PHP on dreamhost PS server.
I got an error and found that it happens when php4 headers are used instead of php5 headers.
running phpinfo shows the server runs php5. however php-v on the command line gives php4.
How can I make the compilation use php5 instead of php4 on my server? Is there an environment variable of some kind and if so how can I change it (new to linux)
Thanks
You have to find out where on the box PHP 5 is installed. You might try locate phpize on your shell. The same directory should contain a php-config executable. The path might be found in the phpinfo() output. Check there for the Configuraiton cammand and in there for the --prefix parameter.
If there are multiple PHP isntallations incl. phpize you can compile extensions using da selected version by using the correct paths:
$ cd extension_source
$ /full/path/to/bin/phpize
$ ./configure --with-php-config=/full/path/to/bin/php-config
$ make
$ make install