WeasyPrint unable to load images/css: Temporary failure in name resolution - weasyprint

I'm using WeasyPrint 52.3 (latest version available at time of writing) along with Django 2.2 LTS on Python 3.6 on a Windows 10 development machine; all is working fine.
However when I try to render a PDF on my Linux machine (same WeasyPrint/Django/Python versions), all items I try to load from an URI are not shown, including images and CSS. When not using WeasyPrint, images/CSS are properly loaded. My images/CSS are available at https://myhost.tld/some.css and myhost has its certs signed.
When using inline CSS, the CSS is rendered fine.
I've tried to enable WeasyPrint logging through:
import logging
logger = logging.getLogger('weasyprint')
logger.addHandler(logging.FileHandler('/tmp/weasyprint.log'))
and I see following output:
Failed to load stylesheet at https://myhost.tld/assets/css/pdf.css : URLError: <urlopen error [Errno -3] Temporary failure in name resolution>
How can this be? My DNS system is properly set up for myhost.tld.

Ensure myhost.tld is part of the /etc/hosts file:
127.0.0.1 localhost
127.0.1.1 myhost
127.0.2.1 myhost.tld
Restart the right services and the files will load.

Related

DNS not resolved after reconfigure dns properly unless restart my script on centos

I have a python script which use rest-api to communicate with my server.
I am using python-requests to handle rest-api.
The script has a loop and try-except for handling errors to keep it running.
On centos, I accidentally mis-configured the dns and started my script.
Here is the error:
HTTPConnectionPool(host='host.com', port=80): Max retries exceeded with url: //rest/url (Caused by NewConnectionError(': Failed to establish a new connection: [Errno -2] Name or service not known',))
Then I reconfigured the dns properly without restarting the script, but the script still didn't work unless restart it. Same error.
Programs started after dns reconfiguration like ping, web browsers were working fine.
Same problem happens for ping if it is started before dns reconfiguration, but not for firefox.
It seems that firefox took a while to adapt new dns configuration.
On debian, this problem does't exist.
When I reconfigured the dns properly, the script or other programs started to work almost immediately.
Is there anything special with dns on centos?
Can my script adapt new dns configuration without restarting?
==========================
python-requests version I tested:
2.11.1, 2.12.4, 2.13.0 On centos
2.11.1, 2.12.4 on debian
centos version tested:
6.2, 7.3-1611
debian version tested:
debian-sid latest update
python version:
2.7.13rc1 on debian
2.7.5 on centos 7.3-1611
2.6.6 on centos 6.2
problem solved by calling __res_init in glibc.
More details see Python not getting IP if cable connected after script has started and http://bugs.sugarlabs.org/attachment/ticket/1940/network.py.patch

phpmyadmin.conf default file

First of all, I'm pretty new to this all...
I am using Amazon web services and I have installed LAMP on Amazon linux using this.
When installing phpmyadmin, I was trying to grant access to all IP addresses (i know, not a good idea), so I tried adding Require all granted under # Apache 2.4 in phpmyadmin.conf file, I was using Mac's terminal, and I messed up the file while trying to learn how to add it, so now that I found how to add it, it is not working anymore... this the error I get:
Stopping httpd: [FAILED]
Starting httpd: AH00526: Syntax error on line 1 of /etc/httpd/conf.d/phpMyAdmin.conf:
Invalid command '# phpMyAdmin - Web based MySQL browser written in php', perhaps misspelled or defined by a module not included in the server configuration
[FAILED]
Is there anyway that I can just replace the phpMyAdmin.conf file to default and start editing it over?
or do I have to unistall and re install phpmyadmin all over again?
Thanks

Selenium testing setup on remote server

