here is the output im getting.
showing output after running this command : pecl install apc
downloading APC-3.1.13.tgz ...
Starting to download APC-3.1.13.tgz (171,591 bytes)
.....................................done: 171,591 bytes
could not extract the package.xml file from "/build/buildd/php5-5.5.9+dfsg/pear- build-download/APC-3.1.13.tgz"
Download of "pecl/apc" succeeded, but it is not a valid package archive
Error: cannot download "pecl/APC"
Download failed
install failed.
I have to install apc via cmd.
problem im facing is installation failure.
Try using the default system apc install:
sudo apt-get install php-apc
Here is how I install PHP APC:
Download latest stable Version
PHP APC-3.1.9 (stable) can be found on PECL page. Download and save (to desktop).
Begin installation
Untar APC, move into extracted directory
tar xvzf APC-3.1.9.tgz
cd APC-3.1.9/
Now, we want to phpize current directory. Because I use LAMPP PHP installation, its phpize is located in /opt/lampp/bin. Then, new .configure file will be created (your php-config may differ).
/opt/lampp/bin/phpize
./configure --with-php-config=/opt/lampp/bin/php-config
Then,
make
sudo make install
Configure php.ini file
Next, we want to configure APC for use. Edit your php.ini file. (mine was located in /opt/lampp/etc/php.ini).
vim /opt/lampp/etc/php.ini
Add these lines (preferably under Dynamic Extension section, but you can place it anywhere):
extension=apc.so
apc.enabled=1
apc.shm_size=40M
apc.ttl=7200
apc.user_ttl=7200
apc.enable_cli=1
apc.max_file_size=5M
also edit extension_dir on php.ini file
extension_dir = "/opt/lampp/lib/php/extensions/no-debug-non-zts-20100525/"
your extension_dir refers to make install result.
Now, look at phpinfo() page to verify your APC installation.
References:
Install guide
Related
I have gnupg and gpgme installed using homebrew.
I also linked both and made sure they are installed and linked by running brew gnupg install and brew gpgme install and got the message confirming the installation and the version.
I have placed the gnupg.so file in the extension path and also added extension=gnupg.so into the php.ini file.
I got the extension path and the specific php.ini's path from the infophp page.
After restarting mamp, I still don't see gnupg or gpgme as extensions on phpinfo, neither I can use gnupg in my php code.
using $gpg = new \gnupg(); this gives me error saying gnupg class doesn't exist.
[Symfony\Component\Debug\Exception\FatalThrowableError]
Class 'gnupg' not found
I tried another approach:
I also manually downloaded both gnupg and gpgme from their website extracted them ran following
./configure,
make,
sudo make install,
and was able to install successfully again, also made sure that gnupg.so is in the same path that shows up in phpinfo page for extension path and also added extension=gnupg.so to the same php.ini that appears in phpinfo page (I added the extension=gnupg.so right after all the other extensions in the php.ini file)
I am using:
mac os high sierra 10.13.3
php 7.1.12
mamp 4.4.1
gnupg 2.2.5 (I tried this version with brew install)
gnupg 1.4.0 (I tried this version with downloading from gnupg.org)
gpgme 1.10.0
I also would like to know, after hopefully fixing the above mentioned problems, do I need to include anything in my php file in order to use gnupg?
what are the differences between gnupg and gpgme? do I need both in order to encrypt a file in php?
if I wasn't able to fix this what is another way to encrypt xml files or files containing text data? I need to encrypt the file and FTP to another server and decrypt it over there.
Thank you all in advance for your help
I was able to solve this issue using Pecl to install GnuPG.
This link helped me a lot as well.
Run the following in order to install the library:
sudo apt-get -y install gcc make autoconf libc-dev pkg-config
sudo apt-get -y install libgpgme11-dev
sudo pecl install gnupg
Restart your server with: "service apache2 restart", or "sudo service phpX.Y-fpm-sp restart" where x.y is the major.minor version of your php. Note: there are multiple different ways to restart the system so the changes take effect, so please do your own research on how to do it depending on the server and your php version.
As I've explained in my question, try to find the right php.ini file to add the "extension=gnupg.so" into. most common places you'll find your php.ini are:
/etc/php/7.2/apache2 (you can use your PHP version instead of 7.2)
/etc/php/7.2/cli (you can use your PHP version instead of 7.2)
The better way is to find out the php.ini path that loads the extensions, from the phpinfo()
Now Verify that it all went well with the following command:
"php -i | grep -i gnup"
If everything is working as expected you'll see something like this:
/etc/php7.0-sp/conf.d/gnupg.ini,
gnupg
gnupg support => enabled
Ubuntu 16.04.2
LSPHP7.0
wget -O - http://rpms.litespeedtech.com/debian/enable_lst_debain_repo.sh | bash
apt install -y lsphp70
Then I added /usr/local/lsws/lsphp70/bin to $PATH and made a symlink for /usr/local/lsws/lsphp70/bin/php7.0 to /usr/local/lsws/lsphp70/bin/php. This way I can run php in terminal as cli version.
apt install composer
composer require geoip2/geoip2:~2.0
I got an error said the requested PHP extension curl is missing from your system.
And also it said
To enable extensions, verify that they are enabled in those .ini files:
- /etc/php/7.0/cli/php.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
But when I run php -i | grep php.ini it shows the ini is not /etc/php/7.0/cli/php.ini but /usr/local/lsws/lsphp70/etc/php/7.0/litespeed/php.ini
Further more, I run php --ini, it shows:
Configuration File (php.ini) Path: /usr/local/lsws/lsphp70//etc/php/7.0/litespeed/
Loaded Configuration File: /usr/local/lsws/lsphp70/etc/php/7.0/litespeed/php.ini
Scan for additional .ini files in: /usr/local/lsws/lsphp70//etc/php/7.0/mods-available/
Additional .ini files parsed: /usr/local/lsws/lsphp70//etc/php/7.0/mods-available/curl.ini,
/usr/local/lsws/lsphp70//etc/php/7.0/mods-available/imap.ini,
/usr/local/lsws/lsphp70//etc/php/7.0/mods-available/json.ini,
/usr/local/lsws/lsphp70//etc/php/7.0/mods-available/mysqli.ini,
/usr/local/lsws/lsphp70//etc/php/7.0/mods-available/opcache.ini,
/usr/local/lsws/lsphp70//etc/php/7.0/mods-available/pdo_mysql.ini
How can php cli get /etc/php/7.0/cli/php.ini as its php config file? Anyone gives a clue? thanks.
Ubuntu normally installs system default php(currently php7.0) to /usr/bin/php
Composer will normally call the PHP defined in $PATH, usually /usr/bin/php.
The Error "the requested PHP extension curl is missing from your system" means Ubuntu system default php7.0 curl is missing. To resolve:
apt-get install php7.0-curl
So far, it should resolve your problem already.
LiteSpeed Web Server normally use LiteSpeed API to communicate with PHP engine, which is faster than other APIs. In LiteSpeed Ubuntu/Debian repo, it provides different versions of lsphp, which will be at different location other than system default location, normally at /usr/local/lsws/lsphpxx/bin/.
Composer will normally use system default php location as explain above. If you want to overwrite PHP path to use lsphp70 php binary, you will need to add this path to the beginning of $PATH.
export PATH="/usr/local/lsws/lsphp70/bin/:$PATH"
This way, when you run:
which php
System should use the php found first in the PATH, which is /usr/local/lsws/lsphp70/bin/php
In this case, when you see similar php-curl missing error message, you should run:
apt-get install lsphp70-curl
to fix the problem.
To make the new PATH permanently, you can edit ~/.profile or .bashrc, or any other similar way, which is beyond the discussion of this topic.
I am searching the way to debug php scripts. In internet i found information that i can do that with MacGDBp + XDebug.
When i'm trying install using PECL in Shell:
sudo pecl install xdebug
The next error have been occured:
downloading xdebug-2.4.0.tgz ...
Starting to download xdebug-2.4.0.tgz (264,832 bytes)
.....................done: 264,832 bytes
76 source files, building
running: phpize
grep: /usr/include/php/main/php.h: No such file or directory
grep: /usr/include/php/Zend/zend_modules.h: No such file or directory
grep: /usr/include/php/Zend/zend_extensions.h: No such file or directory
Configuring for:
PHP Api Version:
Zend Module Api No:
Zend Extension Api No:
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.
Help me find the way to solve that problem.
XDebug is available by default. Just enable it by
1) sudo nano /etc/php.ini (or sudo cp /etc/php.ini.default /etc/php.ini first if the file doesn't yet exist)
2) Add these lines at the end (verify the path with ls ls /usr/lib/php/extensions/)
[Xdebug]
zend_extension="/usr/lib/php/extensions/no-debug-non-zts-20121212/xdebug.so"
3) Restart apache using sudo apachectl restart
4) Verify by php -m | grep xdebug
Mike Chamberlain's excellent response almost got xdebug working with NetBeans using Mac OS Sierra 10.12. Only two changes required:
In step 2, after
zend_extension="/usr/lib/php/extensions/no-debug-non-zts-20131226/xdebug.so"
also add
xdebug.remote_enable=1
This was necessary because the precompiled .so file has xdebug remote access disabled. NetBeans and other tools need it to be enabled.
For debugging using xdebug i used the following steps
For installing php72 I installed using brew with the following command:
brew install homebrew/php/php72-xdebug
I added the following command to the bottom of the php.ini file:
zend_extension=/usr/local/Cellar/php72-xdebug/2.6.0/xdebug.so
Note: if you need to search for a version of xdebug with brew use:
brew search xdebug
Any help would be great. I've been stuck on this for hours. I'm trying to install Mongo to work with PHP on a Mac. I have Pear/pecl installed and working. When I call sudo pecl install mongo, everything looks like it's compiling/building successfully, but at the end I get this message.
Build process completed successfully Installing
'/usr/lib/php/extensions/no-debug-non-zts-20121212/mongo.so' ERROR:
failed to write
/usr/lib/php/extensions/no-debug-non-zts-20121212/mongo.so
(copy(/usr/lib/php/extensions/no-debug-non-zts-20121212/mongo.so):
failed to open stream: Operation not permitted)
And the mongo.so never gets written. Can someone help? I'm using MAMP on Mac OSX El Capitan.
I've solved this problem by changing extension_dir in php.ini.
Create a local extension dir and copy your existing extensions into
mkdir -p /usr/local/lib/php/extensions
cp /usr/lib/php/extensions/no-debug-non-zts-20121212/* /usr/local/lib/php/extensions/
Update your php.ini, change the extension_dir and enable mongo:
extension_dir = "/usr/local/lib/php/extensions/"
extension=mongo.so
Now the extension dir is writeable you can copy the mongo.so there.
Here's how to compile a mongo.so
wget http://pecl.php.net/get/mongo
tar xzvf mongo
cd mongo-1.6.12
phpize
./configure --with-php-config=/usr/bin/php-config --with-mongo-sasl=no
make
You can find the compiled library in .libs folder: .libs/mongo.so
Copy it to extensions dir
cp .libs/mongo.so /usr/local/bin/php/extensions/
Finally, you can check whether it's working or not, by typing php -m | grep mongo in the command line.
Robert has solved this problem in this answer.
stackoverflow.com/a/31884146
.
Basically the issue is the El Capitan's Rootless feature. Its needs to be disabled in recovery mode, perform the pecl install and that enable it back again .
For some reason , pecl did not install it into my php extensions directly so, I had to copy the mongo extension pecl generated from the local library to my php extension folder xampp files for it to work
I've been having some trouble getting CURL working with PHP on a server I inherited.
So far I have enabled the extension in my php.ini by uncommenting the extension=php_curl.dll line, and restarting apache.
However, I now receive the following error when starting PHP:
PHP Warning: PHP Startup: Unable to load dynamic library '/opt/local/lib/php/extensions/php_curl.dll
The php_curl.dll file doesn't exist in the aforementioned directory, and I can't find anywhere legitimate to download it from(doesn't seem to be included in PHP, or Curl).
UPDATE
Following the steps provided in the answer here, I was able to compile a new php_curl.so file and install it to the extensions directory.
Cudos go to Francois Deschenes!!
To compile a curl.so (php_curl.dll) module from scratch:
Download and extract a new copy of your version of PHP.
Open a terminal window and go to the curl directory (Type cd php-5.3.3/ext/curl/).
Type phpize.
Type ./configure.
Type make.
Type sudo make install.
Uncomment extension=curl.so in your php.ini.
You should also make sure the extension is commented out before you start the processes, otherwise you may receive an error about the module already existing.
Why don't use
sudo port install php5-curl
(on php54: php54-curl)?
Download the 'port' using the following URL and install it:
http://www.macports.org/install.php
There are different versions and you can select one installation pack for your Mac Version.
After installed, open a terminal and type the following command to install directly,
$ sudo port install php5-curl
Otherwise
- Login to port terminal by just typing
$ sudo port
and type
> install php5-curl
It will get few minutes to install all the dependancies and finally you will see the following message
---> No broken files found.
Following the steps provided in the answer here, I was able to compile a new php_curl.so file and install it to the extensions directory.
Cudos go to Francois Deschenes!!
To compile a curl.so (php_curl.dll) module from scratch:
Download and extract a new copy of your version of PHP.
Open a terminal window and go to the curl directory (Type cd php-5.3.3/ext/curl/).
Type phpize.
Type ./configure.
Type make.
Type sudo make install.
Uncomment extension=curl.so in your php.ini.
You should also make sure the extension is commented out before you start the processes, otherwise you may receive an error about the module already existing.