PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0
Showing posts with label pear. Show all posts
Showing posts with label pear. Show all posts

Wednesday, August 31, 2022

[FIXED] What design pattern is PEAR DB_DataObject implementing?

 August 31, 2022     database, design-patterns, pear, php     No comments   

Issue

DB_DataObject does not appear to be ActiveRecord because you do not necessarily store business logic in the "table" classes. It seems more like Table Data Gateway or Row Data Gateway, but I really cannot tell. What I need is good ORM layer that we can use with DataMapper and a DomainModel. Any ideas?


Solution

Follow this link to read what DB_DO is. In a nutshell, it doesn't implement a specific pattern, it just aims to provide a common interface. The idea is to not rebuild the same basic code in each project.

As for an ORM, I'd recommend Doctrine. It implements ActiveRecord.



Answered By - Till
Answer Checked By - Dawn Plyler (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] How common is PEAR in the real world?

 August 31, 2022     frameworks, pear, php     No comments   

Issue

I have looked at a good deal of other peoples source code and other open source PHP software, but it seems to me that almost nobody actually uses PEAR.

How common is PEAR usage out in real world usage?

I was thinking that maybe the current feeling on frameworks may be affecting its popularity.


Solution

PHP programmer culture seems to have a rampant infestation of "Not Invented Here" syndrome, where everyone appears to want to reinvent the wheel themselves.

Not to say this applies to all PHP Programmers, but them doing this apparently far too normal.

Much of the time I believe its due to lack of education, and that combined with difficulty of hosting providers providing decent PHP services.

This makes getting a workable PEAR installation so much more difficult, and its worsened by PHP's design structure not being favorable to a modular design.

( This may improve with the addition of namespaces, but have yet to see ).

The vast majority of PHP code I see in the wild is still classic amateur code interpolated with HTML, and the majority of cheap hosting that PHP users inevitably sign up for doesn't give you shell access.



Answered By - Kent Fredric
Answer Checked By - Gilberto Lyons (PHPFixing Admin)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] How to get timezone hour offset and account for DST with PEAR::Date?

 August 31, 2022     dst, pear, php, timezone     No comments   

Issue

I am trying to get the offset hours from UTC, given a summer date. My system time is set to America/Los_Angeles.

I have the following:

require_once("Date.php");

$dateTZ = new Date_TimeZone('America/Los_Angeles');

echo $dateTZ->getOffset(new Date('2009-07-01 12:00:00'))/1000/60/60;

This prints '-8'; shouldn't it show '-7'?

echo $dateTZ->getOffset(new Date())/1000/60/60;

also prints '-8'.

What am I doing wrong?


Solution

Does Date::inDaylightTime() help you? Date::getTZOffset claims to include daylight savings offset.



Answered By - cletus
Answer Checked By - Cary Denson (PHPFixing Admin)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] Why does PHP PEAR report that it can't find some DLL's on Windows?

 August 31, 2022     iis-6, pear, php     No comments   

Issue

I'm trying to do a system wide install of PEAR on my web server. When I execute go-pear.bat in the PHP installation folder from the command line I get the following error windows popping up:

---------------------------
php.exe - Unable To Locate Component
---------------------------
This application has failed to start because php_mbstring.dll was not found. 
Re-installing the application may fix this problem. 

---------------------------
php.exe - Unable To Locate Component
---------------------------
This application has failed to start because php_pdo.dll was not found. 
Re-installing the application may fix this problem. 

I also see the following warnings emitted in the command line window by the script:

PHP Warning:  PHP Startup: Unable to load dynamic library './ext/php_exif.dll' - The specified modul
e could not be found.
 in Unknown on line 0

All of these modules are configured in the php.ini file (which resides in the php install folder c:\php).

They are also reported correctly by php_info().

I'm running PHP 5.2.6 Windows Non thread safe build on FastCGI on IIS6.

Update:

I've also tried (as suggested by acrosman) setting extension_dir=c:\php and extension_dir=c:\php\ext but without success.

