Loading ImageMagick from Apache (XAMPP) - apache

I wrote an image manipulating program with PHP/imagick. The server is installed under XAMPP, which resides in a flash drive.
Now everything works fine except that ImageMagick needs to be installed on every machine I use.
To solve the problem and make it easier, I copied the ImageMagick folder to the flash drive, removed ImageMagick from Windows Environment Variables, and modified Apache config (tried both httpd.conf and extra/httpd-xampp.conf).
httpd.conf
SetEnv MAGICK_HOME "/xmapp/ImageMagick"
extra/httpd-xampp.conf
<IfModule env_module> <----- enabled
SetEnv MIBDIRs "xampp/php/extras/mibs"
SetEnv MAGICK_HOME "/xampp/ImageMagick" <-----
SetEnv MySQL_HOME "/xmapp/mysql/bin"
However, when I started Apache, I got a error message saying "Cannot find CORE_RL_wand_.dll". I'm pretty sure the path is correct and no files are missing. It seems that Apache just can't load ImageMagick.
Here are the versions I'm using:
XAMPP 1.8.2 (Apache 2.4.4 / PHP 5.4.19)
ImageMagick-6.8.7-1-Q16-x86-dll
php_imagick_ts.dll for PHP 5.4 (from Mikko)
Does anyone have any experience with portable ImageMagick/XAMPP?
Is this the correct way to load ImageMagick from Apache?

Try to add to the system path the Imagick's path. Maybe you also have to add as environment variable the MAGICK_HOME. That solved my problem.

Related

Apache 2.2/Redhat 2.6 with mod_wsgi

I'm having trouble configuring mod_wsgi with my current set up.
Redhat 2.6.32
Installations setup as non-root user:
Apache 2.2 (attempted to get 2.4, but without access to yum the
dependencies were too much)
Python 3.6
I seem to have successfully installed mod_wsgi into /apache/modules.
Problems:
The apache directory structure is not what most tutorials indicate, its
DocumentRoot is in /apache/htdocs, not /var/www/ or /sites-enabled/ or /sites/available/
I tried putting:LoadModule wsgi_module modules/mod_wsgi.so in httpd.conf but I am returned:
$HOME/apache/modules/mod_wsgi.so into server: libpython3.6m.so.1.0: cannot open shared object file: No such file or directory
Can anyone explain how I can use mod_wsgi with my current setup?
The problem is likely because you self compiled mod_wsgi and the Python installation you used is in a non standard location. In this case you need to se LD_RUN_PATH environment variable when running make for mod_wsgi, with it set to the directory the Python library is in. This way knowledge of where the Python library is is embedded in mod_wsgi. This issue is described in the mod_wsgi documentation:
http://modwsgi.readthedocs.io/en/develop/user-guides/installation-issues.html#unable-to-find-python-shared-library
If you can't rebuild mod_wsgi for some reason, you can also force load the Python shared library into Apache by using:
LoadFile /some/path/lib/libpython3.6m.so.1.0
This should be place just before the LoadModule line for mod_wsgi.
Your libpython3.6m.so.1.0 is not in any of apache's library paths.
You can symlink it to one of the lib directories in apache's library path, or you can add the directory where your libpython3.6m.so.1.0 resides to apache's library path.
Check this question out for help with apache paths: https://serverfault.com/questions/151328/setting-apache2-path-environment-variable

Apache returning 404 for requests inside /javascript directory

