Trying to making work russian lang in TeX - php

Ubuntu 12.04.4 LTS
PHP 5.3.10-1ubuntu3.11
MediaWiki 1.16.5
I installed TeX themself and he works, but russian letters in \text{} not working, error: Failed to parse (PNG conversion failed; check for correct installation of latex, dvips, gs, and convert).
If I run command (/home/user/www/site.ru/math/texvc '/home/user/www/site.ru/images/tmp' '/home/user/www/site.ru/images/tmp' '\text{ пример }' 'utf-8' 'transparent') (user is same as in apache) from cmd it works! File in /home/user/www/site.ru/images/tmp exists. And output is cd7d4363323218b64410c10a0a2b46773 пример . Wich proving installation is correct.
When same command executed in MediaWiki, output is similar (cd7d4363323218b64410c10a0a2b46773 пример ), but file doesn't exists. In /home/user/www/site.ru/images/tmp folder appears log missfont.log with this contents:
mktextfm larm1200
mktextfm larm0800
mktextfm larm0600
I'm tried to run this commands but it change nothing. I even tried create test.php and test without CMS. Result is same as in MediaWiki (missfont.log created in temp).
PS In Ubuntu 9.10 russian lang in \text{} worked. I added in texutil.ml russian babel "\usepackage[russian]{babel}\n\usepackage{cancel}\n\pagestyle{empty}\n\begin{document}\n$$\n" and recompile sources. And did some changes in Math.php (with locals). Also I downloaded latest Math extension and replaced math folder. Read more here.

Problem was in system variable HOME. So to fix you need to add in LocalSettings.php line putenv('HOME=/home/user'); (with your user home dir).

Related

Laravel and Mamp Localhost Error 500 Mac

So after a fresh install of laravel (v5.4) and using Mamp as my local server I just get (in chrome)
The localhost page isn’t working
localhost is currently unable to handle this request.
HTTP ERROR 500
I've tried countless things like changing permissions on storage or everything within the laravel directory.
Done composer update/install in the directory.
I'm running PHP v7.0.12 on my Mac (10.11.6). Cant think of anything else that would be causing this?
If I create another directory which a simple index.php with '' it loads absolutely fine so what is causing an issue with laravel?
Here's pics of my mamp setup
http://i.imgur.com/xT3mMZO.png
http://i.imgur.com/ddz9uij.png
Open up terminal and type:
tail -n 20 /Applications/MAMP/logs/php_error.log
This may give you some clue as to what is going on.
Hope this helps, happy coding :)
I just joined stackoverflow yesterday so I do not have enough reputation to comment. I write an answer here.
here is the short answer:
run :
PHP_VERSION=`ls /Applications/MAMP/bin/php/ | sort -n | tail -1`
echo "export PATH=/Applications/MAMP/bin/php/${PHP_VERSION}/bin:$PATH" >> .bash_profile
source ~/.bash_profile
check your php version by running php -v. close the terminal. Open another terminal and check php version again.if you see php 5 again then there are 2 possibilities:
First: you added the /path/to/php7 after /path/to/php5 and php 5 is loaded first.
Second: system loads another bash file first which your php 5 path is mentioned in it. I know that this sounds confusing having several bash file but it is. Please search for other files like bashrc or similars.
This is the long answer for anyone else:
first of all, if you are on mac, I highly suggest you to use valet to get rid of all these things.
But regarding the problem:
As you already noted that it is not a laravel issue. the php version that your machine uses is under the min required version by laravel. You have 2 versions of php at the moment. MacOs is shipped with php installed on that. I think it is the same php 5.5.36 that is making problem for you. Since Laravel 5.4, you need to use PHP >= 5.6.4.
Although you have installed parallel php 7 on your machine, you need also to check which php your machine is reading from by running which php. after that remember to add your path to php 7 installed to bash_profile or other bash files on your mac(you can have 4 or 5 bash files).
Considering you have only one bash file named as bash_profile and you are going to export the path to your php 7 to bash profile, If you run following command, that appends the path to the end of file
PHP_VERSION=`ls /Applications/MAMP/bin/php/ | sort -n | tail -1`
echo "export PATH=/Applications/MAMP/bin/php/${PHP_VERSION}/bin:$PATH" >> .bash_profile
remember to use source ~/.bash_profile in order to make changes effected.
Alternatively you can open the bash_profile file in your text editor by running:
open -a /Applications/TextEdit.app ~/.bash_profile
and add the path manually before the /path/to/php5 path.
finally you must check your php version by running php -v.
close the terminal. Open another terminal and check php version again. If you see php 7 then you are all fine. But if you see php 5 again then there are 2 possibilities:
First: you added the /path/to/php7 after /path/to/php5 and php 5 is loaded first.
Second: system loads another bash file first which your php 5 path is mentioned in it. I know that this sounds confusing having several bash file but it is. Please search for other files like bashrc or similars.