I'm also remembering to kill the php-cgi.exe process (FastCGI keeps it alive) after each php.ini modification to force a re-read.

Update 2:

This looks like a PHP issue and not an issue with PEAR, running php.exe from the command line generates the same errors.


Solution

Solved. It turns out that php.exe needs to see the PHP extensions (c:\php\ext) folder in the system PATH.



Answered By - Kev
Answer Checked By - Katrina (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] How can I get all field values from a query with JOINed tables?

 August 31, 2022     mdb2, pear, php     No comments   

Issue

I have this elementary query:

SELECT d.description, o.code FROM order_positions AS o
LEFT JOIN article_descriptions AS d ON (o.article_id = d.article_id)
WHERE o.order_id = 1

and I'm using MDB2 from PEAR to execute it and read the return values.

But somehow the result array always contains fields from the order_positions table only!, i.e. the result array looks like this

row[code] = 'abc123'

while I want it to look like this

row[description] = 'my description'
row[code] = 'abc123'

I already tried the following:

  • Vary the order of the fields, i.e. code first, then description.
  • Vary the order of the joined tables.
  • Used full table names instead of aliases.
  • Used the "MySQL join" instead (SELECT FROM table1, table2 WHERE table1.id = table2.id)
  • Used aliases with and without AS.

Some other facts:

  • Executing this query in MySQL Query Browser works fine, all fields are returned.
  • The order_positions table seems to be preferred, no matter what. When joining with additional tables I still only get fields from this table.

Solution

OK, I found the cause:

Fields with NULL values are not added to the array. In my test scenario description was in fact null and hence was not available in the array.

I'll still keep this (embarrassing) question, just in case someone else has this problem in the future.

Facepalm http://www.scienceblogs.de/frischer-wind/picard-facepalm-thumb-512x409.jpg



Answered By - Daniel Rikowski
Answer Checked By - Willingham (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] What is Pear DB library?

 August 31, 2022     pear, php     No comments   

Issue

I am a noob to PHP can anyone explain me whats Pear DB library with a practical use?

Thanks


Solution

Its just a database abstraction library. ALlows you to connect to different kinds of databases (MySQL, PostgreSQL) using a consistent API.



Answered By - Darrell Brogdon
Answer Checked By - Marie Seifert (PHPFixing Admin)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] How can I use QuickForm to add disabled select options?

 August 31, 2022     pear, php, quickform     No comments   

Issue

I have code using QuickForm that creates a select widget with the following:

$form->addElement( 'select', 'state_id', 'State:', statesArray() );

statesArray() queries the database to get the states available and returns an associative array with the ids linked to the state names. I'm using a similar technique throughout the solution.

What I'd like to do is prepend this array with two options that are disabled, so that by default the select menu says something like "Please select a state" followed by a dash, both of which are disabled. If I weren't using QuickForm, the select would have the following as the first two options:

  <option value="" disabled="disabled">Select a State</option>
  <option value="" disabled="disabled">-</option>

Both options are disabled, and if the user leaves the option on the first value, the select widget submits an empty value which is made invalid by the form checking code.

Is there a way to do this with QuickForm?

Thanks, Chuck


Solution

OK, after digging much deeper into the QuickForm documentation, I figured this out. The solution is to not populate the select widget with an array, but to build the select element manually add this to the form.

Originally, I had this:

function dbArray( $tableName, $fieldName ) {
    $query = <<< EOT
SELECT   `id`, `$fieldName`
FROM     `$tableName`
ORDER BY `$fieldName`
EOT;

    $link = connectToDatabase();
    $result = mysql_query( $query, $link );
    while ( $rec = mysql_fetch_assoc( $result ) );
    {
        $array[$rec['id']] = $rec[$fieldName];
    }

    return $array;
}

function statesArray() {
    return dbArray( 'states', 'name' );
}

$form = new HTML_QuickForm( 'account', 'POST' );
$form->addElement( 'select', 'state_id', 'State:', statesArray() );

