A Simple Guide to Detect PHP Enable Curl for Beginners – PHP Tutorial

By | September 16, 2019

In many php applications, we should use php curl model to access the remote url. However, if php disable curl, you will fail to access. In this tutorial, we will discuss how to detect php curl is enabled or not.

php curl tutorials and examples

List all php extensions

<?php
$extensions = get_loaded_extensions();
print_r($extensions);
?>

From the result, we can find php has enabled extensions, such as bcmath, calendar, ctype,  date, ereg, filter and ftp. We can check curl extension is in this list or not.

Detect php curl enable curl or not

<?php
function iscurlinstalled(){
	if  (in_array ('curl', get_loaded_extensions())) {
		return true;
	}
	else{
		return false;
	}
}
?>

If this function return true, php has enabled curl extension, otherwise, curl extension will not be used.

Category: PHP

Leave a Reply

Your email address will not be published. Required fields are marked *