I have a project with several sub-directories. Everything works just fine, except if I try to access files inside the /root/javascript directory, I get a 404. The files do in fact exist, and I am in fact typing the path correctly. If I simply rename the directory I can then access the files. Rename it back, and I get the 404 again. VHost file works fine. No .htaccess files involved.
Apache version: 2.4.9
OS: Ubuntu 13.10
After much searching and trying different things, here's what the problem came down to:
By default, Apache 2.4 on Ubuntu enables a config file called javascript-common, which redirects any requests to files inside /javascript (that is, a directory at the root of your project called 'javascript') to /usr/share/javascript.
Solution 1
Use the following command to disable the javascript-common configuration file:
a2disconfig javascript-common
Solution 2
Add your JavaScript files inside that /usr/share/javascript directory. That way Apache will actually find those files and no 404 will be returned. One benefit of doing things this way is that you won't need multiple copies of the same files (jquery.js, etc.js) that multiple projects use...
Solution 3
Delete the directory /usr/share/javascript, and create a symbolic link that points to your project's /javascript directory. Keep in mind that if you have more than one project (vhost file), they will all serve from the same JavaScript file from the original project. In other words, this is probably not the best solution...
The a2disconfig solution didn't work for me, but then through some searching, I realized that the javascript-common is something that can be uninstalled.
So I fixed the problem by removing javascript-common:
sudo apt-get remove javascript-common
I'm not sure the point of this package, or why it would be installed automatically, but I'm glad that my javascript files are loading again!
I am running Ubuntu 14.04.1 LTS with the lamp-server bundle
Encountering the same problem, I found a similar answer resolved it.
sudo a2disconf javascript-common
sudo service apache2 restart
After the a2disconf (and note it is apparently now a2disconf and not a2disconfig)
I did get a message to execute "sudo service apache2 reload"
the reload did not resolve the issue... thus the restart
as an aside -- I cannot imagine what the developers were thinking when they loaded this little gem -- some of my javascript files might be viable across domains... but certainly not all !
You could just override /javascript alias in your .conf to reflect what you want:
Alias /javascript /my_custom_dir

Failed loading opcache.so: opcache.so: cannot open shared object file

Ive got an issues with Opcache on my apache2 logs file
The error is : Failed loading opcache.so: opcache.so: cannot open shared object file
Do you have any ideas ?
I'm running on Debian squeeze php 5.4 with Opcache
Thanks
OPcache is a Zend extension not a PHP one, and the zend_extension directive takes an absolute path of the opcache.so shareable image and not relative to the _extension_dir_.
As OPcache isn't bundled with PHP5.4, I assume that you've build OPcache with the PECL package, but however you've build it, you must use its absolute path for then Zend extension loader to find it.
My environment was Windows 10x64 / WSL Ubuntu 20.04LTS / PHP 8.1
I tried to install Laravel
I did symbolic link for php8.1 instead of 8.2 because of Laravel requirements
The problem was in extension_dir path. I just changed it from "./" to /usr/lib/php/20210902
You should find your extension dir path by yourself with
php-config --extension-dir

Php Configuration On Mac - Not rendering

For some reason any php snippet does not render in my browser. I know it gets evaluated because it's not displayed as text either. I did the following:
In httpd.conf I found the load module line for the php5 lib and uncomented it
I renamed the php.ini.default to php.ini in the /etc dir
I restarted apache
That didn't work and there doesn't really seem much else that I can do. Any ideas what could be the problem?
I'm running Mac OS 10.6.8 (Leopard).
**Edit
Also my access_log and error_log for httpd look clean. No sign of errors. Also tried a different browser.
**Second Edit
If I have the file extension as php, the page gets rendered but any embedded php within html does not render.
Sounds like it could be a problem with mod_php. Basically, it sounds like Apache is running .php files using the PHP interpreter, but mod_php might not be configured correctly.
You might want to read this: http://php.net/manual/en/configuration.changes.php

Set PATH for Apache on per-directory basis?

How to set PATH for Apache server on a per-directory basis?
Problem: I have a system in which I can not change the
system installed python in /usr/bin/.
I have a bunch of python cgi scripts that all have
#!/usr/bin/env python
as their first line. I strongly prefer not to change
these scripts for logistical reasons.
But these scripts require a different version of Python
than the system installed one. I have the right version
installed in /opt/python/bin/. So if I could put this
directory at the front of PATH, but only for this particular
cgi directory, it would solve my problem.
That is, if the following would work, it would do what I want.
ScriptAlias /mydir/cgi/ /home/me/devel/cgi/
<Directory /home/me/devel/cgi>
SetEnv PATH /opt/python/bin:/usr/bin:/bin
...other stuff...
</Directory>
But it seems SetEnv does not work on PATH (at least on Apache 2.2).
Is there some other way to changing PATH for just one
particular directory in Apache?
(P.S., I also tried SetEnvIf without any joy.)