[TUTORIAL] Server Configuration – cURL


main_cURL
During the deployment of one of our last projects on a client’s server, we had difficulties because we didn’t consider the difference between local and remote servers earlier enough. We had to go into a long debug process before realizing that the problem was not a programming issue but instead came from the server’s PHP configuration

When you have to work on projects that will not live on your server, many people get involved during the process of setting up the server: the client to whom you deliver the product, their technical engineer and the technical team of the server. We also have to consider time zone and the availability of each person involved. Because the process involves several people, it can take longer than expected. In order to avoid any trouble, the server configuration should be one of the first steps during a project lifecycle.

Every time you refer to an API in your code, you need to make sure that all required PHP packages are installed.

To check what the configuration settings of your server are, you can use the phpinfo() function. Then you can see whether or not you need to install new packages and which version of PHP you have.

The problem was coming from the fact that we were using the Facebook Graph API for PHP without having the required package installed. To work fully, cURL needed to be install in our server. This is how I learned what cURL is and how to install it!

cURL is a library that allows you to connect to a webserver using a variety of Internet protocols such as HTTP and FTP. With this library, any type of client-server request can be perfomed and the response can be treated using any technologies such as XML, JSON, SOAP. In order to use PHP’s cURL function, the libcurl package needs to be installed on the server. The installation varies depending on which platform you’re working on.

The Linux way of installing cURL is:

sudo apt-get install curl libcurl3 libcurl3-dev php5-curl

Once the package installed, don’t forget to restart your server via the command:

shutdown -r now

You want to be sure that libcurl is installed by using the PHP function phpinfo().

img_01_phpInfo()

General Topics Resources Technology Tutorials:

Leave a comment