Specs:
Ubunutu 16.04.1 Server
nginx 1.10
HHVM 3.17.0
I am attempting to gather a list of files, and run them through the hhvm compiler to utilize repo mode, with the following code:
#!/bin/bash
if [ "$(whoami)" != "root" ]; then
echo "Only root can do this.";
exit 1;
else
if [ $# -eq 0 ]; then
echo "Please pass the account name to enable this for"
exit 1;
else
#Get a list of files
FLIST=$(find /home/$1/www/ -type f -name '*.php');
for F in $FLIST
do
if [ -f $F ]; then
echo "Adding; $F";
echo $F >> $1-list.txt;
fi;
done;
hhvm --hphp -t hhbc -v AllVolatile=false -v WholeProgram=false --input-list $1-list.txt;
sleep 1;
rm -f $1-list.txt;
fi;
fi;
Upon running it on my server, I am presented with:
running hphp...
creating temporary directory /tmp/hphp_cFPMUQ ...
parsing inputs...
Unable to stat file /home/kpirnie/www/wp-content/PHPMailer/vendor/autoload.php
Unable to stat file /home/kpirnie/www/wp-content/PHPMailer/test/vendor/autoload.php
Unable to stat file /home/kpirnie/www/wp-content/PHPMailer/test/testbootstrap.php
Unable to stat file /home/kpirnie/www/wp-content/plugins/cloudflare/vendor/cloudflare/cf-ip-rewrite/vendor/autoload.php
Unable to stat file /home/kpirnie/www/wp-content/plugins/cloudflare/vendor/guzzle/guzzle/phing/tasks/phing/Task.php
Unable to stat file /home/kpirnie/www/wp-content/plugins/cloudflare/vendor/guzzle/guzzle/phar:/guzzle.phar/vendor/symfony/class-loader/Symfony/Component/ClassLoader/UniversalClassLoader.php
Unable to stat file /home/kpirnie/www/wp-content/plugins/cloudflare/vendor/guzzle/guzzle/phing/tasks/PEAR/PackageFileManager2.php
Unable to stat file /home/kpirnie/www/wp-content/plugins/cloudflare/vendor/guzzle/guzzle/phing/tasks/PEAR/PackageFileManager/File.php
Unable to stat file /home/kpirnie/www/wp-content/plugins/cloudflare/vendor/guzzle/guzzle/phing/tasks/PEAR/Packager.php
Unable to stat file /home/kpirnie/www/wp-content/plugins/cloudflare/vendor/guzzle/guzzle/phing/tasks/phing/tasks/ext/git/GitBaseTask.php
Unable to stat file /home/kpirnie/www/wp-content/plugins/cloudflare/vendor/sebastian/comparator/vendor/autoload.php
Unable to stat file /home/kpirnie/www/wp-content/plugins/wordpress-seo/vendor/composer/autoload_static.php
parsing inputs took 0'01" (1425127 us) wall time
pre-optimizing...
Core dumped: Segmentation fault
Stack trace in /tmp/stacktrace.31028.log
hphp failed
running hphp took 0'02" (2216979 us) wall time
And I can verify that the files that are Unable to stat indeed do not exist.
Stacktrace shows what looks like a memory dump (I assume) due to the segmentation fault.
How can I accomplish true Repo Mode? skip the missing files? but how?
If nothing in your source is referencing those files as you say, then try placing empty files in those places.
However, it is likely that you are referencing these files somewhere by means of a path that has included them. I suspect this is an HHVM issue and you should file your failing test-case here.
Related
php /home/test9/public_html/degerlendir/test-4567.php "var1=18&var2=22"
I need to run one page at background with cron job. I tested my code with command at above. But I get this error:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/extensions/no-debug-non-zts-20100525/imagick.so' - /usr/lib64/extensions/no-debug-non-zts-20100525/imagick.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: require_once(../config.php): failed to open stream: No such file or directory in /home/test9/public_html/degerlendir/test-4567.php on line 2
PHP Fatal error: require_once(): Failed opening required '../config.php' (include_path='.:/usr/lib64/php') in /home/test9/public_html/degerlendir/test-4567.php on line 2
The problem is page doesn't include config.php in the parent directory. The page working in browser normally. I tried to use different require_once variations like require_once ($_SERVER['DOCUMENT_ROOT']."/config.php"). I could not get it to work.
from the command line there is no $_SERVER['DOCUMENT_ROOT']. That one is only available from the http-server (Apache).
The working directory will not be automatically set. If you prompt is currently at /some/path/ the script will try to find config.php in /some/config.php.
Try cd to the current path by using __DIR__ in the start of your script
<?php chdir(__DIR__); ?>
Cron jobs always take full path of the included file from your root.
/home/test/.../your-file
In your cron job, you need to cd to the correct working directory to allow your PHP file to find it's includes. I do this by creating small shell scripts, and run the shell scripts from cron:
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd ${DIR}
php test-4567.php
exit 0
This also gives you the ability to do some useful things like checking to see if the script is already running to make sure you don't spin up multiple threads if that's something you want to avoid.
#!/bin/bash
FIND_PROC=`ps -ef |grep "php test-4567.php" | awk '{if ($8 !~ /grep/) print $2}'`
# if FIND_PROC is empty, the process has died; restart it
if [ -z "${FIND_PROC}" ]; then
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd ${DIR}
php test-4567.php
fi
exit 0
I have installed php-libvirt as well as all required packages
I have setup my php file as follows:
<?php
echo “WebAdmin 0.1Beta”;
echo “<br/>”;
$uri=”qemu:///system”;
echo (“Connecting to libvirt (URI:$uri)\n”.”<br/>”.”<br/>”);
$conn=libvirt_connect($uri,false);
if ($conn==false)
{
echo (“Libvirt last error: “.libvirt_get_last_error().”\n”);
exit;
}
However when I load the page I get:
WebAdmin 0.1Beta
Connecting to libvirt (URI:qemu:///system)
Libvirt last error: internal error Unable to locate libvirtd daemon in /usr/sbin (to override, set $LIBVIRTD_PATH to the name of the libvirtd binary)
It works fine from the command line when I run
[root#localhost ~]# virsh -c qemu:///system list
Id Name State
----------------------------------------------------
I checked Libvirtd status, it's also running
[root#localhost ~]# service libvirtd status
libvirtd (pid 14017) is running...
What could be the issue?
Do you have libvirtd executable in /usr/sbin?
You should find where it is and point $LIBVIRTD_PATH to the correct folder.
If you run the script as non-root user then the executable could be there, just the script does not have permissions to use it.
p.s. probably this question is for Server Fault
When I do php /usr/share/phpmyadmin/index.php, I get this.
PHP Warning: require_once(./libraries/common.inc.php): failed to open stream: No such file or directory in /usr/share/phpmyadmin/index.php on line 33
PHP Fatal error: require_once(): Failed opening required './libraries/common.inc.php' (include_path='.:/usr/share/php:/usr/share/pear') in /usr/share/phpmyadmin/index.php on line 33
The common.inc.php file seems to be there.
I didn't make any changes and hadn't used phpmyadmin in a while.
Update: Here is a search:
# find / -name "common.inc.php" -print
/usr/share/phpmyadmin/setup/lib/common.inc.php
/usr/share/phpmyadmin/libraries/common.inc.php
index.php is at /usr/share/phpmyadmin/index.php, so this looks right to me.
cd /usr/share/php mv php-gettext php-gettext.orig && ln -s php-php-gettext php-gettext
works for me. on Debian 4.3.3
Try to find the directory ./libraries/ in the PhpMyAdmin base directory. And see if the file common.inc.php is there or not. It is mandatory that the file should be there not anywhere else. You already said that it's there. But please check if that's in the right directory.
If nothing fixes the issue then try RE-INSTALLING PhpMyAdmin... I will suggest you take a BACKUP of your DATABASES first.
I had some other errors with mysql that I thought were unrelated. This is the message I got repeatedly every second for about a minute whenever I started or stopped mysqld:
2014-11-23 12:27:42 871 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11
2014-11-23 12:27:42 871 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
I followed this post to fix them (copied below): https://stackoverflow.com/a/24840903/2183008
# cd /var/lib/mysql
# mkdir bak
# mv ibdata1 bak/
# mv ib_logfile* bak/
# cp -a bak/ibdata1 ibdata1
# cp -a bak/ib_logfile* .
# rm -rf bak
# service mysqld restart
That fixed the errors when launching and now phpmyadmin loads fine now.
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=839923
Hi, this is what I did to "fix" the problem locally.
cd /usr/share/php
mv php-gettext php-gettext.orig
ln -s php-php-gettext php-gettext
symbolic linking within the original php-gettext/gettext.inc doesn't
work and generates the error, but linking directory to directory does
work. Of course, it will break things once the problem is fixed
formally, so before updating you may want to reverse those changes.
Additionally this was also in my /var/log/apache2/error.log:
I am trying to run a backend process and I am hitting into problem getting the upstart to run the yiic command.
I am using xampp server
Here is my upstart script:
#description "Sample upstart"
#start on stopped
start on startup
stop on shutdown
respawn
chdir /opt/lampp/htdocs/my_project/protected
setuid mad
setgid www-data
script
exec /opt/lampp/htdocs/my_project/protected/yiic project test
end script
So when i do
sudo start test-monitor
the upstart is starting and it it seems like it is firing a command to yii project as error is being caught in yii log file. The error in yii log file is:
2014/10/31 15:06:44 [error] [worker.*] CDbConnection failed to open the DB connection: could not find driver
2014/10/31 15:06:44 [error] [worker.*] CDbConnection failed to open the DB connection: could not find driver
2014/10/31 15:06:44 [error] [worker.*] CDbConnection failed to open the DB connection: could not find driver
2014/10/31 15:06:44 [error] [worker.*] CDbConnection failed to open the DB connection: could not find driver
However if I do the command manually:
./yiic project test
This are working fine. Can someone please help me.
Here is the codes for the yii console command:
public function actionTest(){
try{
while(1){
TestManager::_MonitorTest();
usleep(1000000);
}
}catch(Exception $e){
Yii::log( $e->getMessage(), 'error', 'worker.*');
}
}
Here is the log file of the upstart (It isn't the case as I have taken the sudo out):
sudo: no tty present and no askpass program specified
sudo: no tty present and no askpass program specified
sudo: no tty present and no askpass program specified
sudo: no tty present and no askpass program specified
sudo: no tty present and no askpass program specified
sudo: no tty present and no askpass program specified
sudo: no tty present and no askpass program specified
sudo: no tty present and no askpass program specified
sudo: no tty present and no askpass program specified
sudo: no tty present and no askpass program specified
Mysql connection is working fine and I have tested it
After some persistent tries and some configuration, I managed to solve the issue.
Since the server was a xampp server, php is installed in xampp thus there is an environment issue. Thus the bin directory of the php has to be referenced in the upstart as such:
This was the solve on the upstart script:
script
exec /opt/lampp/bin/php -f /opt/lampp/htdocs/my_project/protected/yiic.php project test
end script
I am working on a small php-mysql project and working inside /var/www/project on a freshly installed Apache/2.2.22 server(Ubuntu) in Ubuntu 12.04.1
I have chown[ed] the /var/www folder recursively to give ownership to www-data. Inside project i have a php file that tries to execute exec('gcc sample.c') but i get an error saying collect2: ld returned 1 exit status.I do not get this error when doing this through terminal.
In addition, an executable a.out placed inside the same folder runs fine when exec('gcc sample.c') is replaced by exec('./a.out')
How can i fix this? PS:I am a total beginner in this.
php code inside project:
<?php
require('connect.php');
$path='sample.c';
chmod($path,0777);
$command= 'gcc sample.c 2>&1';
$method = exec($command);
print_r($method);
?>
sample.c code:
#include<stdio.h>
int main()
{
printf("SUCCESS\n");
return 0;
}
This actually happens because not having permission to create .out file. May be when you compile or run it through terminal you will have enough permissions to do so and you might have run from the folder where the c file resided. Please check through the permission.
Do remember that when you run a php file the user is www-data not root or any other.