Comments (8)
Thanks for the report. How did you install the API? We already list the extension as a conflict in the composer.json file.
from geoip-api-php.
I'm not sure I understand the question correctly. I included the API (geop.inc
etc) in a small software that I then package and distribute. The GeoIP library is included using Composer, but I can't predict if the environment where the package will be installed will contain the geoip php extension or not.
Please note that, when my package is installed, Composer is not used to update the dependencies (nor it should be). Vendor libraries, including GeoIP, are simply included in the package, which is then just unzipped and executed "as is".
from geoip-api-php.
Couldn't you check if the function exists before you load geoip.inc?
from geoip-api-php.
geoip.inc
is loaded automatically by Composer, I don't have control over it. Also, that would not be a good workaround, because several, but not all of functions declared in geoip.inc
match ones existing in geoip php extension.
A better workaround, which is what I've done at the moment, if check for the existence of every single function in geoip.inc
. This, however, is still rough and far from optimal. A better solution would be replacing global functions with classes, or using namespaces. I understand that this would have the side effect of breaking compatibility with previous interfaces, but global functions are a legacy solution anyway and I don't think it makes sense to support PHP 4 anymore (Composer requires PHP 5.3 anyway).
from geoip-api-php.
We won't be redesigning the interface of this library as we are in the process of releasing a more modern GeoIP2 library, https://github.com/maxmind/GeoIP2-php.
We might consider merging a pull request with your other solution, but we would need to look at it more closely.
from geoip-api-php.
I saw the GeoIP2 library, I will probably switch to it when it will be ready.
Regarding the pull request, I don't think it would be necessary. I definitely don't recommend the solution I adopted, which is just an ugly hack that I put in place because I needed a solution quickly to prevent it from crashing my software.
Unfortunately, I don't see a reliable way to fix the incompatibility without a redesign. The geoip php extension offers some, but not all of the features of the GeoIP library (at least, not according to the documentation). Therefore, in their current status, a simply "one or the other" is the wrong logic and it won't work in many cases. If the two were fully overlapping, and providing the exact same functionalities, then it would be possible to add a simple check at the beginning of geoip.inc
, such as:
if(extension_loaded('geoip')) {
// geoip php extension loaded, don't load this library
return;
}
Since that is not the case, skipping the geoip.inc
altogether in the presence of the php extension could cause unpredictable results.
from geoip-api-php.
Given that we don't have control over the extension and the extension has a different API, we are unable to fix this. The extension is already marked as conflicting in the composer.json file. If you want seamless transition between a C extension and a pure PHP implementation, we suggest that you use GeoIP2.
from geoip-api-php.
i can solved this problem i Got to my CPanel Choose version of PHP and select the actual and disable in the options geoip extension.
Now all work good =).
Only need check your hosting cpanel or if you have a vps only change your php.ini
from geoip-api-php.
Related Issues (20)
- Troubles with installation through composer
- PHP memory requirement HOT 4
- Cannot redeclare geoip_country_code_by_name() HOT 2
- geoip/geoip v1.14 conflicts with ext-geoip[1.0.8] HOT 1
- Timezone ID invalid HOT 1
- Default timezone HOT 1
- Notice about non object HOT 4
- inconsistancy in quotes HOT 2
- Malta ('MT') missing from country / region list HOT 2
- Minimum PHP version HOT 1
- Installation WPML_GeoIP_IPResolver.class.php HOT 1
- Getting region HOT 1
- Missing regions in get_time_zone function HOT 1
- Wrong detection of the IRELAND ips HOT 2
- PHP Warning: fseek(): 16 is not a valid stream resource HOT 2
- strpos(): Non-string needles will be interpreted as strings in the future. HOT 1
- Dependabot can't resolve your PHP dependency files HOT 1
- Dependabot can't resolve your PHP dependency files HOT 1
- Not compatible with PHP 8.0.0 RC1 HOT 3
- CentOS7 and PHP8.0 geoip.c: ‘OnUpdateDirectory’: HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from geoip-api-php.