Mercurial+Apache on CentOS 6.4 - mercurial

Trying to configure apache/mercurial but running into the following error..
[Tue Aug 27 22:51:21 2013] [error] [client xxx.xxx.xxx.xxx] mod_wsgi (pid=32758): Target WSGI script '/var/www/vhosts/hg.xxxxx.net/cgi-bin/hgweb.wsgi' cannot be loaded as Python module.
[Tue Aug 27 22:51:21 2013] [error] [client xxx.xxx.xxx.xxx] mod_wsgi (pid=32758): Exception occurred processing WSGI script '/var/www/vhosts/hg.xxxxx.net/cgi-bin/hgweb.wsgi'.
replacing hgweb.wsgi with a hello world test script works as expected. All software is from CentOS repos.
Here is the traceback from error.log
[Tue Aug 27 22:57:59 2013] [error] Traceback (most recent call last):
[Tue Aug 27 22:57:59 2013] [error] File "/var/www/vhosts/hg.xxxxx.net/cgi-bin/hgweb.wsgi", line 14, in <module>
[Tue Aug 27 22:57:59 2013] [error] from mercurial import demandimport; demandimport.enable()
[Tue Aug 27 22:57:59 2013] [error] ImportError: No module named mercurial

The traceback is indicating that you do not have mercurial, (for python), installed on the server, you need the python bindings installed before your scripts can use it.
If you don't have admin rights then you will have to contact your administrator but otherwise you could try, on the server running:
sudo pip install mercurial
Update
There is an interesting blog post here on setting up mercurial on centos that suggests that you need to install and build the python mercurial bindings from source.

Related

Django problems with apache2 mod_wsgi, _sql import error

I'm struggling to run an apache2 server for django. I wanted to try gunicorn, but as I expect apache to be installed in in workplaces more frequently, so I'll stick to it.
Problem currently lies (I think) in an Import Error visible in the excerpt from apache error.log. I've tried quite a lot of possible configs, and before it didn't even import django. I'm using virtual env. The developer server from django works just fine both for the app and database.
1 [Sun Apr 02 20:58:52.082706 2017] [wsgi:warn] [pid 13495] mod_wsgi: Compiled for Python/3.4.2rc1+.
2 [Sun Apr 02 20:58:52.082907 2017] [wsgi:warn] [pid 13495] mod_wsgi: Runtime using Python/3.4.2.
3 [Sun Apr 02 20:58:52.104626 2017] [mpm_prefork:notice] [pid 13495] AH00163: Apache/2.4.10 (Raspbian) mod_wsgi/4.3.0 Python/3.4.2 configu red -- resuming normal operations
4 [Sun Apr 02 20:58:52.104798 2017] [core:notice] [pid 13495] AH00094: Command line: '/usr/sbin/apache2'
5 [Sun Apr 02 21:00:18.727276 2017] [wsgi:error] [pid 13499] [remote 192.168.1.106:0] mod_wsgi (pid=13499): Target WSGI script '/home/pi/d jangoProjects/pidjay/pidjay/wsgi.py' cannot be loaded as Python module.
6 [Sun Apr 02 21:00:18.727660 2017] [wsgi:error] [pid 13499] [remote 192.168.1.106:0] mod_wsgi (pid=13499): Exception occurred processing WSGI script '/home/pi/djangoProjects/pidjay/pidjay/wsgi.py'.
7 [Sun Apr 02 21:00:18.727938 2017] [wsgi:error] [pid 13499] [remote 192.168.1.106:0] Traceback (most recent call last):
8 [Sun Apr 02 21:00:18.729807 2017] [wsgi:error] [pid 13499] [remote 192.168.1.106:0] File "/home/pi/djangoProjects/pidjay/venv/lib/pyth on3.5/site-packages/django/db/backends/mysql/base.py", line 25, in <module>
9 [Sun Apr 02 21:00:18.729866 2017] [wsgi:error] [pid 13499] [remote 192.168.1.106:0] import MySQLdb as Database
10 [Sun Apr 02 21:00:18.730794 2017] [wsgi:error] [pid 13499] [remote 192.168.1.106:0] File "/home/pi/djangoProjects/pidjay/venv/lib/pyth on3.5/site-packages/MySQLdb/__init__.py", line 19, in <module>
11 [Sun Apr 02 21:00:18.730848 2017] [wsgi:error] [pid 13499] [remote 192.168.1.106:0] import _mysql
12 [Sun Apr 02 21:00:18.731024 2017] [wsgi:error] [pid 13499] [remote 192.168.1.106:0] ImportError: No module named '_mysql'
Now the config from sites-available folder:
<Directory /home/pi/djangoProjects/pidjay/pidjay>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIDaemonProcess pidjay python-path=/home/pi/djangoProjects/pidjay:/home/pi/djangoProjects/pidjay/venv/lib/python3.5/site-packages
WSGIProcessGroup pidjay
WSGIScriptAlias / /home/pi/djangoProjects/pidjay/pidjay/wsgi.py
As You can see I specified the virtual env folder with a colon, other ways resulted in django being impossible to import. The python in the environment is ver 3.5 (checked twice), with sqlclient and django installed. When I try to import "_mysql" in python interpreter inside venv (activated) it works just fine.
This is databases setting from project's settings.py:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': "pidjay",
"USER": "user",
"PASSWORD": "password"
}}
And as I said it works on development server. Please help me with this and great thank You in advance! I will be happy to provide any additional info!
As pointed out above, this is one way to do it.
wget https://github.com/GrahamDumpleton/mod_wsgi/archive/4.5.14.tar.gz
tar -zxvf 4.5.14.tar.gz
cd mod_wsgi-4.5.14
./configure --with-python=/usr/bin/python3.5
make
make install
chmod 755 /usr/lib64/httpd/modules/mod_wsgi.so
The problem lied in version mismatch as Graham kindly pointed out. After compiling mod_wsgi for python 3.5 with with the help of official docs and loading it into apache it worked as expected.