I did a version where array( 'none' => 'Please select a State' ) was prepended to the dbArray call before returning the array to the calling code, but this didn't make the option disabled. Adding a rule to confirm that the choice is numeric was the workaround ($form->addRule( 'state_id', 'You must select a state.', 'numeric' )). But I still didn't like that it was selectable. Here's the solution I found.

function statesSelect() {
    $select = HTML_QuickForm::createElement( 'select' );
    $select->addOption( 'Select a State', '', array( 'disabled' => 'disabled' ) );
    $select->addOption( '-', '', array( 'disabled' => 'disabled' ) );

    $statesArray = dbArray( 'states', 'name' );
    foreach ( $statesArray as $id => $name ) {
        $select->addOption( $name, $id );
    }

    return $select;
}

$form = new HTML_QuickForm( 'account', 'POST' );
$form->addElement( statesSelect() );
$form->addRule( 'state_id', 'You must select a state.', 'required' );

I hope this helps someone else. :)



Answered By - Chuck
Answer Checked By - Timothy Miller (PHPFixing Admin)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] Why does PEAR get installed to my user directory?

 August 31, 2022     installation, linux, pear, php     No comments   

Issue

I am new to Linux and I am attempting to install the PHP PEAR library on a virtual server which is running Ubuntu. I am following a tutorial that covers installing PEAR but have run up against an area where I am confused. When running the PEAR installation program I am prompted as to what I want the INSTALL_PREFIX to be. Evidently the INSTALL_PREFIX, among other things, determines where PEAR will be installed. The tutorial suggest the value of INSTALL_PREFIX be the following path ...

"/home/MY_USER_NAME/pear"  

where MY_USER_NAME = my user account

Having come from a Windows world, applications are installed on the system where everyone can use them. If I install PEAR underneath my user directory will other developers on the system be able to make use of PEAR in their PHP scripts? I want to make PEAR available to all users and not just myself.

Could someone explain to me the difference between installing for all users and installing just for myself? Does the install location matter? Should I be installing PEAR in a different location?

Thanks for any suggestions.

P.S. The tutorial I am following is located at the following URL ...

http://articles.sitepoint.com/article/getting-started-with-pear/2


Solution

There is no law against giving others access to your home directory but in practice it is never done. If you wanted to do that you would have to set the correct directory permissions and the other users would need to put your stuff on their PATH. But don't, it's bad if only because others can see all your stuff, accidentally (or maliciously) delete things, etc.

You should read a few things on file system standards and file system hierarchy and figure out what is appropriate for you system. Usually it will be something like /opt or /usr/local which will be accessible to all users. Usually you will need to have root permissions to install in global locations.



Answered By - Duck
Answer Checked By - Dawn Plyler (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] what does the 'addDecl' option do in pear - XML_Serialize

 August 31, 2022     pear, php, xml-serialization     No comments   

Issue

I am looking at the examples given at the XML_Serialize pear plugin manual.

I can't figure out what the option 'addDecl' does in this plugin.

What does this do?

I can't seem to find it in their documentation...


Solution

At a (confident) guess, it'll be the XML Declaration at the start of the document

i.e.

<?xml version="1.0" encoding="UTF-8"?>



Answered By - laher
Answer Checked By - Katrina (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] What is faster - using PEAR package or including required libraries directly into php code?

 August 31, 2022     pear, php     No comments   

Issue

What will work faster - using PEAR package or require Some_Library.php files in code?

For example, what is faster - using Smarty as PEAR module or using require_once("Smarty.php")? Have anyone tested this?

Thank you


Solution

Both will be loaded from the include paths. The include path that comes first will be slighty faster, but I highly doubt you will notice a difference. You could do a benchmark though if you want to have numbers.

Basically, it works like this:

If you got a copy of Smarty in e.g. /var/www/app/libs/Smarty and another copy of it in PEAR and your include path is something like include_path="/var/www/app/libs:/php/pear" and you do a require 'Smarty.php', then PHP will first search in libs and immediately find Smarty. But without a local copy, PHP would still search the first include path, before it would search in PEAR, so it's a tiny (microseconds) bit slower. Nothing to worry about, unless you got many include paths. And of course, it depends on how you include paths are setup anyway. If PEAR comes first, then PHP will always search in there first. And if you use an absolute or relative path in require, the include path will be ignored altogether.

