I compiled PHP but there is no "extensions" folder. I do not see any configuration flags related to extensions. Is the extension folder manually added after or when I install an extension.
The following website had the modules I needed: https://pecl.php.net/
Specifically, apc.so, geoip.so, imagick.so and redis.so
On the OLD system I need to find which version was being used so I was able to install on the NEW system. The following showed me the version for imagick.
/usr/local/php54/bin/php --re imagick | head -1
Then I download the package to the new system using wget.
wget https://pecl.php.net/get/imagick-3.4.1.tgz
Uncompress...
tar zxvf imagick-3.4.1.tgz
CD to the directory
cd imagick-3.4.1
Run the following which gives the configure file.
/usr/local/php54/bin/phpize
Configure
configure --with-php-config=/usr/local/php54/bin/php-config
Followed by make, make test and make install.
After doing the make install you'll see something similar to the following.
Installing shared extensions: /usr/local/php54/lib/php/extensions/no-debug-non-zts-20100525/
Installing header files: /usr/local/php54/include/php/
The extensions directory is created for you.
Related
When I try to run a zend extension compiled with PHP version 7.2 on an environment with PHP version 7.0, I get the following error:
Unable to initialize module
Module compiled with module API=20170718
PHP compiled with module API=20151012
These options need to match
How can I create the extension so that it works on the different versions of PHP, especially for all the 7.x versions?
Is there a way to ignore this check or any workaround for this?
Short answer - NO, you will need to compile it using the correct version.
Seen this a number of times.
First step is to download your .tar.gz extension source code then unzip it with tar -zxvf file.tar.gz and change into the folder.
Bring up a web page displaying your servers php.ini. You are looking for the version of PHP API, and the extension_dir.
In your terminal, cd into the module source code folder, and type phpize.
If when you check the API versions , they are different from your php.ini, then an old version of php is being used in the terminal, and your module will not work! In this case, you need to get it to use the correct phpize.
type which phpize to find out where the offending file is. (mine was /usr/bin/phpize)
My PHP appeared to be in /usr/local, so I tried running /usr/local/phpize. The API’s matched. So then I did the following:
mv /usr/bin/phpize /usr/bin/phpize-old
ln -s /usr/local/bin/phpize /usr/bin/phpize
Half way there! We need to do the same for php-config
mv /usr/bin/php-config /usr/bin/php-config-old
ln -s /usr/local/bin/php-config /usr/bin/php-config
Now you have done that, installation should be trivial, and work as per loads of tutorial/instruction pages on the web.
./configure
make
make install
Finally edit your php.ini and add ‘extension = memcached.so’ (or whatever module you compiled), and restart your apache server!
One last thing. ou may need to run phpize –clean if it is still compiling with the older stuff from within the modules source folder.
Hope this helps! Here's my original blog post on the matter https://delboy1978uk.wordpress.com/2013/10/30/manually-compiling-php-modules-successfully/
As the title says im trying to install a php extension (zip.so) that is missing from php7.1 version in ampps 3.8. I have searched for an answer but no luck so far.
Also using php5.6 and going to the php extensions list im able to see the zip extension, but since the software that im trying to intstall requires php 7.X im unable to simply use php5.6.
Thanks for the help in advance.
I finally found a way to do it:
Go to (for example) https://pecl.php.net/ and download the extension that you need.
Unzip the extension and go to the file location $ cd my/extension
Run phpize /usr/local/ampps/php-7.1/bin/phpize
Next run ./configure --with-php-config=/path/to/my/php-config for example ./configure --with-php-config=/usr/local/ampps/php-7.1/bin/php-config
make and sudo make install
In the end of sudo make install log you will find this Installing shared extensions: /usr/local/ampps/php-7.1/lib/extensions/no-debug-non-zts-20160303/ file path.
Go to the file path and you will find your compiled extension, for me it was zip.so
Finally copy the extension into your php folder /usr/local/ampps/php-7.1/lib/extensions/ext and you will be able to see it on the list of extensions in ampps, dont forget to enable it and restart apache2!
Hope it helps!
There is an easier way to do so
Open AMPPS Application ->Stop Apache (If running)
2 In "PHP" Tab -> "PHP Extension"
Enable "zip.so".
Apply
Restart Apache.
See image for clarification I am using a mac
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've been having some issues with phpmyadmin suddenly not cooperating with my php configuration, so I decided to reinstall php7 and phpmyadmin from the latest stable tar file on their respective websites.
(Edit: Here is a link to the issue that this is a sub-issue of: phpmyadmin Error with php7: Missing json extension)
When I uninstalled php7 (which was originally installed via this ppa: ondrej/php)
then reinstalled it via the tar file, the php files went into usr/lib instead of etc/ which I understand to be the default php directory. Why are they being installed in usr/lib now?
Also, when I check this new directory, it seem to be missing php.ini and the apache2 service directory that php usually ships with. Why is this? Do I have to install these separately now?
In short: Why does installing php7 from a tar file have such different defaults than the apt install of php5, and what can I do to make sure that something like phpmyadmin can understand and use this install of php7?
Thanks for any input.
If you compile from source, there are various configuration options to determine where files go. The defaults for configure are not necessarily the defaults for a rpm or deb package.
Along with the PHP configure options: http://php.net/manual/en/configure.about.php, you have GNU general configuration options like --prefix to determine the install directory or --sysconfdir to determine the system configuration directory.
See all the options here: https://gcc.gnu.org/install/configure.html
--prefix=dirname
Specify the toplevel installation directory. This is the recommended way to install the tools into a directory other than the
default. The toplevel installation directory defaults to /usr/local.
--exec-prefix=dirname
Specify the toplevel installation directory for architecture-dependent files. The default is prefix.
--bindir=dirname
Specify the installation directory for the executables called by users (such as gcc and g++). The default is exec-prefix/bin.
--libdir=dirname
Specify the installation directory for object code libraries and internal data files of GCC. The default is exec-prefix/lib.
--libexecdir=dirname
Specify the installation directory for internal executables of GCC. The default is exec-prefix/libexec.
--with-slibdir=dirname
Specify the installation directory for the shared libgcc library. The default is libdir.
--datarootdir=dirname
Specify the root of the directory tree for read-only architecture-independent data files referenced by GCC. The default is
prefix/share.
--infodir=dirname
Specify the installation directory for documentation in info format. The default is datarootdir/info.
--datadir=dirname
Specify the installation directory for some architecture-independent data files referenced by GCC. The default is
datarootdir.
On my sever i successfully install phalcon version 0.6.0 through git. These are the steps i used.
git clone git://github.com/phalcon/cphalcon.git
cd cphalcon/build
sudo ./install
restart the webserver
I tried to update to version 0.7.0, so i deleted the original folder and re-downloaded the git folder. I followed the same steps, after the install i check phpinfo. It installed correctly but, it installed a previous version(0.5.2).
I tried to install the extension multiple times but, it still gives me the old version.
is there something im doing wrong, any help would be appreciated.
Find if you have any phalcon.so files laying around and they are used instead of the actual one. It could very well be that the 0.5.2 is somewhere in your system, referenced by your web server and the installation process cannot update it.
locate phalcon.so
Note: for my installation it was in /usr/lib/php5/20100525/phalcon.so
Check your php.ini or your /etc/php/conf.d folder for references to the extension. If there are some remove them.
Re-run the installation process again using the
cd build
sudo ./install
Note the script output, especially at the end. It will tell you where the extension was installed.
Note the folder and add the directive in the php.ini file and then restart your web server for the changes to take effect.
It seems that you have installed PHP 5.3 on CLI but PHP 5.4 on Apache/Nginx, make sure your 'phpize' command is pointing to the 5.4 one:
[#] whereis phpize
Once you know the correct path change the priority of the executable, delete the PHP 5.3 or add an alias in the bash console:
[#] alias phpize=/path/to/5.4/phpize
Then try to run ./install again