Run once code fragment that doesn't work as expected

Hi,
A helpful person gave me this code fragment and told me to run it within the root directory of a PHP application causing me some grief.

The specific were a touch vague, but I was told to create a file, put this code in and run it. He assumed I knew how to do so, which I think I do.

Here are the instructions I was given:

"- create a file in root directory to run the following -

$updateModulesList = array( ‘Project’ => ‘packages/vtiger/optional/Projects.zip’,
‘Google’ => ‘packages/vtiger/optional/Google.zip’,
‘ExtensionStore’=> ‘packages/vtiger/marketplace/ExtensionStore.zip’);
foreach ($updateModulesList as $moduleName => $packagePath) {
$moduleInstance = Vtiger_Module::getInstance($moduleName);
if($moduleInstance) {
updateVtlibModule($moduleName, $packagepath);
}
}

[Note: I hope you know how to run a standalone .php file which interact to internal module in vtiger from vtigir root directory.]"

So, using cpanel editor within File Manager on my shared hosting server, I create David.php and literally pasted the code. Saved it. My understanding of running it via my browser to go the http://www.domainname.com/vtiger/david.php where domainname is of course the appropriate domain.

When I do, the code simply displays on screen. I then researched, and found that I should be enclosing the code fragment in a <?php ... ?> construct to inform the webserver this is to be interpreted as php; but when I do so via aforementioned editor; it shows an error on the first line which I do not understand.

I have replied to the author, who insists all is ok, and now doesn’t reply to me!

I’m sure this is something simple…

Can someone here help me with the correct content to use? ;D ;D ;D

David

Unfortunately I don’t have a solution to offer or else I’d be glad to do so. But I would like to make a suggestion to the group/forum as a whole. Consider changing the forum name from Phphelp.com to Php-no-help.com. Thank you. Thank you very much. Peace.

I highly doubt that you will get any help with an attitude like that on [size=18pt]ANY FORUM[/size]. My hunch is that you’re the OP (Original Poster), but I am not sure so I am keeping this thread open. If you’re not the OP then it’s considered rude to hijack a thread. As for the OP, first the code isn’t in php code tags making it harder to see and just reading his question I’m confused what he asking for and/or not qualified to answer it. I do help people out. Remember most people here who help people out are doing this for free, out of our kindness of our hearts, we have other things that need to be done first and lastly it does take us time to respond. If we don’t respond, there might be a reason such as what I gave above or many other reasons. This might sound blunt, but I believe in telling the truth as I see it. The truth in my opinion is the the best thing to do.

it shows an error on the first line which I do not understand.

And by not posting what the error is, we are supposed to understand it? We do not have a magic crystal ball. Post a proper forum question if you expect to get an answer.

just by quickly looking at your code, and the instructions that were given to you, i would suspect that you are putting the “David.php” file in the wrong place, as this line of code is calling for the path packages/vtiger/optional/Projects.zip

$updateModulesList = array(   'Project'   => 'packages/vtiger/optional/Projects.zip',

i would place the “David.php” file in the directory where you see the packages folder.

and your David.php file should look like this
[php]<?php
$updateModulesList = array( ‘Project’ => ‘packages/vtiger/optional/Projects.zip’,
‘Google’ => ‘packages/vtiger/optional/Google.zip’,
‘ExtensionStore’=> ‘packages/vtiger/marketplace/ExtensionStore.zip’);
foreach ($updateModulesList as $moduleName => $packagePath) {
$moduleInstance = Vtiger_Module::getInstance($moduleName);
if($moduleInstance) {
updateVtlibModule($moduleName, $packagepath);
}
}
?>[/php]

Please in the future enclose any code with [*code][/*code] or [*php][/*php] depending on the type of code it is. Thanks. {Minus the *}

Sponsor our Newsletter | Privacy Policy | Terms of Service