Wamp server on windows 10 Icon Red and I can't left or right click on it either

OK: Not only is my WAMP Icon Red but I can't get anything to appear if I right or left click on it. Hovering over the icon I get "None of 2 services running - server off line".
I have
Installed VC C++ Redist from 2008 - 2015.
Uninstalled Skype.
Disabled World Wide Web Publishing Services.
Made sure my Host file had "127.0.0.1 localhost" and "::1 localhost" enabled.
Installed 32bit version of WAMP.
I would given changing the listening Ports a crack but not being able to click on the WAMP icon I wasn't confident enough to change the files in the folders (Eg. Found multiple copies of httpd.conf). Would have thought steps 2 and 3 would have made this unnecessary anyway.
If in Services, I manually start wampapache and wampmysql I can access localhost/phpmyadmin and localhost/domainfolder, set up databases, install wordpress, etc. Clearly something is going wrong and I'm sure it's destined to give me furthur grief. Any Ideas? I have included my error logs and a screen shot below with my system info.
"Apache_error_log"
[Thu May 05 13:17:27.453022 2016] [auth_digest:notice] [pid 8056:tid 120] AH01757: generating secret for digest authentication ...
[Thu May 05 13:17:27.484243 2016] [mpm_winnt:notice] [pid 8056:tid 120] AH00455: Apache/2.4.17 (Win32) PHP/5.6.15 configured -- resuming normal operations
[Thu May 05 13:17:27.484243 2016] [mpm_winnt:notice] [pid 8056:tid 120] AH00456: Apache Lounge VC14 Server built: Oct 11 2015 16:06:02
[Thu May 05 13:17:27.484243 2016] [core:notice] [pid 8056:tid 120] AH00094: Command line: 'C:\wamp\bin\apache\apache2.4.17\bin\httpd.exe -d C:/wamp/bin/apache/apache2.4.17'
[Thu May 05 13:17:27.484243 2016] [mpm_winnt:notice] [pid 8056:tid 120] AH00418: Parent: Created child process 6692
[Thu May 05 13:17:27.874894 2016] [auth_digest:notice] [pid 6692:tid 428] AH01757: generating secret for digest authentication ...
[Thu May 05 13:17:27.890536 2016] [mpm_winnt:notice] [pid 6692:tid 428] AH00354: Child: Starting 64 worker threads.
[Thu May 05 14:14:30.816395 2016] [authz_core:error] [pid 6692:tid 1100] [client 192.168.0.166:2569] AH01630: client denied by server configuration: C:/wamp/www/
[Thu May 05 14:30:49.331784 2016] [mpm_winnt:notice] [pid 8056:tid 120] AH00422: Parent: Received shutdown signal -- Shutting down the server.
[Thu May 05 14:30:51.363140 2016] [mpm_winnt:notice] [pid 6692:tid 428] AH00364: Child: All worker threads have exited.
[Thu May 05 14:30:53.144329 2016] [mpm_winnt:notice] [pid 8056:tid 120] AH00430: Parent: Child process 6692 exited successfully.
[Thu May 05 15:01:43.930134 2016] [auth_digest:notice] [pid 7168:tid 592] AH01757: generating secret for digest authentication ...
[Thu May 05 15:01:44.273944 2016] [mpm_winnt:notice] [pid 7168:tid 592] AH00455: Apache/2.4.17 (Win32) PHP/5.6.15 configured -- resuming normal operations
[Thu May 05 15:01:44.273944 2016] [mpm_winnt:notice] [pid 7168:tid 592] AH00456: Apache Lounge VC14 Server built: Oct 11 2015 16:06:02
[Thu May 05 15:01:44.273944 2016] [core:notice] [pid 7168:tid 592] AH00094: Command line: 'C:\wamp\bin\apache\apache2.4.17\bin\httpd.exe -d C:/wamp/bin/apache/apache2.4.17'
[Thu May 05 15:01:44.273944 2016] [mpm_winnt:notice] [pid 7168:tid 592] AH00418: Parent: Created child process 628
[Thu May 05 15:01:44.711410 2016] [auth_digest:notice] [pid 628:tid 492] AH01757: generating secret for digest authentication ...
[Thu May 05 15:01:44.805095 2016] [mpm_winnt:notice] [pid 628:tid 492] AH00354: Child: Starting 64 worker threads.
"Last 10 lines of PHP_error_log"
[05-May-2016 05:14:53 UTC] PHP Warning: fopen(C:/wamp/bin/apache/apache2.4.17/conf/httpd.conf): failed to open stream: Permission denied in C:\wamp\scripts\wampserver.lib.php on line 307
[05-May-2016 05:14:53 UTC] PHP Warning: fwrite() expects parameter 1 to be resource, boolean given in C:\wamp\scripts\wampserver.lib.php on line 308
[05-May-2016 05:14:53 UTC] PHP Warning: fclose() expects parameter 1 to be resource, boolean given in C:\wamp\scripts\wampserver.lib.php on line 309
[05-May-2016 05:14:54 UTC] PHP Warning: fopen(../wampmanager.ini): failed to open stream: Permission denied in C:\wamp\scripts\refresh.php on line 1205 [05-May-2016 05:14:54 UTC] PHP Warning: fwrite() expects parameter 1 to be resource, boolean given in C:\wamp\scripts\refresh.php on line 1206
[05-May-2016 05:14:54 UTC] PHP Warning: fclose() expects parameter 1 to be resource, boolean given in C:\wamp\scripts\refresh.php on line 1207 [05-May-2016 05:14:54 UTC] PHP Warning: unlink(C:/wamp/bin/apache/apache2.4.17/bin/icudt54.dll): Permission denied in C:\wamp\scripts\wampserver.lib.php on line 78
[05-May-2016 05:14:54 UTC] PHP Warning: symlink(): Cannot create symlink, error code(1314) in C:\wamp\scripts\wampserver.lib.php on line 81 [05-May-2016 05:14:54 UTC] PHP Warning: unlink(C:/wamp/bin/apache/apache2.4.17/bin/icuin54.dll): Permission denied in C:\wamp\scripts\wampserver.lib.php on line 78
[05-May-2016 05:14:54 UTC] PHP Warning: symlink(): Cannot create symlink, error code(1314) in C:\wamp\scripts\wampserver.lib.php on line 81 [05-May-2016 05:14:54 UTC] PHP Warning: unlink(C:/wamp/bin/apache/apache2.4.17/bin/icuio54.dll): Permission denied in C:\wamp\scripts\wampserver.lib.php on line 78
[05-May-2016 05:14:54 UTC] PHP Warning: symlink(): Cannot create symlink, error code(1314) in C:\wamp\scripts\wampserver.lib.php on line 81 [05-May-2016 05:14:54 UTC] PHP Warning: unlink(C:/wamp/bin/apache/apache2.4.17/bin/icule54.dll): Permission denied in C:\wamp\scripts\wampserver.lib.php on line 78
System Info
Did you install WAMPServer 3 as an Administrator, using the "Run as Administrator" as instructed in the install instructions.
The installer must be run "as an administrator"
If you did not, uninstall WAMPServer and then reinstall it doing this:
Right click on the installer .exe and select "Run as Administrator"
did you have any missing DLLs while installing wampserver?
I had the same problem and the solution was
close the wampserver tray (from task manager)
go Here and download the Visual C++ Redistributable for Visual Studio and install it.
now open Wamp as administrator
the problem should be gone by now (at least that was the solution for me)