I'm trying to install and run Selenium on a remote server to run web tests for a Drupal 7 install. I need to find a way for the browsers installed on the server to output their display onto the computer that is connected to the server, and I need to figure out why Selenium is failing to run. Error messages down below.
My server set up:
centOS 7.1 on Linux running NGinX web server
X11Forwarding available and enabled
Drupal 7 install
Selenium 7.x-3.0 Drupal Module
Selenium Standalone Server 2.46.0
Firefox 38.1.0 installed
Google Chrome stable 43.0.2357.132
Chromedriver 2.16 for 64-bit Linux, set to executable, with symlink to driver in /usr/bin and /usr/local/bin (the local is the only necessary one, the usr/bin is just a fallback)
Note: my solution must have the server hosting the selenium server as the website will be delivered to a client when it's ready for production. It won't work for me to just install the selenium server and browsers on my own machine.
My issues:
When I ssh -X user#server, it doesn't seem to matter what I set the DISPLAY to, firefox can't open the display when I run 'firefox &' [e1]. I've tried export DISPLAY=localhost:0.0, localhost:10.0 and [myIP]:0.0/10.0.
When I run the selenium server and attempt to run the sample test cases on my website, the Firefox instance of the test fails to connect through 127.0.0.1 port 7055 [e2] and the Chrome instance is either unable to find the driver or shuts down unexpectedly [e3]
Errors:
e1 - Error: cannot open display: host:#.# <== (Whatever variant I've attempted)
e2 - Message: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output: (blank)
e3 - Message: chrome not reachable
SimpleTest isn't a suitable replacement as the things I'm trying to test require too much custom setup to configure a stock Drupal sandbox properly. Consequently, I'm relying on Selenium's option to test on the original site instead of a sandbox.

PHP GD Extension is not loaded on IIS 7.5

PHP GD Extension is loaded and working on local server but it is not loaded correctly on our live server even though I am using all the exact same files.
(PHP GD is working fine here)
Local Server: Microsoft Windows Server 2003 For Small Business Server SP2
IIS Version: 6
Then I copied the whole "C:\PHP" folder from local server to "C:\Program Files (x86)\" on live server. That "PHP" folder does include ext folder and "php_gd2.dll" file inside it. I changed the path from "C:\PHP" to "C:\Program Files (x86)\" in "php.ini" too. However, PHP is not loaded on live server.
PHPINFO Local:http://jsfiddle.net/hFKfx/
PHPINFO Live: http://jsfiddle.net/h77Hy/
I am not very good with PHP. Please help.
In Win2K3 / IIS6, you're running PHP as a ISAPI module (thread-safe).
In Win 7 / IIS7.5, you're running PHP as a FCGI module (non-thread-safe).
This is likely your problem. You can't mix and match thread-safe (TS) / non-thread-safe (NTS) extensions with core PHP. If you just copied everything over, you probably have TS extensions. You need to download and use the NTS ones.
(archive link to PHP 5.2.6 NTS)
To verify this assumption, check where php.ini specifies a log for startup errors. If you're logging startup errors, you should see something similar to:
PHP Warning: PHP Startup: gd Extension: Unable to initialize module
Module compiled with build ID=API20041225,TS,VC6
PHP compiled with build ID=API20041225,NTS,VC6
These options need to match
(note "TS" vs "NTS")
Hope that helps. If not, maybe you'll find something else in the log that indicates what the problem is.

Can't find mod_authz_svn.so while restarting apache2

I tried to install and setup a svn server using apache2,
I followed instructions on internet but while i tried to restart apache2 it shows the following error:
apache2: Syntax error on line 204 of /etc/apache2/apache2.conf: Syntax error on line 1 of /etc/apache2/mods-enabled/authz_svn.load: Cannot load /usr/lib/apache2/modules/mod_authz_svn.so into server: libsvn_repos-1.so.0: cannot open shared object file: No such file or directory
Action 'configtest' failed.
i checked the path but the file do exist,im not sure what is happening.
need some help thanks~
Based on your pathes, it looks like you are playing debian or ubuntu config. if I remember well, this module *mod_authz_svn.so* is available with libapache2-svn, so you need first to apt-get this module as root, and then to enable it (being in the directory /etc/apache2, *a2enmod my_module*) and reload your apache config (or restart apache).
The other way around is to load the module as a DSO. Then it's a different process.

Resources