I am using dreamweaver on a Mac and am trying to save a file as "template.class.php" in the dreamweaver dialog box that opens up when you save something. Then in my script I am using the "include" construct to include the file as in:
require_once( $object . '.class.php' );
but am getting an error message
"Fatal error: Class 'template' not found in /Applications/XAMPP/xamppfiles/htdocs/xampp/web_development/MVC/registry/registry.class.php on line 28"
So i used notepad++ on windows to solve this problem which was that the files needed to be named "template.class" while still retaining the fact that it's a php file and not a Java class file. I want to know how I can do the same on a mac.
Any answers would be greatly appreciated!
Related
I am trying to set up server side script code for DataTables. What I have done so far :
Downloaded SSP from package
Installed PEARL on PHP server
Changed PHP.INI file include_path to the pearl folder
Placed the SSP class inside the same folder.
I keep getting the error message :
PHP Fatal error: require(): Failed opening required
'\crm\maintenance\ssp.class.php' (include_path='C:\Program Files
(x86)\php\v5.3\pear\') in C:\IIS\CRM\maintenance\khalid.php
Thhis is how i am calling the ssp class
require( 'ssp.class.php' );
SOME ADVICE!
The above steps WORK. In editing the question I had noticed that i was trying to specify a path in statement below as such :
require( '\xxx\xxxssp.class.php' ); // this does not work
FOLLOW the steps as outline the question itself and it will work!
I'm getting an error that class is not found, but I clearly have the right path for where it is located:
<?php
require_once('stripe-php-2.1.0/stripe/lib/Stripe.php');
Stripe::setApiKey('my_key');
var_dump($_POST['stripe-token']);
?>
Every article I've come across all claim that the problem is (not including the right path) in the require_one, include, or require. (I've tried all 3). But still no luck. My database calls follow the same format and my WAMP server has no problem creating my database class.
This is copied directly from my file explore (copy paste)
website\stripe-php-2.1.0\stripe\lib\Stripe.php
My php file that I am using to try and access Stripe sits in the same place as 'website'.
PHP version 5.5.12
tutorial references: http://www.larryullman.com/2013/01/09/writing-the-php-code-to-process-payments-with-stripe/
Other reference: http://www.youtube.com/watch?v=Lka_JBM9bbY
It's because it uses a namespace. Try:
\Stripe\Stripe::setApiKey('my_key');
It is better to initialize all classes.
require_once ("stripe_folder/init.php");
then use namespaces:
\Stripe\Stripe::setApiKey('key_key_key_key_key_key');
I'm getting this error
Fatal error: Cannot redeclare getAllStaff() (previously declared in /Applications/XAMPP/xamppfiles/htdocs/StaffTools/database/StaffHandler.php:5) in /Applications/XAMPP/xamppfiles/htdocs/StaffTools/database/staffHandler.php on line 15
I'm building an application in Apatana Studio 3 and I renamed a file from staffHandler.php to StaffHandler.php (uppercase S) so the former no longer exists.
I get all my PHP files from the database directory using the below PHP code
foreach(glob("database/*.php") as $filename) {
include $filename;
}
And then call a method called getAllStaff() here:
<select name="staff">
<?php getAllStaff(); ?>
</select>
Obviously, this method is now in StaffHandler.php. This was working fine until I changed the filename of the name.
Things I've tried
Clearing my cache in Firefox
Rebuilding & cleaning my project in Aptana
Changing the filename back to staffHandler.php
Conditional function statemet if(!function_exists....
Why on earth would PHP throw an error like that for a file that doesn't exist anymore?
UPDATE: RESOLVED
I had a reference to the staffHandler.php file buried within all my PHP scripts and I think this was the source of the problem. When I ran ls -la at the terminal in the database directory only StaffHandler.php appeared but when I ran find staffHandler.php and rm staffHandler.php it erased both staff and Staff. Must've been some kind of link between created by application code.
i am trying to run basic example of phpExcel in symfony1.4 and i am getting this error
C:\wamp\www\orangehrm-3.01\symfony>php plugins/sfPhpExcelPlugin/examples_1_2/01s
imple.php
10:39:01 Create new PHPExcel object
PHP Fatal error: Class 'sfConfig' not found in C:\wamp\www\orangehrm-3.01\symfo
ny\plugins\sfPhpExcelPlugin\lib\sfPhpExcel.class.php on line 9
any idea will be approciate.
The code for this plugin's examples is a bit strange. It uses the sfConfig class to read Symfony config variables but doesn't initialize nor include any Symfony code (hence the error).
In fact when you look at the code of this plugin you'll see that all it does is set some configuration when instantiating PHPExcel object. I would skip the plugin altogether and just use the PHPExcel directly in your project (you can either include it in the controller where you use it or in the ProjectConfiguration.class.php to make it available for the whole project (not recommended though).
I've created a phar of a Symfony2 web application, but I'm having some troubles with the cache-folders.
I found out that I could mount an external file/folder into a phar. That would fix my issue, but I can't get the example on the PHP site working.
I have a phar which contains an index.php:
<?php
$configuration = simplexml_load_string(file_get_contents(
Phar::running(false) . '/config.xml'));
?>
Then I include the .phar with the following code:
<?php
// first set up the association between the abstract config.xml
// and the actual one on disk
Phar::mount('phar://config.xml', '/var/www/$projectname/config.xml');
// now run the application
include 'phar-archive.phar';
?>
All files exists, but I get the following error:
PHP Fatal error: Uncaught exception 'PharException' with message 'config.xml is not a phar archive, cannot mount' in /var/www/$projectname/index.php:3
I already tried relative/absolute paths, changing permissions but can't get this to work. Additionally a working example of how I could mount a folder into a phar would be great !
First check that variable $projectname exist in this place (just run echo $projectname; before Phar::mount). If all ok, then change
Phar::mount('phar://config.xml', '/var/www/$projectname/config.xml');
to
Phar::mount('phar://config.xml', "/var/www/{$projectname}/config.xml");
It seems that variable $projectname not converted to its value because you used single quotes.