I'm having trouble understanding these ;extension=xxx.dll files in php.ini
Is there any document I can refer to which explains these extensions in detail?
The .dll files are for PHP extensions. You can read about all of them here: http://php.net/manual/en/install.windows.extensions.php
PHP extensions give you extra PHP functionality. They are basically function libraries that add features like MySQL functions, LDAP functions, and even Java functions.
To activate the extensions provided by the default PHP install, simply uncomment the ;extension=xxx.dll line (remove the semicolon) so that it just looks like extension=xxx.dll.
However, not all extensions are bundled with PHP. For example, the PECL extensions, including APC, have to be installed externally. Instructions for installing PECL can be found here: http://www.php.net/manual/en/install.pecl.php
"Extension Writing Part I: Introduction to PHP and Zend"
You only need to worry about those if you're running on a Windows server - since they appear to be commented out (; at the start of the line) I would assume you're on a Linux server?
In any case, you should be able to look up each extension individually on Google.
Related
I'm trying to connect to another database within a wordpress plugin. Inside the main php file, I tried to call 'pg_connect($con_string);' but I now realize that this function is undefined. Is there a library that I need to include somewhere in the directory? Thanks.
This function is in the php-pgsql package or module. Not sure what OS you are on, but on some Linux distributions the package has version-specific naming like php5-pgsql or php7-pgsql so you might need to install the version specific to whatever PHP version you're using. You can use phpinfo() to output information that will help you troubleshooot what is going on, including versions and what packages are enabled.
The package may need to be installed, or it may be installed but disabled. It is enabled by default in PHP >= 5.3.x. If you're finding it is not included by default, you likely either have a very old version of PHP, or one that is custom-configured not to have this package enabled.
If the issue is enabling it, look in the configuration files. On some systems there is a file installed in /etc/php.d/ like 20-pgsql.ini with a line that will enable the extension. In other systems it is in php.ini which is usually somewhere in the /etc directory. Search these files for a line containing the text pgsql and make sure it is enabled. Then restart the web server (or PHP-FPM if you are using that.)
Hopefully this will address the issue.
If you need further help, the official PostgreSQL documentation is a good resource:
https://www.tutorialspoint.com/postgresql/postgresql_php.htm
And beyond that I would recommend a web search including your specific distribution and possibly PHP version, as this will return information with the correct configuration file locations and options.
this is not a bug in my program but a general doubt. I've heard and read that in Windows people uncomment extension names in PHP.ini to enable them. Does this works in Ubuntu too?
Actually I've tried it in my Ubuntu and it didn't work, just want to be sure it doesn't works like this in Ubuntu or it was my fault somewhere (which doesn't matters now ).
In my case I didn't even touched the ini file but just recompiled the php from source with passing extension arguments. Why didn't I have to enable them?
Tried searching SO but didn't find any questions related to this.
With Windows, pretty much all the extensions are already compiled as DLLs. So when you uncomment the line in the ini file and restart the service, it simply loads the file.
When you compile from source in Linux, you aren't building all the extensions by default. You usually have to explicitly specify which extensions you want to enable and they are compiled along with PHP. So the extension has to be compiled successfully and be accessible to be used. The ini file is simply the instruction of whether or not to TRY loading that extension when PHP starts.
Also, there are some basic extensions that are part of the typical PHP build / configure / make process. You can consult the docs to figure out which ones are default but a good practice is to explicitly enable those that you want.
Don't build EVERY extension if you don't need them though. The more extensions that get loaded, the more memory that PHP needs/uses when starting up.
the simple answer is yes it works but if only the extension is in your ubuntu.
I'm on Windows 10, and I really need to install this PHP extension in order to use advanced GeoPHP methods. I've already asked about this previously here. There is no available DLL for this extension, and the instructions for installation on GitHub are for Linux. What I've understood is that I need to recompile PHP with the extensions in the ext folder, so I'm planning on doing that using these instructions. However, I've previously installed PHP through XAMPP.
My question is, will these instructions work with this? If yes, where can I find the PHP source files? I'm not quite sure what they look like, and googling "PHP source files location" gives me stuff about actual PHP files, not the ones used for installation. I just want to make sure. Thanks.
No, you do not have to recompile PHP. The module you stated is not baked into PHP but dynamically included.
Just build the module and include it like
extension=geos.dll
The Github link you posted does have instructions...
I have a class that makes use of the php_printer extension but I can't find it anywhere and at php.net it says it's currently unavailable. I googled it, but all I downloaded from other sites was not efficient. It seemed to me it was outdated. I copied the .dll file in the extensions folder and set the configuration in php.ini but I still couldn't use its built-in functions.I have PHP 5.3.1 installed.
Then you did not google very well. There still are repositories of precompiled binaries elsewhere:
https://github.com/maryo/php-5.5-windows-extensions
http://windows.php.net/downloads/pecl/snaps/printer/0.1.0-dev/
http://downloads.php.net/pierre/
Just saying it does not work is insufficient. I understand that compiling from source is effortful on Windows (pecl install printer given a proper compiler setup), but at the very least run the PHP interpreter on the commandline after editing the php.ini. It would give you a useful error message in case of linking errors, or none in case you edited the wrong config file. (Too few details to answer.)
See also: PHP 5.4.7 Compiling ext php_printer
download and unzip the extenssions file
http://museum.php.net/php5/pecl-5.2.6-nts-Win32.zip
http://downloads.php.net/pierre/ appears to have one that dates to 2010.
I'd consider looking for some other solution though, it doesn't look like a very widely supported extension and it's not been updated for at least a year.
Now I'm seeking of php_pdo_mysql.dll version 5.2.5.5,
only found this:
http://dllcentral.com/php_pdo_mysql.dll/5.2.5.5/
But my zend studio 5.5 says it's invalid!
Is there any other place I can try my luck?
Brrr, I really wouldn't download binaries (that could do anything they please on the system, and possibly even the web pages that get served) from locations like that.
Isn't PDO included in PHP by default since 5.0?
From the PDO installation manual:
PDO and all the major drivers ship with PHP as shared extensions, and simply need to be activated by editing the php.ini file:
THe pdo extentions come default with php installation as far as I know.
You should try to uncoment the package in your php.ini file and then reload apache.
Looking at this I would have thought that you wouldn't need a DLL at all. From here:
PDO ships with PHP 5.1, and is
available as a PECL extension for PHP
5.0; PDO requires the new OO features in the core of PHP 5, and so will not
run with earlier versions of PHP.
Official binaries can be found at:
http://windows.php.net/download/
However, you say you already have a Windows binary. Look at it carefully: you should already have that DLL available. Probably, you need to rerun the installer and select that extension.