SOLVED Easyapache enable custom CURL

k2tec

Well-Known Member
Aug 26, 2011
104
5
68
Netherlands
cPanel Access Level
Root Administrator
I found a interesting site to update curl but this is for easyapache 3.
is there a possibility to edit a file in EA4 so if you run EA4 it will install it.
linoxide.com/how-tos/update-curl-cpanel-centos-7/
 
Last edited:

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,884
2,254
463
Hello,

The cURL package version corresponds with the version installed on your Operating System on systems using EasyApache 4. However, rather than installing a custom cURL version on your system, you may want to wait for the implementation of the following feature request:

Update cURL for EasyApache 4 and CentOS or CloudLinux 6.8

Feel free to review the existing comments, as this topic is discussed in detail on this request.

Thank you.
 

k2tec

Well-Known Member
Aug 26, 2011
104
5
68
Netherlands
cPanel Access Level
Root Administrator
I read that review.
How is it possible that you intend to work with the latest versions (EA4, Centos7, HTTPS) software, but you're going a step back in time. Everything worked well in EA3, Centos 6.5.
Most OpenCart online stores have problems with Json (curl), customers can no longer work with it.
Also tried to get hostbill working on the new server, did not work, back to the old server.
Curl works with old SSL setting.

This update request is not from last week.

I placed all my customers from 1 server back to the old one.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,884
2,254
463
Most OpenCart online stores have problems with Json (curl), customers can no longer work with it.
Also tried to get hostbill working on the new server, did not work, back to the old server.
Could you let us know what in-particular isn't working? For instance, if you setup a test script to use curl via ssl using the instructions from a third-party URL (e.g. cURL SSL Test Script - Tips and Tricks ), do you encounter any issues?

Thank you.
 

k2tec

Well-Known Member
Aug 26, 2011
104
5
68
Netherlands
cPanel Access Level
Root Administrator
Hi Michael,
I maded that test in in the root dir it is working.

This one is working

Testing ... NextScripts: Unique API/Automation Software for Social Networks Google+, Pinterest, Facebook, Twitter, Etc.. - NextScripts: Unique API/Automation Software for Social Networks Google+, Pinterest, Facebook, Twitter, Etc..
....HTTPS to NXS - OK
Testing ... Contact us – Google - Contact us – Google
....HTTP to Google - OK
Testing ... Contact us – Google - Contact us – Google
....HTTPS to Google - OK
Testing ... Facebook - Log In or Sign Up - Facebook - Log In or Sign Up
....HTTPS to Facebook - OK
Testing ... https://graph.facebook.com/ - https://graph.facebook.com/
....HTTPS to API (Graph) Facebook - OK
Testing ... World’s Largest Professional Network | LinkedIn - World’s Largest Professional Network | LinkedIn
....HTTPS to LinkedIn - OK

The link you sended give this error.

Code:
Array
(
    [url] => https://www.stanford.edu/group/idg/leland/samples/secure/test.html
    [content_type] => text/html; charset=iso-8859-1
    [http_code] => 404
    [header_size] => 272
    [request_size] => 96
    [filetime] => -1
    [ssl_verify_result] => 0
    [redirect_count] => 0
    [total_time] => 0.845956
    [namelookup_time] => 0.028425
    [connect_time] => 0.165803
    [pretransfer_time] => 0.636179
    [size_upload] => 0
    [size_download] => 5114
    [speed_download] => 6045
    [speed_upload] => 0
    [download_content_length] => -1
    [upload_content_length] => 0
    [starttransfer_time] => 0.845746
    [redirect_time] => 0
    [redirect_url] =>
    [primary_ip] => 2607:f6d0:0:925a::ab43:d7c8
    [certinfo] => Array
        (
        )

    [primary_port] => 443
    [local_ip] => 2a02:2770:8:0:21a:4aff:fe44:e5f4
    [local_port] => 48496
)

Errors: 0

HTTP/1.1 404 Not Found Date: Tue, 24 Jan 2017 20:57:52 GMT Server: Apache Vary: accept-language,accept-charset Accept-Ranges: bytes Strict-Transport-Security: max-age=0 Transfer-Encoding: chunked Content-Type: text/html; charset=iso-8859-1 Content-Language: en
Skip navigation
Stanford

