I started using PEAR yesterday, but Im having trouble.
When I launch the app, there is a bunch of QuickForm code at the tom of the page before the app.
I have followed the installation instructions from pear to the word.
Downloaded packages (including QuickForms), added the the path variables.
But for some reason it does this. I can not paste the code here as it is quite broken up into a lot of files. But maybe someone has come across something like this before.
You have set PEAR DB's debug level to non-zero value.
Set it to:
DB_DataObject::debugLevel(0);
Reference:
http://pear.php.net/manual/en/package.database.db-dataobject.db-dataobject.debuglevel.php
Related
Looking for brilliant mind to help me fix my problem. I have inherited a Laravel v5.3 project, and the project should be able to pass CV's from html to .pdf. They have been using spatie/browsershot for that task. But for some reason the package won't write the damn file.
I have been looking at the html passed to the function, and it all checks out. So I went to the guide on Github and put this line of code into the codefile as the only one left in the function.
Browsershot::html('<h1>Hello world!!</h1>')->save('example.pdf');
No matter what I do, I get this error message:
Spatie \ Browsershot \ Exceptions \ CouldNotTakeBrowsershot
For some reason Chrome did not write a file at `example.pdf`.
I have also tried giving an absolute path for Browsershot to save the file at. But no matter. I have looked up many different guides the past two weeks, but nothing seems to work atm. Puppeteer is also installed locally.
I'm running a Windows 10 machine btw, with latest updates, if that matters.
I had the same issue in a PHP project. Installing the puppeteer package worked for me.
npm install puppeteer
Let me just start by saying that I've posted this to multiple forums and even tried to get help on the ZF IRC channel. I've been Googling for a straight week and still no results. I've read a lot of Q's and A's on this site in the past, so I figured I'd make an account and try asking you.
(Yes, I've searched previously asked questions, but none of the answers helped me.)
I'm trying to learn how to use Zend Framework for a new project that I've joined. For compatibility reasons they are using Zend 1 (and not the newer Zend 2). I have found and followed a number of online and physical book tutorials but I've the same results over and over again.
So here goes (this are the instructions that all the tutorials give). I went to framework.zend.com and downloaded the full version of ZF 1.12.
I unzipped the contents
I moved the library folder to a safe directory where it won't be modified
I moved the contents of the bin folder to same directory as my PHP executable
I changed the include_path in my php.ini file to include the library directory
I updated my Windows PATH variable to make sure it included the path to the PHP executable
I ran
zf --help
This command worked as intended. I also successfully ran zf show version (Zend Framework Version 1.12.7).
I ran the command
zf create project myproject
Upon doing this, I receiving the following error message:
Fatal error: Class 'PHPUnit_Framework_TestCase' not found in D:\Zend\library\Zend\Test\PHPUnit\ControllerTestCase.php on line 48
That particular line in question is a class declaration that extends PHPUnit_Framework_TestCase. I don't know where PHPUnit_Framework_TestCase is defined. It is not in any of the files or directories that came in the single ZIP file that I downloaded from Zend. I even ran grep on all files and folders searching for the string "class PHPUnit_Framework_TestCase" but it printed no results.
Some have suggested that I don't have PHPUnit installed (which is obvious to me now). The part that bugs me is that absolutely none of the tutorials that I read mention anything about installing PHPUnit before hand or how to install it or what dependencies Zend has on it. Many of these were beginner tutorials that assumed you only had a basic knowledge of PHP, and it's pretty shocking to me that none even mentioned PHPUnit. If PHPUnit was that important I would think that the file I downloaded from Zend would have included it. I guess not.
So I went online again and got the PHAR file for PHPUnit, but now what? I tried putting it in multiple different directories but I still get the same error. Am I not supposed to use a PHAR file? Should I be using the actual files instead?
What do I have to do to get ZF to recognize PHPUnit, resolve this error and create my first ZF project?
Additional Info:
Windows 7, XAMPP Server (running on localhost), PHP 5.5.6
Assuming you have PHPUnit installed and it is on your include path (Bearing in mind that ZF1 only officially supports PHPUnit 3.4.x and definitely doesn't support anything above PHPUnit 3.5.x, so if you're using XAMPP you may have to downgrade PHPUnit as described here). The problem is most probably due to this commit, where the require calls for PHPUnit were stripped out in favour of using an autoloader. The ZF tool over CLI doesn't set up an autoloader though, so PHPUnit is not found because it is simply not required! To fix you can return these lines to the start of Zend/Test/PHPUnit/ControllerTestCase.php
/** #see PHPUnit_Runner_Version */
require_once 'PHPUnit/Runner/Version.php';
/**
* Depending on version, include the proper PHPUnit support
* #see PHPUnit_Autoload
*/
require_once (version_compare(PHPUnit_Runner_Version::id(), '3.5.0', '>=')) ? 'PHPUnit/Autoload.php' : 'PHPUnit/Framework.php';
It's worth noting that even with the error you mention, ZF tool should still work correctly when setting up a project, it just won't produce unit test actions (you'll have to make them yourself). If you don't want to downgrade your XAMPP PHPUnit version you should be able to add the correct version locally to your project using composer as described here.
Update Jan 2015:
Downgrading PHPUnit for XAMPP is no longer necessary as ZF1 has supported at least version 4.1 of PHPUnit since 1.12.7 (I've not tested above 4.1). This is helpful as PHPUnit has completely removed their deprecated Pear repository as of December 2014, which means you can't download versions older than 3.7 anymore anyway! (Currently XAMPP ships with PHPUnit 3.6). These days though it's probably worth chucking XAMPP for Vagrant and globally installing PHPUnit 4.1 via Composer during Vagrant provisioning.
I recommend using Composer to load both ZF and PHPUnit. Then make sure to include the Composer autoload.php file as your/in your phpunit boostrap file.
I had the same problem when I set up my laptop as a second development machine and downloaded the newest version of Zend Framework 1 (1.12.9). Whenever I tried to create a new action in a controller, I got the same error. Yet on my main computer, it worked fine.
I realized it was because the version of ZF1 I had in my php includes path was actually 1.11.11. So I went and got 1.11.14 from the ZF archives page, put it in the includes directory, and it worked fine.
Not entirely sure if this is the best way to make it work, since it is an older version, but at least it does work. And until someone actually comes on here and offers a better solution, that's what I intend to stick with.
You can create or edit a .zf.ini file in your home directory (~/.zf.ini or C:\Users\YOUR_ACCOUNT\.zf.ini on Windows)
php.include_path = "PATH_TO_THE_LIBRARY_FOLDERS_CONTAINING_ZEND_AND_PHPUnit"
basicloader.classes.0 = "PHPUnit_Framework_SelfDescribing"
basicloader.classes.1 = "PHPUnit_Framework_Test"
basicloader.classes.2 = "PHPUnit_Framework_Assert"
basicloader.classes.3 = "PHPUnit_Framework_TestCase"
If you are using Netbeans on Windows it could looks like this (you can put several library folder, just separate them with a semicolon ;) :
php.include_path = "C:\Users\romain\dev\ZendFramework-1.12.17\library;C:\Program Files\NetBeans 8.1\php\zend;C:\xampp\php\pear"
basicloader.classes.0 = "NetBeansCommandsProvider"
basicloader.classes.1 = "PHPUnit_Framework_SelfDescribing"
basicloader.classes.2 = "PHPUnit_Framework_Test"
basicloader.classes.3 = "PHPUnit_Framework_Assert"
basicloader.classes.4 = "PHPUnit_Framework_TestCase"
Now, I'm not exactly and expert in PHP, but my CMS i've created is going very well on my local server. I've attempted to place it on a live server to get blank page outputs everywhere except from when i use Codeigniters 'welcome' controller. Now i've checked every single file and i don't have one page that i close the PHP tags like so ?> when the page is completely PHP.
So is there a way that white space could be doing this another way apart from white space after tags?
Does white space after php tags between HTML tags count?
I've tested my database configuration and it works perfectly, so i don't know what else it could be. Just getting fed up of looking for something i'm completely not sure about and getting no where.
EDIT: You can see my lovely whiteboard here: http://asphaltcms.com/
EDIT: I can 100% confirm that preset/new controllers, models and views are working so it's something wrong with my current controllers ect, can white space appear in more than just after and before <?php ?> tags?
Thanks for reading.
I'll recomended to check following points if you are getting white screen ,
1:Check logs (PHP,Apache both)
2:Compare PHP info with your local code to live.
3:Check if short_open_tag is on or not
4:Enable error in config file.(error_reporting(E_ALL);
I hope this would help you to get rid of white board :)
Well i never figured this out, but my working result was just new codeigniter installation and re writing the code out quickly. Works on 3 web servers without any issues.
I later encountered an issue with .htaccess files being involved but i've resolved that :)
Thanks for the help.
I've just moved a site to a new host/server and experienced the same issue - White screen and no errors.
I noticed that I didn't have the php module GD or MYSQL installed so I installed those and it fixed my issue.
On ubuntu:
sudo apt-get install php5-mysql
sudo apt-get install php5-gd
i am moving in to the world of PHP for my company and i am having some issues. Now i have very little experience and i would love some help to get me to understand how it works.
My first problem is that i am trying to setup a sales page for my product, and i want a the open inviter script to pop up to "invite your friends to see this page for an extra free bonus" (only when the customer wants to buy my product, so there is no spamming going on here)
But for the last 5 days i have been trying and trying and i simply cant get it to work, the inviter just appears blank whatever i do.
Now i might know where the problem might be because i located it tooday, the open inviter i had was modified but i found the original and it had the requirements:
"Your server will need to have PHP5 installed with DOMDocument support and either cURL or WGET."
I found out that my hosting company supports php5 if i place a line through a .htpaccess file. but the rest like domdocuments or cURL is something i just seem to understand how it works, i have looked through hundreds of websites trying to figure this out but i cant get a simple enough explenation on what it really is and how i get it to work with my hosting.
Do anyone have an idea on how i can get my open inviter installed on my website?
Here is the installation details:
"Thank you for downloading The OpenInviter General Package. This document will guide you through the installation process.
A: Requirements:
Your server will need to have PHP5 installed with DOMDocument support and either cURL or WGET.
B: Install:
1. Extract the contents of the openinviter.tar.gz file you have just downloaded.
Note: tar -xzvf openinviter.tar.gz
2. Upload the extracted files to your webserver (subfolder is highly advised).
3. Run postinstall.php (http://yourdomain/openinviter_dir/postinstall.php)
You may encounter the following errors:
i) The cookie storing folder if not writable. (Change the cookie folder or modify it's permisions.)
ii) Php DOM extension is not installed. (Install dom extension for php)
iii) You don't have curl or wget installed. (Install curl or wget)
You may encounter the following warnings:
i) A plugin does not work properly. (Your server has either a firewall or there is a connectivity error)
Note: You have to fix all the errors or openinviter will probably not work.
Note*: You can't run postinstall.php again for 2 minutes.
Edit config.php to suit your needs.
Delete postinstall.php
Run example.php (http://yourdomain/openinviter_dir/example.php) and try to fetch your contacts.
Note: example.php is modifiable but keep in mind the structure of the file."
I recently signed up to shared web hosting with godaddy using Linux and PHP 5. I want to work with multiple RSS feeds. I previously had this all functioning under Apache, however, the host supplied the PEAR installation. Now I have to do this myself and I am in unfamiliar territory.I installed PEAR PHP and managed to get rss.php in the pear directory. It now asks for XML/Parser.php and I do not want to spend another week finding where and what to do.
Can you please inform me where i can find this routine and whther there is any problem in just copying it into the PEAR directory with ftp?
You can always just create some subfolder in your project and extract any PEAR libraries directly there, it's just plain php scripts. You will have to add that folder (and subfolders) to your include path so everything will be accessible.
It is considered as a bad practice because you will have to manually update PEAR libraries and stuff, but it gives you independence from your hoster.
Your PEAR (or other libraries) classes can be anywhere. You just need to set correct include paths where script will search for required code. If you can't access php.ini, you can get include paths by using get_include_path() function and set them using set_include_path();
I highly recommend SimplePie feed parser over the PEAR::XML_Feed_Parser. Usually the PEAR libraries are great but they don't support several common types of feeds (I believe Atom 0.3 among several others). Also there is very little documentation about how to use it and (clearly) how to install it.
Simply include the SimplePie library and point it at your feed and it does the rest. It's easy to query for any data you want regardless of schema differences. It's also very fast, we're using it to aggregate hundreds of feeds over at http://www.feedscrub.com.
Hope that helps!
echo ini_get('include_path');
This should show the include the path to PEAR on the original host environment, from there if its not to big just wrap the entire mess up with tar -cjzf devPear.tar.bz path2pear/ .
Copy this tar file over to GoDaddy, extract to a safe location... then in .htaccess or at the start point of your application scripts, add this pear package into your include_path.
Alternatively:
If you have administrative rights, I believe there is a pear.php command called "installed" that shows all installed pear packages. If you also have pear administrative rights on the new environment, you can go down the line doing copy and paste of the package names you need to pear --install "package" name.
The second is a little cleaner, but the first will be faster... just accept these packages will be effectively stranded from the pear system and unable to be updated.