-
-
Notifications
You must be signed in to change notification settings - Fork 579
[DRAFT] Problem Getting Assets (CSS JS) cURL
Hosting on a Apache Web server on my local lan behind a nat gateway, which was the cause of my installation failing to obtain the css/js (details of why this happened in earlier posts), hence displaying primarily a text version of the site.
The main change I added to remedy the problems I had with the install, were to add the two CURLOPT_RESOLVE statements below, to allow pH7cms scripting to locate the css/js externally from the installation. The reference in the CURLOPT_RESOLVE statements are specific to my configuration being my domain name (mylovewaits.com.au) and the literal address of the Apache web server address (192.168.0.112) on my lan. As most installers would be aware the port number (80) for the http installation is the other element in the CURLOPT_RESOLVE statements. If the installation was to be on a secure https server the CURLOPT_RESOLVE statements would require the port number to be 443, however I have not tested such an install at the time of this posting. The modification as to the enable.static.gzip_compress setting is most likely specific to my server configuration and I've not yet sought, at the time of this posting, a solution as to why my compression is not functioning correctly. It would be preferable to resolve the compression issue (compression enabled means faster loading for the user), rather then simply disabling the compression as I have done.
My Apache web server installation is running under Fedora 22 (64 bit), with the document root operating numerous virtual hosts, each in a respective path. I initially suspected the virtual host configuration may be playing a part in the failure to load the css/js, but later found the virtual hosting was not causing any issues for my installation. Hope this information may assist others, who attempt a similar installation. Change directory to the root directory of the install: cd /usr/local/apache2/htdocs/mylovewaits.com.au Disable the compression nano -S -w ./_install/data/configs/config.ini Alt-G --> Goto line 104 enable.static.gzip_compress = 1 --> enable.static.gzip_compress = 0 Enable the cURL name resolution for the pH7CMS scripting "nano -S -w _protected/framework/File/File.class.php" Alt-G --> Goto line 759 and modify the function adding the CURLOPT_RESOLVE lines: (Note: the CURLOPT_RESOLVE lines will need to reflect the domain name of the installation and the literal address of the Apache web server on the lan)
In _protected/framework/File/File.class.php
public function getUrlContents($sUrl)
{
$rCh = curl_init();
curl_setopt($rCh, CURLOPT_URL, $sUrl);
curl_setopt($rCh, CURLOPT_HEADER, 0);
curl_setopt($rCh, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($rCh, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($rCh, CURLOPT_RESOLVE, ["www.mylovewaits.com.au:80:192.168.0.112"]);
curl_setopt($rCh, CURLOPT_RESOLVE, ["mylovewaits.com.au:80:192.168.0.112"]);
$mRes = curl_exec($rCh);
curl_close($rCh);
unset($rCh);
return $mRes;
}