I have 5 vps with OpenCart ,EA3, Apache 2.4 , PHP 5.6 No problems with this code from OC
Code:
    public function api() {
        $this->load->language('sale/order');

        if ($this->validate()) {
            // Store
            if (isset($this->request->get['store_id'])) {
                $store_id = $this->request->get['store_id'];
            } else {
                $store_id = 0;
            }

            $this->load->model('setting/store');

            $store_info = $this->model_setting_store->getStore($store_id);

            if ($store_info) {
                $url = $store_info['ssl'];
            } else {
                $url = HTTPS_CATALOG;
            }

            if (isset($this->session->data['cookie']) && isset($this->request->get['api'])) {
                // Include any URL perameters
                $url_data = array();

                foreach($this->request->get as $key => $value) {
                    if ($key != 'route' && $key != 'token' && $key != 'store_id') {
                        $url_data[$key] = $value;
                    }
                }

                $curl = curl_init();

                // Set SSL if required
                if (substr($url, 0, 5) == 'https') {
                    curl_setopt($curl, CURLOPT_PORT, 443);
                }

                curl_setopt($curl, CURLOPT_HEADER, false);
                curl_setopt($curl, CURLINFO_HEADER_OUT, true);
                curl_setopt($curl, CURLOPT_USERAGENT, $this->request->server['HTTP_USER_AGENT']);
                curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
                curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
                curl_setopt($curl, CURLOPT_FORBID_REUSE, false);
                curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
                curl_setopt($curl, CURLOPT_URL, $url . 'index.php?route=' . $this->request->get['api'] . ($url_data ? '&' . http_build_query($url_data) : ''));

                if ($this->request->post) {
                    curl_setopt($curl, CURLOPT_POST, true);
                    curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($this->request->post));
                }

                curl_setopt($curl, CURLOPT_COOKIE, session_name() . '=' . $this->session->data['cookie'] . ';');

                $json = curl_exec($curl);

                curl_close($curl);
            }
        } else {
            $response = array();

            $response['error'] = $this->error;

            $json = json_encode($response);
        }

        $this->response->addHeader('Content-Type: application/json');
        $this->response->setOutput($json);
    }
}
but with almost the same setting with EA4 it gives me this error.
Code:
SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data

OK

<b>Notice</b>: Undefined variable: json in
My Hosting site don't work at all.

Multi curl only works when I use a subdomain with http.

I hope you can help to make this upgrade to EA4 working
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,884
2,254
463
Hello,

It looks to be working based on the output you provided. Could you open a support ticket using the link in my signature so we can take a closer look and see why that one particular application isn't working?

Thank you.
 

k2tec

Well-Known Member
Aug 26, 2011
104
5
68
Netherlands
cPanel Access Level
Root Administrator
Hello Michael,
I think I found it.
I was making a new test account with a site with that error. I looked if everything was working and if that error was still there.
To my suprise the error was gone.

I think a lot of old settings are going with it when you transfer a account on a EA3 to a new EA4 server.

If you still want to look on a account with that error I can open a support ticket.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,884
2,254
463
To my suprise the error was gone.
If you still want to look on a account with that error I can open a support ticket.
Hello,

Could you clarify a little more on what in-particular isn't working as expected? For instance, is there anything in common with the scripts that continue to fail (e.g. all Wordpress scripts)?

Thank you.
 

k2tec

Well-Known Member
Aug 26, 2011
104
5
68
Netherlands
cPanel Access Level
Root Administrator
Hello,
This morning I had removed the domain with the error. Created a new account for that domain. Placed back the public_htm and sql . The same as with the test account, but now the error is still there. What I remember is that I place the SSL before the Public_html and sql
This evening or tomorrow morning I want to try it again, but than first creat a account than the SSL certificate and than place back the public_html and sql.

There are no errors in the apache log