WKHTMLTOPDF works on command line, but returns 0 byte pdf when generating from PHP

I'm using WKHTMLTOPDF to generate PDFs. It's been working fine but we've recently changed server and it's now only giving us back 0 byte files from our PHP admin panel.
Strangely, if I run the below from ssh, it generates just fine. I guess it's perhaps an issue with permissions of www-data but I can't figure it out :(
WKHTMLTOPDF is at /usr/local/bin/wkhmtltopdf and we're using httpd and centos.
If more info is needed I'm happy to try provide it. I can't seem to find any log for wkhtmltopdf either, it doesn't go into the httpd log.
Appreciate the help! Pulling my hair out :p
EDIT: here's the code I'm using to generate the PDF - it has worked on the old server
PDF::setOutputMode('F'); // force to file
PDF::setPageSize('a0');
$gen = PDF::html('pdf.print.web', [
'products' => $catalogue,
'name' => $master->name
], storage_path()."/pdf/gen-".$master->url);
return Response::download(storage_path()."/pdf/gen-".$master->url.'.pdf');
A had a similar issue using wkhtmltopdf CLI (not PHP). It ended up being a permission issue.
When I did:
wkhtmltopdf http://google.com google.pdf
The operation would succeed but generate a 0-byte pdf. No errors thrown.
When I did:
sudo wkhtmltopdf http://google.com google.pdf
The pdf has content. So ensure the relevant user(s) have r/w/e permission to the command itself and to the location where you want to write the file. Also make sure they have permission to make the outbound web request if relevant, and the server is config'd to allow this. You won't actually have to sudo once the permissions are fixed.
Hope this helps.

cygwin: can't execute PHP script via PATH

I have written a PHP script "toalpha" (purpose not relevant to this question). The script is in $HOME/bin. If my CWD is $HOME/bin, I can execute it by typing "./toalpha". But if I simply type "toalpha", I get a message:
Could not open input file: /c/barry/bin/toalpha
Some information that may be relevant:
. I recently upgraded my desktop from WinXP to Win7.
. This is the first time that I have made my own userid be an ordinary user instead of an admin. (I tried to do that on XP, but ran into problems and went back to having my normal userid be the admin. Don't need a solution for that because I'm no longer running XP and besides it was my own fault.)
. My $HOME is /c/barry
I did that by adding the following to the .bashrc created when I installed cygwin:
mount C: /c
HOME=/c/barry
cd
. .bashrc
. The first two lines of the PHP script are:
#!/c/xampp/php/php
<?php
. Yes, the copy of PHP I want to use is in C:\xampp\php\php.exe
. I have another, similar script that I wrote on WinXP. It starts with the same two lines. It worked fine under XP, but doesn't work on Win7.
My best guesses at the source of the problem:
A difference between XP and Win7
I fumbled the home directory change in some way. IIRC, when I installed cygwin on XP I did some trickery so it would start directly in C:\barry but I couldn't remember how I did that when I installed it on Win7, so I took the "easy way out".
bash is passing to "C:\xampp\php\php.exe"
the file name "/c/barry/bin/toalpha"
but that is a cygwin path and your PHP does not regognize it.
You should convert it in an understandable one using
cygpath
Try
/c/xampp/php/php $(cygpath -w /c/barry/bin/toalpha )

moodle - database connection failed when running a script

So I am setting up a moodle plugin that syncs groups defined in child courses into a meta course. I managed to install it based on the following instruction.
Installation
Copy the metagroups folder into your Moodle /local directory and visit
your Admin Notification page to complete the installation.
After installation you may need to synchronize existing meta-course groups, to do this run the cli/sync.php script (use the --help switch for further instructions on script usage).
So when i tried to run th sync.php script using this command in there terminal
php -f sync.php
it shows me an error message
I found that the line in the script that is causing this issue is the following line
require_once(DIR . '/../../../config.php');
my config.php file looks like this:
I have no idea why this is happening, as all moodle functionality seems to be working, which means database connection is the way it should be. Does anyone know this is happening and a way around this. Thanks in advance.
By the way, my moodle version is 2.6.3 running in localhost on a mac OSX 10.9
I had the same problem, but running moodle with MAMP.
The simple fix for me was just to add the php path for MAMP (for whichever PHP version I required):
export PATH=/Applications/MAMP/bin/php/php5.6.40/bin/:$PATH
…and then run whatever PHP script I needed!
Just a guess but I'm wondering if its picking up a different config.php
Try specifying the folder for the require_once
require_once('/Applications/XAMMP/moodlewebroot/config.php');
If that works then check the check the output of
echo DIR . '/../../../config.php'
Although it's more common to use dirname() in Moodle eg:
require_once(dirname(dirname(dirname(__FILE__))) . '/config.php');
Also some of the command line functions expect to have the dirroot set up in config.
$CFG->dirroot = '/Applications/XAMMP/moodlewebroot';

PHMagick not working after code moved to a different server

I built a pdf generator script for one of my clients and everything works properly. He then decided that he wanted me to create a thumbnail image from the PDF to display on another page, so I came across PHMagick and that seemed to do the trick.
The following code worked on my building server (iPage -- I think it's debian?), but now that I've moved it to his VPS, it is no longer working. FPDF has no trouble generating the pdf, so it is not a permissions issue.
Code:
require("phmagick/phmagick.php");
$pdf->Output("pdf.pdf");
$p = new phmagick('','pdf.png');
$p->debug = true;
$p->resize(800);
$p->acquireFrame("pdf.pdf");
This code returns the following error:
Error executing "convert "pdf.pdf"[0] "pdf.png"" return code: 127 command output :"sh: convert: command not found"
I have not changed any of the code since I moved it from the original server, and I just copied the entire site over, so why is PHMagick not working now? How do I get it to recognize convert.php in the plugins folder?
Just a note: I am only using PHMagick, not the whole of ImageMagick.
PHMagic appears to be using the command line convert command in background.
Most likely that command is simply not installed on the server.
PHMagic use the command line convert,composite etc... commands in background.
These commands are only available if ImageMagick is installed in your server.
In your previous server ImageMagick must have been installed.
Ipage sometimes do not pre install ImageMagick on their VPS servers. And you might not be able to install it your self ( through terminal login using ... yum install ImageMagick ) coz you will be prompt for root password.
To make sure the ImageMagick binaries are installed in ur server, in ur case the convert command,
type this command in the ssh terminal...
whereis convert
If the path to the convert command is not shown, it means you need to install ImageMagick.
You will have to open a support ticket and ask them to install it for you
As arkascha said, you'll need to install imagemagick. Try yum install imagemagick since you're running CentOS.
EDIT: May be a different capitalization: ImageMagick

Categories