See the documentation for include and include_path for further details.



Answered By - Gordon
Answer Checked By - David Marino (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] How can I debug PEAR auth?

 August 31, 2022     pear, php     No comments   

Issue

I have a directory on my site that I've implemented PEAR's Auth to run my authentication. It is working great.

However, I've tried to make a copy of my site (it's going to be translated to a different language), and on this new site, the Auth process doesn't seem to be working correctly.

I can login properly, but every time I try to go to a different page in the same directory, and use Auth to authorize, it forces me to login again.

Here's my logic:

$auth_options = array(
        'dsn' => mysql://user:password@server/db',
        'table' => 'users',
        'usernamecol' => 'username',
        'passwordcol' => 'password',
        'db_fields' => '*'
    );

$auth = new Auth("DB", $auth_options, "login_function");
$auth->setFailedLoginCallback('bad_login'); 
$auth->start();

if (!$auth->checkAuth())
{
  die('cannot succeed in checkAuth')
  exit;
} else {
  include("nocache.php");
}

This is part of a file that's included in every php page I that I desire to require authentication. I can login properly once, but whenever I then try to go to a different page that requires authentication, it makes me login again (and I see the 'cannot succeed' die message at the bottom of the page).

Again, this solution works fine on my original site, I copied all the files, and only changed the db server/password - it still doesn't work. And I'm using the same webhost for both.

What am I doing wrong here? Or how can I debug this further?


Solution

Ok - it looks like my webhost is having a problem with sessions on PHP (at least for this site).

Here's what they tried that worked. The following is in an .htaccess file:

php_value session.gc_probability 1
php_value session.gc_divisor 100
php_value session.gc_maxlifetime 3600
php_value session.save_path /path/to/sessions/folder

Hope this helps someone else!



Answered By - croceldon
Answer Checked By - Cary Denson (PHPFixing Admin)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] How to include the PEAR php packages on a MAC when changed include path in .htaccess

 August 31, 2022     pear, php, zend-framework     No comments   

Issue

I'm trying to use the Text_Password class of PEAR but am not sure how to include it.

I have installed PEAR. And I'm guessing it has put the classes somewhere in the PHP directory. I have this in my .htaccess file

php_value include_path .:/Library/WebServer/Documents/phpweb20/include

Which is why I'm guessing it isn't picking them up. Does anyone know how i can include the PEAR classes?

Here is the error messageI get:

Warning: include_once(Text/Password.php) [function.include-once]: failed to open stream: No such file or directory in /Library/WebServer/Documents/phpweb20/include/Zend/Loader.php on line 146

Warning: include_once() [function.include]: Failed opening 'Text/Password.php' for inclusion (include_path='.:/Library/WebServer/Documents/phpweb20/include') in /Library/WebServer/Documents/phpweb20/include/Zend/Loader.php on line 146

Fatal error: Class 'Text_Password' not found in /Library/WebServer/Documents/phpweb20/include/DatabaseObject/User.php on line 25

The reason I have changed my .htaccess file is because I am using the Zend framework. I put the Zend classes in the include folder. Can I do something similar for PEAR?

Thanks a lot!

Jonesy


Solution

You can set multiple folders, see: http://php.net/manual/en/function.set-include-path.php

Example 2 will probably best suit your needs. You can also do that in your php ini file.



Answered By - Ashley
Answer Checked By - Candace Johnson (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] how do you add a named range to worksheet using php pear spreadsheet excel writer

 August 31, 2022     excel, pear, php     No comments   

Issue

Is it posible using Excel_spreadsheet_writer to create a name such as

$workbook  = new Spreadsheet_Excel_Writer();
$worksheet = &$workbook->addWorksheet('CheckNames');

$worksheet->writeName(0, 0, 'AnswerToEverythig', '42');

$worksheet->write(0, 1, 'Double =');

$worksheet->writeFormula(0, 2, '=AnswerToEverythig * 2');

