PHP Warning: include_once() - php

I need help with these few errors here
`[06-May-2018 20:08:16 America/New_York] PHP Warning: include_once(unifont/ttfonts.php): failed to open stream: No such file or directory in /Applications/MAMP/htdocs/squid/lib/tfpdf.php on line 507
[06-May-2018 20:08:16 America/New_York] PHP Warning: include_once(): Failed opening 'unifont/ttfonts.php' for inclusion (include_path='.:/Applications/MAMP/bin/php/php5.4.45/lib/php') in /Applications/MAMP/htdocs/squid/lib/tfpdf.php on line 507
[06-May-2018 20:08:16 America/New_York] PHP Fatal error: Class 'TTFontFile' not found in /Applications/MAMP/htdocs/squid/lib/tfpdf.php on line 508`
This is the line 507:
if (!isset($type) || $type != "TrueTypesubset") {
include_once($this->_getfontpath().'unifont/ttfonts.php');
line 507>>> $ttf = new TTFontFile();
And this is line 508
$ttf = new TTFontFile();
I updated the paths to this :
if ($uni) {
if (defined("_SYSTEM_TTFONTS") && file_exists(_SYSTEM_TTFONTS.$file )) { $ttfilename = _SYSTEM_TTFONTS.$file ; }
else { $ttfilename = $this->_getfontpath().'/Applications/MAMP/htdocs/squid/lib/font/unifont/'.$file ; }
$filename = $file;
$filename =str_replace(' ','',$filename );
$filename =str_replace('-','',$filename );
$unifilename = $this->_getfontpath().'unifont/'.strtolower(substr($filename ,0,(strpos($filename ,'.'))));
$diff = '';
$enc = '';
if (file_exists($unifilename.'.mtx.php')) {
include($unifilename.'.mtx.php');
}
if (!isset($type) || $type != "TrueTypesubset") {
include_once($this->_getfontpath().'/Applications/MAMP/htdocs/squid/lib/font/');
$ttf = new TTFontFile();
This is the font folder:
squid\lib\tfpdf\font
full path: /Applications/MAMP/htdocs/squid/lib/font/
This is the unifont folder
squid\lib\tfpdf\font\unifont
Full path: /Applications/MAMP/htdocs/squid/lib/font/unifont
When i change the paths i get this error:
[08-May-2018 14:38:02 America/New_York] PHP Warning: include_once(/Applications/MAMP/htdocs/squid/lib/font/): failed to open stream: No such file or directory in /Applications/MAMP/htdocs/squid/lib/tfpdf.php on line 507
[08-May-2018 14:38:02 America/New_York] PHP Warning: include_once(): Failed opening '/Applications/MAMP/htdocs/squid/lib/font/' for inclusion (include_path='.:/Applications/MAMP/bin/php/php5.4.45/lib/php') in /Applications/MAMP/htdocs/squid/lib/tfpdf.php on line 507
[08-May-2018 14:38:02 America/New_York] PHP Fatal error: Class 'TTFontFile' not found in /Applications/MAMP/htdocs/squid/lib/tfpdf.php on line 508

include_once($this->_getfontpath().'/Applications/MAMP/htdocs/squid/lib/font/');
This gives an error because you're trying to include an entire folder, you need to specify a filename
$ttf = new TTFontFile();
This gives an error because the class TTFontFile is not defined, maybe its in another file that you didn't include.

Seems like the path returned by
$this->_getfontpath()
is incorrect, or the file you are looking to include is not installed at that path.
You should figure out what $this->_getfontpath() returns, where it is defined. Then see if that path exists and what files are there. Also reading the docs for the library you are installing should help you troubleshooting.

Try changing
/Applications/MAMP/htdocs/squid/lib/font/
to
/squid/lib/font/
does that help?

Related

PHP Function rename fails “No such file or directory"…

Rename Functions fails. i already tried a lot of different solutions of this forum but nothing helps.
This is my Code:
$dirname='rechnungen/';
$handleu=opendir($dirname);
while ( $ufile = readdir ( $handleu ) ) {
$ufile = substr($ufile,11);
foreach ($mydata as $nr => $uinhalt)
{
$ufilename = $uinhalt['File'].'.pdf';
if($ufilename == $ufile) {
rename($dirname.$ufile, $dirname.'ER'.$uinhalt['Zahl'].'_'.$ufile );
}
}
}
closedir( $handleu );
I get this warnings:
Warning: rename(rechnungen/REGW-2020-143.pdf,rechnungen/ER013_REGW-2020-143.pdf): No such file or directory in /volume1/web/sevdesk/rechnungen.php on line 162
Warning: rename(rechnungen/REGW-2021-011.pdf,rechnungen/ER011_REGW-2021-011.pdf): No such file or directory in /volume1/web/sevdesk/rechnungen.php on line 162
Warning: rename(rechnungen/REGW-2021-014.pdf,rechnungen/ER015_REGW-2021-014.pdf): No such file or directory in /volume1/web/sevdesk/rechnungen.php on line 162
Warning: rename(rechnungen/REGW-2021-009.pdf,rechnungen/ER012_REGW-2021-009.pdf): No such file or directory in /volume1/web/sevdesk/rechnungen.php on line 162
Warning: rename(rechnungen/REGW-2021-007.pdf,rechnungen/ER014_REGW-2021-007.pdf): No such file or directory in /volume1/web/sevdesk/rechnungen.php on line 162
Can you help me with that?
try to change the paths in ../rechnungen/file.pdf,
may you have to use the full path and you have to give the files and directories full permissions.
$path = "/volume1/web/sevdesk/";
$dirname= $path.'rechnungen/';

Error when running my php script

I have these errors when running my script.
failed to open dir: No such file or directory in /Applications/MAMP/htdocs/sites-store/word/word2.php on line 6
Warning: scandir(): (errno 2): No such file or directory in /Applications/MAMP/htdocs/sites-store/word/word2.php on line 6
Warning: array_diff(): Argument #1 is not an array in /Applications/MAMP/htdocs/sites-store/word/word2.php on line 6
Warning: Invalid argument supplied for foreach() in /Applications/MAMP/htdocs/sites-store/word/word2.php on line 7
Well this is my code below, I don't understand why it failed to open my dir when it's being declared below? Can someone help me with this.
Code of my word2.php
<?php
$numargs = count($argv);
if ($numargs > 1) {
$folder = $argv[1];
echo "Folder is: " . $folder . "\n";
$files = array_diff(scandir($folder), array('.', '..')); //line 6
foreach ($files as $file) { //line 7
$filename = str_replace("í»", "", $filename);
}
} else {
echo "You need to pass the folder absolute path";
exit();
}
Code for running my script using this command ./run.bat this is the filename with a code below.
php word2.php "/Applications/MAMP/htdocs/sites-store/word/images"
PAUSE
Try changing your .bat file to
php word2.php -- "/Applications/MAMP/htdocs/sites-store/word/images"
PAUSE
and you should also do var_dump($argv), to see how your script gets its parameter.
failed to open dir: No such file or directory in
/Applications/MAMP/htdocs/sites-store/word/word2.php on line 6
Make sure that your file in that directory.
Check the filename again means is there any spelling mistakes or duplicated.
Make sure if it's read that directory or not

PHP error when accessing any option

I am using phpMYADMIN and netbeans for coding, when pressing run project in netbeans at the top of my page I get this error: `
Warning: include(utils/mysql.class.php): failed to open stream: No such file or directory in C:\xampp1\htdocs\autonuoma\index.php on line 6
Warning: include(): Failed opening 'utils/mysql.class.php' for inclusion (include_path='C:\xampp1\php\PEAR') in C:\xampp1\htdocs\autonuoma\index.php on line 6
My whole is index.php is:
<?php
// nuskaitome konfigūracijų failą
include 'config.php';
// iškviečiame prisijungimo prie duomenų bazės klasę
include 'utils/mysql.class.php';
// nustatome pasirinktą modulį
$module = '';
if(isset($_GET['module'])) {
$module = mysql::escape($_GET['module']);
}
// jeigu pasirinktas elementas (sutartis, automobilis ir kt.), nustatome elemento id
$id = '';
if(isset($_GET['id'])) {
$id = mysql::escape($_GET['id']);
}
// nustatome, kokia funkcija kviečiama
$action = '';
if(isset($_GET['action'])) {
$action = mysql::escape($_GET['action']);
}
// nustatome elementų sąrašo puslapio numerį
$pageId = 1;
if(!empty($_GET['page'])) {
$pageId = mysql::escape($_GET['page']);
}
// nustatome, kurį valdiklį įtraukti šablone main.tpl.php
$actionFile = "";
if(!empty($module) && !empty($action)) {
$actionFile = "controls/{$module}_{$action}.php";
}
// įtraukiame pagrindinį šabloną
include 'templates/main.tpl.php';
?>
When I click some menu option in the webpage it returns an error also:
Warning: include(utils/mysql.class.php): failed to open stream: No such file or directory in C:\xampp1\htdocs\autonuoma\index.php on line 6
Warning: include(): Failed opening 'utils/mysql.class.php' for inclusion (include_path='C:\xampp1\php\PEAR') in C:\xampp1\htdocs\autonuoma\index.php on line 6
Fatal error: Uncaught Error: Class 'mysql' not found in C:\xampp1\htdocs\autonuoma\index.php:11 Stack trace: #0 {main} thrown in C:\xampp1\htdocs\autonuoma\index.php on line 11
My question is, what is causing this? The webpage is loading, but it doesn't let me click anything since mentioned error occurs. I know this might sound very silly but I cannot locate the error
`

PHP mailer error : failed to open stream: No such file or directory

Hello there I receive following error while try to upload file using php mailer.
move_uploaded_file(C:/inetpub/vhosts/yoursite.com/httpdocs/userfiles/resumes/5007story1.pdf) [function.move-uploaded-file]: failed to open stream: No such file or directory in D:\yoursite\wwwroot\jobseekers.php on line 87
global $imagesname;
global $image_type;
$uid = rand(100,9999);
if(isset($_FILES["img"]["name"]))
{
$image_tempname= $_FILES['img']['name'];
$imgdir ="C:/inetpub/vhosts/yoursite.com/httpdocs/";// $_SERVER ["DOCUMENT_ROOT"];
//imgdir =$_SERVER ["DOCUMENT_ROOT"];
$imgname = $imgdir. 'userfiles/resumes/'.$uid.$_FILES['img']['name'];
if($imagesname != '')
{
$imagesname=$imagesname.','.$imgname;
$image_type=$image_type.','.$_FILES['img']['type'];
}
else
{
$imagesname=$imagesname.$imgname;
$image_type=$image_type.$_FILES['img']['type'];
}
$imgurl = 'userfiles/resumes/'.$image_tempname;
//print_r($_SERVER['PATH_TRANSLATED']);
move_uploaded_file ($_FILES['img']['tmp_name'], $imgname);
}
if(isset($_FILES["img"]['name']))
{
$filename=$uid.$_FILES["img"]["name"];
}
$fileField=$filename;
Line Number 87 Is:
move_uploaded_file ($_FILES['img']['tmp_name'], $imgname);

Printing a YouTube video feed in php

I'm in the beginning stages of writing a plugin to display YouTube videos in a WordPress implementation. Here is my code:
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata_Youtube');
$yt = new Zend_Gdata_YouTube();
function getAndPrintVideoFeed($location::'http://gdata.youtube.com/feeds/api/users/thelanzolini/uploads/-/step') {
$yt = new Zend_Gdata_YouTube();
// set the version to 2 to receive a version 2 feed of entries
$yt->setMajorProtocolVersion(2);
$videoFeed = $yt->getVideoFeed($location);
printVideoFeed($videoFeed);
}
function printVideoFeed($videoFeed) {
$count = 1;
foreach ($videoFeed as $videoEntry) {
echo "Entry # " . $count . "\n";
printVideoEntry($videoEntry);
echo "\n";
$count++;
}
}
All I get is this error:
I am using MAMP. php is version 5.4.10.
Switching the $location:: above for a $location = I get no errors within the actual plugin file itself but rather in loading various components of Zend.
Errors:
Warning: include_once(Zend/Gdata/Youtube.php): failed to open stream:
No such file or directory in
/Users/mrcsmcln/Documents/MAMP/wordpress/wp-content/plugins/youtube-filter/Zend/Loader.php
on line 134
Warning: include_once(): Failed opening 'Zend/Gdata/Youtube.php' for
inclusion
(include_path='.:/Applications/MAMP/bin/php/php5.4.10/lib/php') in
/Users/mrcsmcln/Documents/MAMP/wordpress/wp-content/plugins/youtube-filter/Zend/Loader.php
on line 134
Warning: require_once(Zend/Exception.php): failed to open stream: No
such file or directory in
/Users/mrcsmcln/Documents/MAMP/wordpress/wp-content/plugins/youtube-filter/Zend/Loader.php
on line 86
Fatal error: require_once(): Failed opening required
'Zend/Exception.php'
(include_path='.:/Applications/MAMP/bin/php/php5.4.10/lib/php') in
/Users/mrcsmcln/Documents/MAMP/wordpress/wp-content/plugins/youtube-filter/Zend/Loader.php
on line 86
What is wrong with my code? Is there a better way I can go about all this?
function getAndPrintVideoFeed($location::'http://gdata.youtube.com/feeds/api/users/thelanzolini/uploads/-/step') {
$yt = new Zend_Gdata_YouTube();
// set the version to 2 to receive a version 2 feed of entries
$yt->setMajorProtocolVersion(2);
$videoFeed = $yt->getVideoFeed($location);
printVideoFeed($videoFeed);
}
Should? possibly? be this: Not familiar with ZF buth this is the regular syntax atleast.
function getAndPrintVideoFeed($location = 'http://gdata.youtube.com/feeds/api/users/thelanzolini/uploads/-/step') {
$yt = new Zend_Gdata_YouTube();
// set the version to 2 to receive a version 2 feed of entries
$yt->setMajorProtocolVersion(2);
$videoFeed = $yt->getVideoFeed($location);
printVideoFeed($videoFeed);
}

Categories