this script fail
PHP:
  public function api() {
        $this->load->language('sale/order');

        if ($this->validate()) {
            // Store
            if (isset($this->request->get['store_id'])) {
                $store_id = $this->request->get['store_id'];
            } else {
                $store_id = 0;
            }

            $this->load->model('setting/store');

            $store_info = $this->model_setting_store->getStore($store_id);

            if ($store_info) {
                $url = $store_info['ssl'];
            } else {
                $url = HTTPS_CATALOG;
            }

            if (isset($this->session->data['cookie']) && isset($this->request->get['api'])) {
                // Include any URL perameters
                $url_data = array();

                foreach($this->request->get as $key => $value) {
                    if ($key != 'route' && $key != 'token' && $key != 'store_id') {
                        $url_data[$key] = $value;
                    }
                }

                $curl = curl_init();

                // Set SSL if required
                if (substr($url, 0, 5) == 'https') {
                    curl_setopt($curl, CURLOPT_PORT, 443);
                }

                curl_setopt($curl, CURLOPT_HEADER, false);
                curl_setopt($curl, CURLINFO_HEADER_OUT, true);
                curl_setopt($curl, CURLOPT_USERAGENT, $this->request->server['HTTP_USER_AGENT']);
                curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
                curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
                curl_setopt($curl, CURLOPT_FORBID_REUSE, false);
                curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
                curl_setopt($curl, CURLOPT_URL, $url . 'index.php?route=' . $this->request->get['api'] . ($url_data ? '&' . http_build_query($url_data) : ''));

                if ($this->request->post) {
                    curl_setopt($curl, CURLOPT_POST, true);
                    curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($this->request->post));
                }

                curl_setopt($curl, CURLOPT_COOKIE, session_name() . '=' . $this->session->data['cookie'] . ';');

                $json = curl_exec($curl);

                curl_close($curl);
            }
        } else {
            $response = array();

            $response['error'] = $this->error;

            $json = json_encode($response);
        }

        $this->response->addHeader('Content-Type: application/json');
        $this->response->setOutput($json);
    }
}
this is the error:
Code:
SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data

OK

<b>Notice</b>: Undefined variable: json in <b>/home/brei2arens/public_html/beheer/controller/sale/order.php</b> on line <b>2229</b>
This line is 2229: $this->response->setOutput($json);
It are only OpenCart shops on that server, but most account I placed back to my old servers because of that error.
It is not possible to change order status
 

k2tec

Well-Known Member
Aug 26, 2011
104
5
68
Netherlands
cPanel Access Level
Root Administrator
On my 2 test domains I placed the public_html and the SQL from the domain with the error. On both domains it runs OK.
I can change my order status.
Then I removed the account domain with the error, created a new account placed back the public_html and SQL for that domain and the error is back again.
I can't see where that error is coming from. I compared the files on the test account with files site with errors no difference.
The only difference is .nl and .eu nl is dnssec and the .eu not.
 

k2tec

Well-Known Member
Aug 26, 2011
104
5
68
Netherlands
cPanel Access Level
Root Administrator
Okay in firebug I see this in the error page

Code:
Accept:text/html, */*; q=0.01
Accept-Encoding:gzip, deflate, br
Accept-Language:en-US,nl;q=0.7,en;q=0.3
Authorization:Basic Ym91Y2xlOnN0b2xsJTU2WXA=
Connection:keep-alive
Content-Length:0
and in the site without errors:

Code:
Accept:text/html, */*; q=0.01
Accept-Encoding:gzip, deflate, br
Accept-Language:en-US,nl;q=0.7,en;q=0.3
Connection:keep-alive
Content-Length:0
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,884
2,254
463
Hello,

Feel free to open a support ticket using the link in my signature if you'd like us to take a closer look. You can post the ticket number here and we will update this thread with the outcome.

Thank you.
 

k2tec

Well-Known Member
Aug 26, 2011
104
5
68
Netherlands
cPanel Access Level
Root Administrator
There was a AAAA in the DNS settings.

It looks like this behavior was being caused by browsers defaulting to the AAAA record for the domain, instead of the A record, and the the account having no IPv6 address assigned to it within WHM/cPanel.

After I assigned the IPv6 address to the account both the base URL respond normally.

cPanel thanks for your support. Now I am not afraid to update to EA4 and can help my customers.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,884
2,254
463
Hello,

I'm happy to see the issue is now resolved. Thank you for updating us with the outcome.