$workbook->send('CheckNames.xls');
$workbook->close();

and dispay 84 in cell C1

As recommended by cypher I've tried PHPExcel but now get Internal Server Error on the following

$prices_sheet->setCellValueByColumnAndRow(4, $row, '=IF(Round_Up=0,  (C'.$row.'+D'.$row.'),  0.01  )');

changing the formula to

'=IF(0=0,  (C'.$row.'+D'.$row.'),  0.01  )'

stops the error.

Therefore PHPExcel has problems resolving formulas using named ranges.

Found This http://phpexcel.codeplex.com/Thread/View.aspx?ThreadId=209472


Solution

I'm not sure how about SpreadSheetExcelWriter, but it certainly can be done with PHPExcel. I've been using PHPExcel for a long time and I can only recommend it.



Answered By - cypher
Answer Checked By - Katrina (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] what is the use of go-pear.php ? What it does actually?

 August 31, 2022     pear, php     No comments   

Issue

Can anybody tell me why do we need to install a set of classes using a script ?

PHP PEAR Lib is essentially a set of classes, is it fairly good to just copy in the hosting server.

So is go-pear.bat go-pear.php is necessary or its an optional. If it is necessary would like to know why?


Solution

It is only a tool to help install PEAR classes for all users on the machine.

If you are only going to use a PEAR class in a single project, you can easily just grab the class from it's download page and bundle it with the app.



Answered By - Charles
Answer Checked By - Robin (PHPFixing Admin)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] How to perform a search query using Services_Twitter?

 August 31, 2022     api, pear, php, service, twitter     No comments   

Issue

I am trying to perform a Twitter search using the PEAR package Services_Twitter. Unfortunately this only returns an array of status ids, for example (var_dump):

object(stdClass)#88 (2) {
  ["statuses"]=>
  array(11) {
    [0]=>
    int(49497593539)
    [1]=>
    int(49497593851)
    [2]=>
    int(49497598001)
    [3]=>
    int(49497599055)
    [4]=>
    int(49497599597)
    [5]=>
    int(49497600733)
    [6]=>
    int(49497602607)
    [7]=>
    int(49497607031)
    [8]=>
    int(49497607453)
    [9]=>
    int(49497609577)
    [10]=>
    int(49497610605)
  }
  ["created_in"]=>
  float(0.008847)
}

The script I'm using is similar to this test script I wrote:

<?php
//$oAuth = new HTTP_OAuth_Consumer( /** Supply oAuth details here **/ );
$Twitter = new Services_Twitter();
//$Twitter->setOAuth($oAuth);
try {
    $Response = $Twitter->search(array(
      "q"   => "#FF -RT OR #FollowFriday -RT",
      "rpp" => 10,
      "since_id"  => 23982086000,
      "result_type" => "recent"
    ));
    var_dump($Response);
  } catch (Exception $e) {
    fwrite(STDERR, $e->getMessage());
  }
?>

Since I want to scan the tweets for certain words and want to know when it was posted and by whom, I would need to request all these statuses one by one. But according to the example response in the Twitter API documentation they already return all the necessary information about the tweets (which is kinda obvious).

So, the question is: How can I access this information using Services_Twitter?

Kind Regards,

Arno


Solution

So as I said ->search() is wrapped through Services_Twitter::__call().

But here's the mis-understanding!

Two searches:

  • http://api.twitter.com/1/search.json?q=@noradio
  • http://search.twitter.com/search.json?q=@noradio

This is confusing as search.twitter.com returns the results as you'd expect them and the other API method just the status IDs.

For some reason only when you search for trends search.twitter.com is used. Otherwise it's the API methods. If you want to help, please open a ticket on PEAR and I can try to implement this for you.

A quickfix for you is this script:

<?php
$uri  = 'http://search.twitter.com/search.json?';
$uri .= http_build_query(
    array(
        "q"           => "#FF -RT OR #FollowFriday -RT",
        "rpp"         => 10,
        "since_id"    => 23982086000,
        "result_type" => "recent"
));