shows blank page after deploying a grails war file on openshift

i deployed a war file to openshift after creating a tomcat 7(JBoss EWS 2.0) app using the following guide lines (deploy war file using git)
but after deploying my app it only shows a blank page. here are the logs i got by using the rhc tail command.
==> app-root/logs/jbossews.log <==
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoa
der.java:1571)
at net.sf.ehcache.util.concurrent.ConcurrentHashMap$ValuesView.iterator(
ConcurrentHashMap.java:3252)
at net.sf.ehcache.statistics.extended.ExtendedStatisticsImpl$1.run(Exten
dedStatisticsImpl.java:104)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:47
1)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.
access$301(ScheduledThreadPoolExecutor.java:178)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.
run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.
java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:615)
at java.lang.Thread.run(Thread.java:745)
==> app-root/logs/mysql.log <==
160420 10:20:46 InnoDB: highest supported file format is Barracuda.
160420 10:20:46 InnoDB: Waiting for the background threads to start
160420 10:20:47 InnoDB: 5.5.45 started; log sequence number 1595675
160420 10:20:47 [Note] Server hostname (bind-address): '127.9.179.2'; port: 3306
160420 10:20:47 [Note] - '127.9.179.2' resolves to '127.9.179.2';
160420 10:20:47 [Note] Server socket created on IP: '127.9.179.2'.
160420 10:20:47 [Warning] 'proxies_priv' entry '# root#ex-std-node563.prod.rhclo
ud.com' ignored in --skip-name-resolve mode.
160420 10:20:47 [Note] Event Scheduler: Loaded 0 events
160420 10:20:47 [Note] /opt/rh/mysql55/root/usr/libexec/mysqld: ready for connec
tions.
Version: '5.5.45' socket: '/var/lib/openshift/571649900c1e669c5c00017c/mysql//s
ocket/mysql.sock' port: 3306 MySQL Community Server (GPL)
==> app-root/logs/phpmyadmin.log <==
[Tue Apr 19 11:24:41 2016] [notice] Apache/2.2.15 (Unix) PHP/5.3.3 configured --
resuming normal operations
[Tue Apr 19 12:27:32 2016] [notice] SIGHUP received. Attempting to restart
[Tue Apr 19 12:27:32 2016] [notice] Digest: generating secret for digest authent
ication ...
[Tue Apr 19 12:27:32 2016] [notice] Digest: done
[Tue Apr 19 12:27:32 2016] [notice] Apache/2.2.15 (Unix) PHP/5.3.3 configured --
resuming normal operations
[Wed Apr 20 10:20:38 2016] [notice] caught SIGWINCH, shutting down gracefully
[Wed Apr 20 10:21:05 2016] [notice] SELinux policy enabled; httpd running as con
text unconfined_u:system_r:openshift_t:s0:c4,c884
[Wed Apr 20 10:21:05 2016] [notice] Digest: generating secret for digest authent
ication ...
[Wed Apr 20 10:21:05 2016] [notice] Digest: done
[Wed Apr 20 10:21:05 2016] [notice] Apache/2.2.15 (Unix) PHP/5.3.3 configured --
resuming normal operations
the name of the war file i deployed is ROOT.war using git push and it deployed successfully.i am using mysql database and phpmyadmin cartridges.
i just want to figure out why it is showing me a blank page when i try to access the url of my application.
thanks in advance.
The log you provided is not helpfull at all, because it's not full, I even can't see what exception was thrown.
This is the best article about deploying grails application on OpenShift, it will help you a lot:
Grails on Openshift
Also the troubleshoutting will be more productive if you use ftp to see what's going on on your server
Using FileZilla and SFTP on Windows with OpenShift
i have fixed the problem with the help i got from #Taras Kohut. i added the following lines to my BuildConfig.groovy file.
grails.project.war.exploded.dir = "/yourLocalPathToClonedOpenshiftFile/webapps/ROOT"
grails.war.exploded=true
the above lines will generate an exploded war file in your openshift app in the webapps folder.
next i added ROOT.war.deploy file again in the webapps directory.This is a file which instructs jboss that after the push it must take the ROOT folder and deploy it on Tomcat (which is emulated by JBoss) as if it was a war file.
after that i committed and pushed my changes and the app is deployed successfully and everything works fine.

