I'm not a php developer but I'm fiddling with MAMP. I've installed MAMP and my php include() calls aren't working.
[13-Jul-2010 19:23:30] PHP Fatal error: require_once() [<a href='function.require'>function.require</a>]: Failed opening required '1' (include_path='.:/Applications/MAMP/bin/php5.3/lib/php:/Applications/MAMP/htdocs/mt_sandbox/php/') in /Applications/MAMP/htdocs/mt_sandbox/php/email/owner_emails.php on line 5
As you can see there, I was trying to edit my php.ini file to use a second include path to the 'php' directory of my project 'mt_sandbox'.
Here are the exact includes
require_once("Mail.php") or die ('php load error for Mail.php');
require_once('/Applications/MAMP/htdocs/mt_sandbox/php/email/email_manager.php') or die ('php load error for email/email_manager.php');
The die messages aren't firing because I'm getting the PHP Fatal error.
Can anyone tell me what I'm doing wrong? How can I get setup to use includes in my scripts?
I ran across this same issue after upgrading to Mountain Lion. Considering how old your post is I assume you have solved this, but figure an answer may be useful for others searching.
When installing pear extensions for MAMP make sure to run your commands using the pear package in MAMP. If pear is already installed outside of MAMP and you execute
pear install -a Mail
This will fire off the wrong pear function. Executing this will tell you which pear function you are using.
which pear
For me it was in /opt/local/bin/pear
To use the MAMP pear function I navigated into this directory '/Applications/MAMP/bin/php/php5.4.4/bin' and used this command
./pear install -a Mail
This fired the pear command in MAMP and installed the package for me.
Use an absolute path to the file you're including
Related
I want to add phpmail to my php Server. The server is a windows machine. I searched for it and found out that the best way to install it is with composer. I'm having trouble getting composer to install due to php.ini issues.
I am getting the following error:
*The PHP exe file you specified did not run correctly:
C:\php\php.exe
The php.ini used by your command-line PHP is: C:\Windows\php.ini
A setting in your php.ini could be causing the problem: Either the 'extension_dir' value is incorrect or the dll does not exist.
Program Output:
PHP Warning: PHP Startup: Unable to load dynamic library 'c:\php\ext\pdo_odbc' - The specified module could not be found.
in Unknown on line 0*
I tried searching the net for pdo_odbc but am not sure what I'm looking for. where can I get the missing dll?
I finally got composer to install. I had to first, rename the ODBC DLL from PHP_pdo_odbc.dll to pdo_odbc.dll. Then I got a message about SSL not being enabled. I first had to enable it in php.ini. Again I had to rename the DLL for SSL from PHP_openssl.dll to openssl.dll. Then Composer installed. Why did PHP install with the DLL's named differently than composer was expecting? Or is this a composer issue or the fact that it's PHP on windows? From there I installed PHPmailer and sent my first piece of mail. This is so much more complicated than coding in .Net
I'm trying to save an old, failing web-server setup consisting of Fedora, PHP, PEAR, and Oracle.
With some difficulty (I'm very new to all four), I've been able to set up something similar on a newer system. I used Fedora 19, PHP 5.5.4 (with Apache 2.4.6), and Oracle 11g.
That just leaves PEAR.
Now, from what I understand, PEAR is some PHP code, like a library, which PHP Web Applications can use to save time from having to code them again - database connection, for example.
But I don't know what to do with it, or even how to get it. Copy paste from my old system? Download using the CLI using yum? Are there packages I need to be aware of, or is it just a one download-one install thing?
For instance, a basic PHP webpage with the following code:
<?php
phpinfo();
?>
works fine on the new server setup, so I'm assured that everything else is working. But when I try to load the PHP files from the other server, it returns an Internal Server Error. I checked the error_log files under /etc/httpd/logs, and most of the errors appear as below:
PHP Fatal error: require_once(): Failed opening required 'MDB2.php' (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/html/hrweb/includes/functions.php on line 4
EDIT:
According to the PEAR Website, PEAR is included upon the installation of PHP, though not all modules / packages are there. Typing in the command pear in the CLI does confirm it is installed, though it does not help the issue.
I got the MDB2 package via pear install MDB2, though apparently, MDB2_Driver_oci8 is required. Whenever I try to download that, I get the following:
"MDB2_Driver_oci8" version "1.4.1" does not have REST XML available
In addition to this, I also tried to download OLE, which gets me the following:
No releases available for package "pear.php.net/OLE"
This was also previously the error of trying to download MDB2_Driver_oci8.
Thanks.
You have to install the (surprise!) MDB2 package to get MDB2.php:
$ pear install mdb2
and the adapter of your choice:
$ pear install mdb2_driver_mysql-beta
Then make sure the PEAR php directory is in your include path - see the PEAR manual.
"MDB2_Driver_oci8" version "1.4.1" does not have REST XML available
try to install the beta version:
$ pear install mdb2_driver_oci8-beta
No releases available for package "pear.php.net/OLE"
You're trying to install the stable version, but OLE does not have any stable version (yet): http://pear.php.net/package/OLE/download
Append either -alpha or -beta after OLE:
$ pear install OLE-beta
I am trying of install the dependency manager for php "composer", but "composer" needs the extension "phar". I've realized php6 comes with phar by default, but is disabled and not necessary in order to execute "phar" files.
When I try execute "composer.phar" (in the cmd: php composer.phar) it throws the error:
Fatal error: Class 'Phar' not found in composer.phar on line 13.
If I try to execute the Composer installer, "installer.php" (in the cmd: php installer.php) throws this error:
Some settings on you machine make composer unable to work properly. Make sure that you fix the issues listed below and run this script again:
The phar extension is missing. How can I fix this?
Should I install it or recompile php without --disable-phar I am using appserv 2.6.4 (apache 2.2, php6, mysql 4).
You really shouldn't use cutting edge theoretical software. PHP6 doesn't actually exist. Downgrading to a more realistic version of appserv would solve your problem. But if you insist on using 2.6.4, you should do the following:
check that phar.so exists in the php extensions directory. If not, you need to install that extension.
if it exists, check if it's listed in php.ini as extension=phar.so. If it's not, add that line.
if it is, check that it's listed in the php.ini that command line PHP uses, too. Command line PHP and web PHP sometimes use different php.ini files, and while one might have phar.so activated, the other might not.
I followed this post but it did not help
I am executing following shell commands on a Remote CI system (Fedora) to install php tools:
wget http://pear.php.net/go-pear.phar
php go-pear.phar
pear config-set auto_discover 1
pear install pear.phpunit.de/PHPUnit
On execution of php unit command I encounter following exception -
pear install pear.phpunit.de/PHPUnit
PHP Fatal error: Call to undefined method PEAR::raiseErro() in /usr/share/pear/PEAR/REST.php on line 165
PHP Stack trace:
PHP 1. {main}() /usr/share/pear/pearcmd.php:0
PHP 2. PEAR_Command_Common->run() /usr/share/pear/pearcmd.php:305
PHP 3. PEAR_Command_Install->doInstall() /usr/share/pear/PEAR/Command/Common.php:271
PHP 4. PEAR_Downloader->download() /usr/share/pear/PEAR/Command/Install.php:661
PHP 5. PEAR_Downloader_Package->initialize() /usr/share/pear/PEAR/Downloader.php:279
PHP 6. PEAR_Downloader_Package->_fromString() /usr/share/pear/PEAR/Downloader/Package.php:190
PHP 7. PEAR_Downloader->_getPackageDownloadUrl() /usr/share/pear/PEAR/Downloader/Package.php:1713
PHP 8. PEAR_REST_13->getDownloadURL() /usr/share/pear/PEAR/Downloader.php:850
PHP 9. PEAR_REST->retrieveData() /usr/share/pear/PEAR/REST/13.php:68
Finished: FAILURE
Are there any more commands I need to add?
You need to update your PEAR. Here is a bug report showing the same error http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=619307 and the solution is to get the updated PEAR version.
What the pear installer is trying to tell you is that there was an error when trying to install the package.
It fails because the pear version that is used is buggy :/
Yes you installed the "current/right" pear package from the php site with the commands shown so that leaves three options:
a) Some permission issue with access to /tmp/ or some other pear config-show folder that doesn't get properly reported.
Maybe throwing in a sudo might help if you can do that?
b) You still have another pear version running alongside or you didn't install pear system-wide or something related to that issue.
Try to run pear upgrade pear and see if that helps. pear version should produce 1.9.4.
c) It's failing because it can't connect to the server it wants to pull the files from and it then fails trying to report the error.
Maybe run wget pear.phpunit.de just to see if that works to check or if your firewall blocks that.
Those are the only two options I currently see to solve your issue with pear without more debugging. Should that not suffice you can find help on freenodeIrc in #phpunit or in the stackoverflow php chat.
All php-qa-tools can be run from a git checkout but it is, usually, considerably(!) more hassle to get that to run.
I've installed a copy of MAMP on my macbook so I can run my php/mysql based website locally.
The MAMP package itself seems to work fine but I needed the PEAR MDB2 Package.
I did the following to install
pear install MDB2
pear install MDB2_Driver_mysql
pear channel-update pear.php.net
All apparently worked and if I try again, they say already installed.
The php include path set in php.ini also looks to be correct:
include_path = ".:/Applications/MAMP/bin/php5.3/lib/php"
Yet after restarting the server and trying to hit my site, I still get
Fatal error: require_once() [function.require]: Failed opening required 'MDB2.php' (include_path='.:/Applications/MAMP/bin/php5.3/lib/php') in /Applications/MAMP/htdocs/config.php on line 5
Is /Applications/MAMP/bin/php5.3/lib/php the root directory for PEAR? That doesn't sound right. Run the command pear config-get php_dir, it will tell you where the PEAR root directory is (despite the misleading configuration name). The default is /usr/share/pear.