$response = file_get_contents($uri);
if ($response === false) {
    fwrite(STDERR, "Could not fetch search result.");
    exit(1);
}

$data = json_decode($response);
var_dump($data);


Answered By - Till
Answer Checked By - Katrina (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] What is the best package for generating dynamic graphs with PHP?

 August 31, 2022     gd, graph, imagemagick, pear, php     No comments   

Issue

I have a strong need to start implementing database driven graphs on a couple of projects and the only library I have really played with is PEAR's Image_Graph. On the surface this seems fairly limited and like it may not be the best solution. I am going to need to generate both bar/pie charts, nothing overly fancy for the first cut.

Does anybody have any strong feelings about any of the image/graph libraries out there for PHP? Whether you like GD/Imagick/Image_Graph, please give a couple reasons as to why you feel this way.

Thanks!

  • Nicholas

Solution

pChart: http://pchart.sourceforge.net/

I've personally used this, it works great.



Answered By - Luca Matteis
Answer Checked By - David Goodson (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] How to check PHP code against a specific set of coding conventions?

 August 31, 2022     pear, php, validation     No comments   

Issue

I have a PHP library that I'm planning to submit to the PEAR database. In order to do this, the library needs to follow the PEAR Coding Standards.

Is there a tool that can check my code to make sure it follows the standards completely?


Solution

http://pear.php.net/manual/en/package.php.php-codesniffer.php

By default, PHP_CodeSniffer will use the PEAR coding standard if no standard is supplied on the command line.



Answered By - B00MER
Answer Checked By - Senaida (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] How to use Pear with xampp?

 August 31, 2022     pear, xampp     No comments   

Issue

How do i include Pear's QuickForm into a php file if Pear is already installed in xampp?


Solution

I ran go-pear.bat from the command line, and it ran a setup program to configure my system for PEAR.

When it was finished I was left with some new folders and a pear.bat file. I tested it with "pear install -f Text_CAPTCHA" and everything seemed to work.



Answered By - Wouter Dorgelo
Answer Checked By - David Goodson (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] What is the PHP PATH variable and how to I add to it?

 August 31, 2022     path, pear, php     No comments   

Issue

Normally google is my friend for these kind of newbie problems, and I'm pretty proud of myself learning as I go without really needing to ask any questions in terms of PHP stuff, but this one's got me stumped. Trying to install a version of PEAR that supersedes my host's copy, which is hideously outdated. Apparently "pear's binary (bin) directory should be in your PATH variable." I don't know what that means or how to edit it, and supplementary to that, wether that will actually solve my problem of an outdated version of pear being on my root server. Any advice in either of these areas would be greatly welcomed, thank you.


Solution

Actually, they are talking about the OS's PATH environment variable, not PHP's include path (binaries [bin] are run by the OS, not parsed by PHP) Unfortunately, since you are in a shared hosting environment, you cannot change this environment variable in a permanent fashion. If you do have shell access though, you can modify your .profile file set the PATH variable.

You can use getenv() and putenv() to retrieve and set the PATH variable, but this will be reset on each script run.

That said, you do not need the PATH variables set to use PEAR. If you have a PEAR install on your development computer, you can upload the pear folder onto your host and modify the include_path at runtime to point to your own "install" using set_include_path()

$pearInstallPath = realpath('./pear/packages');
set_include_path('.' . PATH_SEPARATOR . $pearInstallPath);


Answered By - Andrew Moore
Answer Checked By - Marie Seifert (PHPFixing Admin)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] How to configure Magento downloader?

 August 31, 2022     magento, pear     No comments   

Issue

I'm trying to use Downloader from a previous Magento application but I got an error because the path doesn't meet my environement:

ERROR: failed to mkdir /var/www/domain.tld/app/locale/en_US

But my websites are not located here.

How could I configure this?


Solution

try deleting downloader/connect.cfg and login your admin's connect manager, it should recreate a new one with the correct path.



Answered By - OSdave
Answer Checked By - Marilyn (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Older Posts Home

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
All Comments
Atom
All Comments

Copyright © PHPFixing