Every now and then you will probably install an application that has a certain amount of prerequisites that you should verify on your server before beginning installation. Today I needed to verify that PHP was compiled with curl and/or libcurl support to install an application on a CentOS Linux server. I also needed to verify that PHP safe_mode was set to off and PHP register_globals was also set to off. The easiest way to verify PHP settings is to create a temporary PHP file that calls the phpinfo function and displays the results on a web page. Use the information below to verify that PHP is compiled with curl support on CentOS Linux or any other Linux server.
Generate A Temporary PHP Info Page To Display PHP Details:
Go to the web server root directory and create a file, using your favorite text editor, called phpinfo.php. The phpinfo.php file should have the below contents.
Contents Of phpinfo.php File:
- <?php phpinfo(); ?>
It is important to make sure that this file is removed immediately after it is created because it can be used by people attempting to gain information about your server. The default view of a phpinfo.php file using the PHP phpinfo function is displayed below. As long as you put the phpinfo.php file in your web servers root directory you can view the phpinfo page visit the IP of your server /phpinfo.php such as http://192.168.1.100/phpinfo.php.
Default View Of A Page Displaying phpinfo:
As you can see from the beginning of the phpinfo output there is a lot of information provided by the phpinfo function. To verify PHP on your server has been installed with curl and libcurl support you can either scroll down the page until you see Curl or use the find function from your browser to search for “curl”. The curl section of the phpinfo function will look similar to the below if PHP on your server has curl and libcurl support.
View Of phpinfo Function Output Displaying Curl & Libcurl Support:
The primary thing to verify is the line that starts with “cURL Support” shows enabled in the second column. The second line will typically display curl/libcurl version information. As you can see in the example above libcurl version 7.15.5 is the version of curl available to PHP on this server. To locate other information such as if safe_mode and register_globals are configured to be on or off you can search the phpinfo page.
When I run phpinfo, I dont get that section of curl support enabled.
Whereas, I have curl installed on windows, and the extension for curl uncommented in php.ini and phpforapache.ini too.
I can see the green tick for php curl being enabled in wamp->php->php extensions too.
I just cant see this curl enabled section on my localhost when I run phpinfo().How do I enable that module????