MySQL gem only accessable from ruby command line, not apache localhost

Heads up, ruby n00b testing the waters -
OS - OSX 10.7
test.rb in /Library/WebServer/CGI-Executables:
#!/usr/bin/ruby
require 'mysql'
con = Mysql.new('localhost', 'root', 'root', 'rubytest')
rs = con.query('select * from people')
rs.each_hash { |h| puts h['name']}
con.close
When running from the command line ruby test.rb, I get the fields within just fine. When hitting test.rb from localhost (http://localhost/cgi-bin/test.rb), I get a 500 and a nag in the error log about mysql being missing-
Apache error log:
[Fri Aug 31 23:47:22 2012] [error] [client 127.0.0.1] /Library/WebServer/CGI-Executables/test.rb:3:in `require': no such file to load -- mysql (LoadError)
[Fri Aug 31 23:47:22 2012] [error] [client 127.0.0.1] \tfrom /Library/WebServer/CGI-Executables/test.rb:3
[Fri Aug 31 23:47:22 2012] [error] [client 127.0.0.1] Premature end of script headers: test.rb
My export paths in ~/.bashrc:
export DYLD_LIBRARY_PATH="/usr/local/mysql/lib"
export PATH="$PATH:/usr/local/mysql/bin"
export PS1="$ "
If this is any help, running gem env | grep 'RUBY EXECUTABLE'
RUBY EXECUTABLE: /Users/robertcox/.rvm/rubies/ruby-1.9.2-p318/bin/ruby
Any help appreciated
Maybe you need update gem install mysql2

Modify DYLD_LIBRARY_PATH for Apache? Perl CGI script not working when connecting to MySQL

I have a Perl CGI script that works fine when I run it from the command line with ./roster_return.cgi StudentID=101095 but when I run it in MAMP (http://localhost:8888/cgi-bin/roster_return.cgi?StudentID=101095), I get the following error in my apache log:
[Wed May 02 10:56:47 2012] [error] [client 127.0.0.1] install_driver(mysql) failed: Can't load '/Library/Perl/5.10.0/darwin-thread-multi-2level/auto/DBD/mysql/mysql.bundle' for module DBD::mysql: dlopen(/Library/Perl/5.10.0/darwin-thread-multi-2level/auto/DBD/mysql/mysql.bundle, 1): Library not loaded: libmysqlclient.18.dylib
[Wed May 02 10:56:47 2012] [error] [client 127.0.0.1] Referenced from: /Library/Perl/5.10.0/darwin-thread-multi-2level/auto/DBD/mysql/mysql.bundle
[Wed May 02 10:56:47 2012] [error] [client 127.0.0.1] Reason: image not found at /System/Library/Perl/5.10.0/darwin-thread-multi-2level/DynaLoader.pm line 207.
[Wed May 02 10:56:47 2012] [error] [client 127.0.0.1] at (eval 11) line 3
[Wed May 02 10:56:47 2012] [error] [client 127.0.0.1] Compilation failed in require at (eval 11) line 3.
[Wed May 02 10:56:47 2012] [error] [client 127.0.0.1] Perhaps a required shared library or dll isn't installed where expected
[Wed May 02 10:56:47 2012] [error] [client 127.0.0.1] at /Users/jerickson/Desktop/helpfulscripts/cgi-bin/roster_return.cgi line 16
[Wed May 02 10:56:47 2012] [error] [client 127.0.0.1] Premature end of script headers: roster_return.cgi
I now remember that a few years ago I had to add this line to my .bash_profile:
export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:/usr/local/mysql/lib/"
in order to get the command line perl scripts to work. This would explain why the library is not loading from MAMP, since it is not using my .bash_profile paths. How would I add this location for the MAMP server's path??
Any advice or help would be greatly appreciated. Thank you!
You could try Apache's mod_env in your VirtualHost config:
SetEnv DYLD_LIBRARY_PATH path/to/libs
You can also add the line to the apachectl script:
export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:/path/to/libs"
It's usually in the bin directory of Apache. I needed to load pdo_informix for a project and that's the only place that got it working.