GithubHelp home page GithubHelp logo

AllOf not found about validation HOT 39 CLOSED

respect avatar respect commented on May 8, 2024
AllOf not found

from validation.

Comments (39)

nickl- avatar nickl- commented on May 8, 2024

Hmmm it appears to be a class- or auto-loader issue and you are not using any auto loader am I correct?

Does it do the same if you declare the use statement?

<?php
         use Respect\Validation\Rules\AllOf; 

I assume that get_include_path() has your pear path listed as /usr/local/share/pear/ am I correct?
If the use does not resolve your issue and the include path is correct then you can manually include the source file in the meantime:

<?php
         require_once "Respect/Validation/Rules/AllOf.php";

Take note that we are using the relative path, relative to the include path or iow there is no / in the beginning.

I would usually add an autoloader to the mix so I am not sure what it will do without but will have a look at it when I get a moment. In the meantime should you still find it not cooperating please add the code snippet you are using to help me get a better idea what might be going wrong and in so doing hopefully give you a better answer.

from validation.

ed100 avatar ed100 commented on May 8, 2024

Thanks for quick reply. I will run thru all of the items below and then
reply.

thanks

On 08/13/2012 03:44 PM, Nick Lombard wrote:

Hmmm it appears to be a class- or auto-loader issue and you are not using any auto loader am I correct?

Does it do the same if you declare the use statement?

<?php
         use Respect\Validation\Rules\AllOf; 

I assume that get_include_path() has your pear path listed as /usr/local/share/pear/ am I correct?
If the use does not resolve your issue and the include path is correct then you can manually include the source file in the meantime:

<?php
         require_once "Respect/Validation/Rules/AllOf.php";

Take note that we are using the relative path, relative to the include path or iow there is no / in the beginning.

I would usually add an autoloader to the mix so I am not sure what it will do without but will have a look at it when I get a moment. In the meantime should you still find it not cooperating please add the code snippet you are using to help me get a better idea what might be going wrong and in so doing hopefully give you a better answer.


Reply to this email directly or view it on GitHub:
#84 (comment)

from validation.

ed100 avatar ed100 commented on May 8, 2024

this is what I tried first:

<?php
use Respect\Validation\Validator as v;
$usernameValidator = v::alnum()->noWhitespace()->length(1,15);
$name="bob";
$valid = $usernameValidator->validate($name);

and got error: Fatal error: Class 'Respect\Validation\Validator' not
found in
/usr/websites/batterywholesale.com/www/battery-store/viewcat08-11-2012aaa.html

then did:
require_once "Respect/Validation/Validator.php";

use Respect\Validation\Validator as v;
$usernameValidator = v::alnum()->noWhitespace()->length(1,15);
$name="bob";
$valid = $usernameValidator->validate($name);

and got error:
Fatal error: Class 'Respect\Validation\Rules\AllOf' not found in
/usr/local/share/pear/Respect/Validation/Validator.php on line 61

then tried:

require_once "Respect/Validation/Validator.php";
use Respect\Validation\Rules\AllOf;
use Respect\Validation\Validator as v;
$usernameValidator = v::alnum()->noWhitespace()->length(1,15);
$name="bob";
$valid = $usernameValidator->validate($name);

and got error:
Fatal error: Class 'Respect\Validation\Rules\AllOf' not found in
/usr/local/share/pear/Respect/Validation/Validator.php on line 61

then:
require_once "/usr/local/share/pear/Respect/Validation/Validator.php";
require_once "Respect/Validation/Rules/AllOf.php";

use Respect\Validation\Validator as v;
$usernameValidator = v::alnum()->noWhitespace()->length(1,15);
$name="bob";
$valid = $usernameValidator->validate($name);

same error

try:
require_once "/usr/local/share/pear/Respect/Validation/Validator.php";
require_once "/usr/local/share/pear/Respect/Validation/Rules/AllOf.php";

use Respect\Validation\Validator as v;
$usernameValidator = v::alnum()->noWhitespace()->length(1,15);
$name="bob";
$valid = $usernameValidator->validate($name);

same error

try:
require_once "Respect/Validation/Rules/AllOf.php";
require_once "Respect/Validation/Validator.php";
use Respect\Validation\Validator as v;
$usernameValidator = v::alnum()->noWhitespace()->length(1,15);
$name="bob";
$valid = $usernameValidator->validate($name);

New error
Fatal error: Class 'Respect\Validation\Rules\AbstractComposite' not
found in /usr/local/share/pear/Respect/Validation/Rules/AllOf.php on line 6

try:
require_once "Respect/Validation/Rules/AllOf.php";
require_once "Respect/Validation/Validator.php";
require_once "Respect/Validation/Rules/AbstractComposite.php";

use Respect\Validation\Validator as v;
$usernameValidator = v::alnum()->noWhitespace()->length(1,15);
$name="bob";
$valid = $usernameValidator->validate($name);

same error: Fatal error: Class
'Respect\Validation\Rules\AbstractComposite' not found in
/usr/local/share/pear/Respect/Validation/Rules/AllOf.php on line 6

So gave up for now.
Please let me know what you think is the problem.

thanks for your time and effort.

On 08/13/2012 03:44 PM, Nick Lombard wrote:

Hmmm it appears to be a class- or auto-loader issue and you are not using any auto loader am I correct?
No auto loader

Does it do the same if you declare the use statement?
Yes

<?php
         use Respect\Validation\Rules\AllOf; 

I assume that get_include_path() has your pear path listed as /usr/local/share/pear/ am I correct?

Yes, from phpinfo: include_path .:/usr/local/share/pear
.:/usr/local/share/pear

If the use does not resolve your issue and the include path is correct then you can manually include the source file in the meantime:

<?php
         require_once "Respect/Validation/Rules/AllOf.php";

same error

Take note that we are using the relative path, relative to the include path or iow there is no / in the beginning.

I would usually add an autoloader to the mix so I am not sure what it will do without but will have a look at it when I get a moment. In the meantime should you still find it not cooperating please add the code snippet you are using to help me get a better idea what might be going wrong and in so doing hopefully give you a better answer.


Reply to this email directly or view it on GitHub:
#84 (comment)

from validation.

augustohp avatar augustohp commented on May 8, 2024

@ed100 This seems to be a problem with your autoloader, by the code above we can see that the pear data directory is correctly in the include path, although it seems you are still missing the PSR-0 autoloader.

The autoloder is necessary and there are many implementations you can use, if you feel like trying you can choose Respect/Loader.

from validation.

ed100 avatar ed100 commented on May 8, 2024

Hi Augusto:

Sorry to be so ignorant about this. I didn't know I had to have a
autoloader. Don't know anything about them either. I have never worked
with classes at all. I just was trying to get good verification for my
forms and thought this was a good way. It was mentioned in stackoverflow.

Is it easy to get a working autoload for this or messy and I should
forget it?

Thanks for you help,

Verle

On 08/14/2012 09:07 AM, Augusto Pascutti wrote:

@ed100 This seems to be a problem with your autoloader, by the code above we can see that the pear data directory is correctly in the include path, although it seems you are still missing the PSR-0 autoloader.

Are you sure there is one registered in your application?


Reply to this email directly or view it on GitHub:
#84 (comment)

from validation.

augustohp avatar augustohp commented on May 8, 2024

@ed100 There is nothing to be sorry about, we are all glad you took the time to try and solve your problems.

It is nothing difficult or messy really. To do things faster you can install Respect/Loader via PEAR and see the README in the project's home, in the Usage section you should have everything you need. If you see something in README mentioning you should change your include_path, just ignore. You already have this right =)

The spl_autoload_registrer should be used before any class call or instantiation, You can read PHP man pages on autoload functions to understando what they do and how they do. If you have any doubts feel free to ask anything again :)

from validation.

ed100 avatar ed100 commented on May 8, 2024

You guys are really trying. Ran into little problem. I was following
the things to do on http://respect.li/pear/ This is how I installed
Validation a few days ago.

So what I did:

pear list-channels

PHP Warning: Module 'pdo_mysql' already loaded in Unknown on line 0

Registered Channels:

Channel Alias Summary
doc.php.net phpdocs PHP Documentation Team
pear.php.net pear PHP Extension and Application
Repository
pecl.php.net pecl PHP Extension Community Library
respect.li/pear Respect Respect PEAR Channel Server
__uri __uri Pseudo-channel for static packages

pear channel-discover respect.li/pear

PHP Warning: Module 'pdo_mysql' already loaded in Unknown on line 0
Channel "respect.li/pear" is already initialized

pear remote-list -c Respect

PHP Warning: Module 'pdo_mysql' already loaded in Unknown on line 0
Connection to `respect.li:80' failed: php_network_getaddresses:
getaddrinfo failed: hostname nor servname provided, or not known

Why isn't pear seeing Respect? I can go to location
http://respect.li/pear and it comes up fine.

I tried:

pear channel-update Respect

PHP Warning: Module 'pdo_mysql' already loaded in Unknown on line 0
Updating channel "Respect"
Channel "Respect" is not responding over http://, failed with message:
Connection to respect.li:80' failed: php_network_getaddresses: getaddrinfo failed: hostname nor servname provided, or not known Trying channel "Respect" over https:// instead Cannot retrieve channel.xml for channel "respect.li/pear" (Connection to respect.li:443' failed: php_network_getaddresses: getaddrinfo failed:
hostname nor servname provided, or not known)

I am sure that didn't happen when I was installing Respect\Validation.

Anything I can do?

On 08/14/2012 05:08 PM, Augusto Pascutti wrote:

@ed100 There is nothing to be sorry about, we are all glad you took the time to try and solve your problems.

It is nothing difficult or messy really. To do things faster you can install Respect/Loader via PEAR and see the README in the project's home, in the Usage section you should have everything you need. If you see something in README mentioning you should change your include_path, just ignore. You already have this right =)

The spl_autoload_registrer should be used before any class call or instantiation, You can read PHP man pages on autoload functions to understando what they do and how they do. If you have any doubts feel free to ask anything again :)


Reply to this email directly or view it on GitHub:
#84 (comment)

from validation.

augustohp avatar augustohp commented on May 8, 2024

@ed100 There is always something to check these kind of things:

  • Check internet connection by $ ping http://respect.li/pear
  • If this gives you a bad response (no connection or could not resolve name) see if you can ping an IP $ ping 204.232.175.78

I tried here and it seems to be responding, channel-discover and package installation happened quite easily. We know that these kind of steps (although familiar to many people) may seem quite annoying and without purpose but be sure we take these kind of feedback from you very seriously.
Your difficulties installing and trying are noted and we should come with something more direct and easy in the future.

just let me know the responses to the ping, if you can reach them, you will be able to install the package as easily as you did with Validation.

from validation.

ed100 avatar ed100 commented on May 8, 2024

I could ping 204.232.175.78 and respect.li

if I paste respect.li:80 into location in browser, the page comes up.
respect.li:80/pear comes up
https://respect.li/pear/ does not

still get:

pear channel-update respect.li/pear

PHP Warning: Module 'pdo_mysql' already loaded in Unknown on line 0
Updating channel "respect.li/pear"
Channel "respect.li/pear" is not responding over http://, failed with
message: Connection to respect.li:80' failed: php_network_getaddresses: getaddrinfo failed: hostname nor servname provided, or not known Trying channel "respect.li/pear" over https:// instead Cannot retrieve channel.xml for channel "respect.li/pear" (Connection to respect.li:443' failed: php_network_getaddresses: getaddrinfo failed:
hostname nor servname provided, or not known)

and

pear channel-update Respect

PHP Warning: Module 'pdo_mysql' already loaded in Unknown on line 0
Updating channel "Respect"
Channel "Respect" is not responding over http://, failed with message:
Connection to respect.li:80' failed: php_network_getaddresses: getaddrinfo failed: hostname nor servname provided, or not known Trying channel "Respect" over https:// instead Cannot retrieve channel.xml for channel "respect.li/pear" (Connection to respect.li:443' failed: php_network_getaddresses: getaddrinfo failed:
hostname nor servname provided, or not known)

On 08/14/2012 06:43 PM, Augusto Pascutti wrote:

@ed100 There is always something to check these kind of things:

  • Check internet connection by $ ping http://respect.li/pear
  • If this gives you a bad response (no connection or could not resolve name) see if you can ping an IP $ ping 204.232.175.78

I tried here and it seems to be responding, channel-discover and package installation happened quite easily. We know that these kind of steps (although familiar to many people) may seem quite annoying and without purpose but be sure we take these kind of feedback from you very seriously.
Your difficulties installing and trying are noted and we should come with something more direct and easy in the future.

just let me know the responses to the ping, if you can reach them, you will be able to install the package as easily as you did with Validation.


Reply to this email directly or view it on GitHub:
#84 (comment)

from validation.

ed100 avatar ed100 commented on May 8, 2024

the ping I tried is from this (ubuntu box) not my local server box where
pear is.

When I pinged there I got:

ping 204.232.175.78

PING 204.232.175.78 (204.232.175.78): 56 data bytes
64 bytes from 204.232.175.78: icmp_seq=0 ttl=47 time=90.398 ms
64 bytes from 204.232.175.78: icmp_seq=1 ttl=47 time=58.283 ms
64 bytes from 204.232.175.78: icmp_seq=2 ttl=47 time=58.470 ms
64 bytes from 204.232.175.78: icmp_seq=3 ttl=47 time=58.406 ms
^Z
[2]+ Stopped ping 204.232.175.78

[root@myfreebsd /usr/websites/batterywholesale.com/www]# ping respect.li
ping: cannot resolve respect.li: Host name lookup failure

Don't know why my freebsd local server doesn't use any dns service which
looks like what is happening.

I don't understand why I could do the basic same thing a few days ago--I
mean install Respect\Validation

On 08/14/2012 06:43 PM, Augusto Pascutti wrote:

@ed100 There is always something to check these kind of things:

  • Check internet connection by $ ping http://respect.li/pear
  • If this gives you a bad response (no connection or could not resolve name) see if you can ping an IP $ ping 204.232.175.78

I tried here and it seems to be responding, channel-discover and package installation happened quite easily. We know that these kind of steps (although familiar to many people) may seem quite annoying and without purpose but be sure we take these kind of feedback from you very seriously.
Your difficulties installing and trying are noted and we should come with something more direct and easy in the future.

just let me know the responses to the ping, if you can reach them, you will be able to install the package as easily as you did with Validation.


Reply to this email directly or view it on GitHub:
#84 (comment)

from validation.

ed100 avatar ed100 commented on May 8, 2024

I did on freebsd local server:

cat /etc/resolv.conf

domain mvtel.net
nameserver 216.134.244.11

[root@myfreebsd /usr/websites/batterywholesale.com/www]# ping 216.134.244.11
PING 216.134.244.11 (216.134.244.11): 56 data bytes
64 bytes from 216.134.244.11: icmp_seq=0 ttl=61 time=41.916 ms
64 bytes from 216.134.244.11: icmp_seq=1 ttl=61 time=9.854 ms
64 bytes from 216.134.244.11: icmp_seq=2 ttl=61 time=9.541 ms
64 bytes from 216.134.244.11: icmp_seq=3 ttl=61 time=9.478 ms
64 bytes from 216.134.244.11: icmp_seq=4 ttl=61 time=9.029 ms
^Z
[3]+ Stopped ping 216.134.244.11

this is the same nameserver that my Ubuntu box uses.

On 08/14/2012 06:43 PM, Augusto Pascutti wrote:

@ed100 There is always something to check these kind of things:

  • Check internet connection by $ ping http://respect.li/pear
  • If this gives you a bad response (no connection or could not resolve name) see if you can ping an IP $ ping 204.232.175.78

I tried here and it seems to be responding, channel-discover and package installation happened quite easily. We know that these kind of steps (although familiar to many people) may seem quite annoying and without purpose but be sure we take these kind of feedback from you very seriously.
Your difficulties installing and trying are noted and we should come with something more direct and easy in the future.

just let me know the responses to the ping, if you can reach them, you will be able to install the package as easily as you did with Validation.


Reply to this email directly or view it on GitHub:
#84 (comment)

from validation.

alganet avatar alganet commented on May 8, 2024

Just tried here and seems to work as well. PEAR has a superverbose mode, try running sudo pear -vvv install respect.li/pear/Loader (some warnings are expected with this flag on). Let us know the output for that!

from validation.

ed100 avatar ed100 commented on May 8, 2024

sudo pear -vvv install respect.li/pear/Loader
PHP Warning: Module 'pdo_mysql' already loaded in Unknown on line 0

Warning: file_exists(): Unable to find the wrapper "channel" - did you
forget to enable it when you configured PHP? in
PEAR/Downloader/Package.php on line 1518

Warning: is_file(): Unable to find the wrapper "channel" - did you
forget to enable it when you configured PHP? in
PEAR/Downloader/Package.php on line 1528

Warning: is_file(): Unable to find the wrapper "channel" - did you
forget to enable it when you configured PHP? in
PEAR/Downloader/Package.php on line 1528

Warning: fsockopen(): php_network_getaddresses: getaddrinfo failed:
hostname nor servname provided, or not known in PEAR/REST.php on line 419

Warning: fsockopen(): unable to connect to respect.li:80
(php_network_getaddresses: getaddrinfo failed: hostname nor servname
provided, or not known) in PEAR/REST.php on line 419
No releases available for package "respect.li/pear/Loader"
Cannot initialize 'channel://respect.li/pear/Loader', invalid or missing
package file
Package "channel://respect.li/pear/Loader" is not valid
install failed

On 08/14/2012 07:35 PM, Alexandre Gomes Gaigalas wrote:

Just tried here and seems to work as well. PEAR has a superverbose mode, try running sudo pear -vvv install respect.li/pear/Loader (some warnings are expected with this flag on). Let us know the output for that!


Reply to this email directly or view it on GitHub:
#84 (comment)

from validation.

alganet avatar alganet commented on May 8, 2024

That's something! My first try would be upgrading PEAR. I'm using 1.9.4, you can see the version running sudo pear info PEAR.

I'm not sure how you installed PEAR, I usually do sudo apt-get install php-pear then sudo pear upgrade. In your case, I believe the sudo pear upgrade by itself will not work, 'cause your PEAR installation isn't registering a stream protocol for getting packages. I've found (this bug)[http://pear.php.net/bugs/bug.php?id=13047] related to this.

from validation.

ed100 avatar ed100 commented on May 8, 2024

pear info PEAR

PHP Warning: Module 'pdo_mysql' already loaded in Unknown on line 0

About pear.php.net/PEAR-1.9.4

Release Type PEAR-style PHP-based Package

On 08/14/2012 07:44 PM, Alexandre Gomes Gaigalas wrote:

That's something! My first try would be upgrading PEAR. I'm using 1.9.4, you can see the version running sudo pear info PEAR.

I'm not sure how you installed PEAR, I usually do sudo apt-get install php-pear then sudo pear upgrade. In your case, I believe the sudo pear upgrade by itself will not work, 'cause your PEAR installation isn't registering a stream protocol for getting packages. I've found (this bug)[http://pear.php.net/bugs/bug.php?id=13047] related to this.


Reply to this email directly or view it on GitHub:
#84 (comment)

from validation.

alganet avatar alganet commented on May 8, 2024

Did you installed it using apt-get? If so, what I would recommend sounds dumb, but try to sudo apt-get purge php-pear, then remove the /usr/share/php/PEAR* (files and folders matching this glob), the install it over again.

Also, I've noticed that somewhere in your loaded php.ini files, you're including the MySQL extension twice. Not sure if this is related, but the Warning is always there. Try fixing it =)

from validation.

ed100 avatar ed100 commented on May 8, 2024

I don't think freebsd has apt-get. I installed it from ports, did
portsnap fetch update then cd to ports dir for pear and did make install
clean

are you sure that mysql is included twice. I thought mysql once and
mysqli once.

On 08/14/2012 07:59 PM, Alexandre Gomes Gaigalas wrote:

Did you installed it using apt-get? If so, what I would recommend sounds dumb, but try to sudo apt-get purge php-pear, then remove the /usr/share/php/PEAR* (files and folders matching this glob), the install it over again.

Also, I've noticed that somewhere in your loaded php.ini files, you're including the MySQL extension twice. Not sure if this is related, but the Warning is always there. Try fixing it =)


Reply to this email directly or view it on GitHub:
#84 (comment)

from validation.

alganet avatar alganet commented on May 8, 2024

Whops, though you had installed it in Ubuntu, sorry! I never tested Validation on BSD. How do you installed PEAR?

from validation.

ed100 avatar ed100 commented on May 8, 2024

I installed it from ports, did:

portsnap fetch update
then cd to ports dir for pear and did
make install clean

Easy to confuse. My set up is:

I have a freebsd webserver which I use for my website
I have a local freebsd box that is basically identical to the webserver
for testing.
I have a Ubuntu box as my desktop and I admin the freebsd box via ssh
and sftp on my LAN.

On 08/14/2012 08:13 PM, Alexandre Gomes Gaigalas wrote:

Whops, though you had installed it in Ubuntu, sorry! I never tested Validation on BSD. How do you installed PEAR?


Reply to this email directly or view it on GitHub:
#84 (comment)

from validation.

ed100 avatar ed100 commented on May 8, 2024

Ok, I have the dns problem solved. That dns server was pinging but not
dns'ing so I changed the nameserver ip and have dns again. Weird for
that to happen I think. Can't remember it ever happening to me before
in lots of years on the net.

so here is the deal now:

pear channel-update Respect

PHP Warning: Module 'pdo_mysql' already loaded in Unknown on line 0
Updating channel "Respect"
Channel "Respect" is up to date

pear channel-discover respect.li/pear

PHP Warning: Module 'pdo_mysql' already loaded in Unknown on line 0
Channel "respect.li/pear" is already initialized

pear remote-list -c Respect

PHP Warning: Module 'pdo_mysql' already loaded in Unknown on line 0
WARNING: channel "Respect" has updated its protocols, use "pear
channel-update Respect" to update

Channel Respect Available packages:

Package Version
Config -n/a-
Data -n/a-
Doc -n/a-
Foundation -n/a-
Loader -n/a-
Relational -n/a-
Rest -n/a-
Template -n/a-
Validation -n/a-

pear channel-update Respect

PHP Warning: Module 'pdo_mysql' already loaded in Unknown on line 0
Updating channel "Respect"
Channel "Respect" is up to date

pear install Respect/Loader

PHP Warning: Module 'pdo_mysql' already loaded in Unknown on line 0
Failed to download Respect/Loader within preferred state "stable",
latest release is version 0.2.0, stability "alpha", use
"channel://respect.li/pear/Loader-0.2.0" to install
install failed

channel://respect.li/pear/Loader-0.2.0

su: channel://respect.li/pear/Loader-0.2.0: No such file or directory

I think this also happened when I did Validation, had to change the name
of the package to install.

On 08/14/2012 08:13 PM, Alexandre Gomes Gaigalas wrote:

Whops, though you had installed it in Ubuntu, sorry! I never tested Validation on BSD. How do you installed PEAR?


Reply to this email directly or view it on GitHub:
#84 (comment)

from validation.

augustohp avatar augustohp commented on May 8, 2024

$ php -i | grep .ini must show all the INI (configuration) files loaded by PHP. Probably, the pdo_mysql driver is enabled twice in two different configuration files (or the same one, we never know). This could also solve the problem with pear, we never know (again =P).

from validation.

nickl- avatar nickl- commented on May 8, 2024

Ok next thing is to install Respect/Validation via composer it's terrible that you are struggling so much but look on the bright side you have learnt so much already =)

composer comes with an autoloader built in you can read up on composer

http://getcomposer.org/ or from http://packagist.org/

But lets get you up and running quick

first get composer

  curl -s https://getcomposer.org/installer | php

You will have a file in this directory now called composer.phar
Next we will create a composer.json for you and the start of a new project
Run

   php composer.phar init

Follow the dialog just picking the defaults will be fine, until you see the following line the first time add the dependency respect/validation

   Search for a package []: respect/validation

Finish the questions just picking the defaults until you're done.
Now you should have a composer.json that looks something like this

{
    "name": "My/AwesomeProject",
    "description": "My project is Awesome",
    "require": {
        "respect/validation": "dev-master"
    },
    "authors": [
        {
            "name": "nickl-",
            "email": "[email protected]"
        }
    ]
}

Now lets install Respect/Validation from packagist

  php composer.phar install

Which will create a vendor folder and Respect/Validation in there
create your php test file and all you have to include is

<?php
        require 'vendor/autoload.php';

Good luck!!!!

from validation.

ed100 avatar ed100 commented on May 8, 2024

I thought that from this:

pear install Respect/Loader

Failed to download Respect/Loader within preferred state "stable",
latest release is version 0.2.0, stability "alpha", use
"channel://respect.li/pear/Loader-0.2.0" to install
install failed

channel://respect.li/pear/Loader-0.2.0

su: channel://respect.li/pear/Loader-0.2.0: No such file or directory

maybe I just had something wrong with the exact file name in:
channel://respect.li/pear/Loader-0.2.0

or channel should be something other than 'channel'

If I can't get this going tonight, will try composer tomorrow.
That will be some more effort, for example don't have curl installed on
the server. The freebsd box is setup as a server it has nothing on it
that is not for security or running a website.

But I will read more about composer tomorrow. I learn something every
day. But good thing is to keep brain from overloading I forget
something everyday also.

If I have something wrong with the install line above, let me know.

thanks

On 08/14/2012 08:54 PM, Nick Lombard wrote:

Ok next thing is to install Rospect/Validation via composer it's terrible that you are struggling so much but look on the bright side you have learnt so much already =)

composer comes with an autoloader built in you can read up on composer

http://getcomposer.org/ or from http://packagist.org/

But lets get you up and running quick

first get composer

  curl -s https://getcomposer.org/installer | php

You will have a file in this directory now called composer.phar
Next we will create a composer.json for you and the start of a new project
Run

   php composer.phar init

Follow the dialog just picking the defaults will be fine, until you see the following line the first time add the dependency respect/validation

   Search for a package []: respect/validation

Finish the questions just picking the defaults until you're done.
Now you should have a composer.json that looks something like this

{
    "name": "My/AwesomeProject",
    "description": "My project is Awesome",
    "require": {
        "respect/validation": "dev-master"
    },
    "authors": [
        {
            "name": "nickl-",
            "email": "[email protected]"
        }
    ]
}

Now lets install Respect/Validation from packagist

  php composer.phar install

Which will create a vendor folder and Respect/Validation in there
create your php test file and all you have to include is

<?php
        require 'vendor/autoload.php';

Good luck!!!!


Reply to this email directly or view it on GitHub:
#84 (comment)

from validation.

ed100 avatar ed100 commented on May 8, 2024

I tried:

]# pear download Respect/Loader-0.2.0
downloading Loader-0.2.0.tgz ...
Starting to download Loader-0.2.0.tgz (1,958 bytes)
....done: 1,958 bytes
File /usr/ports/devel/pear/Loader-0.2.0.tgz downloaded

then:

pear info Loader-0.2.0.tgz

About respect.li/pear/Loader-0.2.0

Release Type PEAR-style PHP-based Package
Name Loader
Channel respect.li/pear
Summary Hello. I love to load things.
Description Hello. I love to load things.
Maintainers Alexandre Gomes Gaigalas
[email protected] (lead)
Release Date 2011-11-29 20:45:38
Release Version 0.2.0 (alpha)
API Version 0.2.0 (alpha)
License BSD Style
(http://www.opensource.org/licenses/bsd-license.php)
Release Notes Hello. I love to load things.
Required Dependencies PHP version 5.3
PEAR installer version 1.4.0 or newer
package.xml version 2.0

then:

pear install Loader-0.2.0.tgz

install ok: channel://respect.li/pear/Loader-0.2.0

I assume Loader is now installed, what do I do now?

On 08/14/2012 09:21 PM, Nick Lombard wrote:

You don't need curl I just gave that link to you for convenience you may
also do it with only php

try

    php -r "eval('?>'.file_get_contents('
https://getcomposer.org/installer'));"

Don't give up now you are so close and we were all thinking it great that
you don't give up.

In my experience if pear gives you trouble then it is going to give you a
lot of trouble or it just works. Give this a try I would love to see you
smiling before I go to bed and it's 04:30 am here...

Crossing fingers


Reply to this email directly or view it on GitHub:
#84 (comment)

from validation.

ed100 avatar ed100 commented on May 8, 2024

looks to be here:

ll /usr/local/share/pear/Respect

total 8
-rw-r--r-- 1 root wheel 2174 Aug 14 20:22 Loader.php
drwxr-xr-x 4 root wheel 512 Aug 11 18:08 Validation

On 08/14/2012 09:21 PM, Nick Lombard wrote:

You don't need curl I just gave that link to you for convenience you may
also do it with only php

try

    php -r "eval('?>'.file_get_contents('
https://getcomposer.org/installer'));"

Don't give up now you are so close and we were all thinking it great that
you don't give up.

In my experience if pear gives you trouble then it is going to give you a
lot of trouble or it just works. Give this a try I would love to see you
smiling before I go to bed and it's 04:30 am here...

Crossing fingers


Reply to this email directly or view it on GitHub:
#84 (comment)

from validation.

nickl- avatar nickl- commented on May 8, 2024

You don't need curl I just gave that link to you for convenience you may
also do it with only php.

         php -r "eval('?>'.file_get_contents('https://getcomposer.org/installer'));"

Don't give up now you are so close and we were all thinking it great that
you don't give up.

In my experience if pear gives you trouble then it is going to give you a
lot of trouble or it just works. Give this a try I would love to see you
smiling before I go to bed and it's 04:30 am here...

Crossing fingers

from validation.

nickl- avatar nickl- commented on May 8, 2024

If you follow my instructions you already have all the information.

It is going to get you smiling before trying to get Loader working but if you insist I will write you the instructions quick while you try composer. =)

from validation.

ed100 avatar ed100 commented on May 8, 2024

I got Loader installed without composer.

Loader.php is in /usr/local/share/pear/Respect

Npw what?

On 08/14/2012 09:33 PM, Nick Lombard wrote:

If you follow my instructions you already have all the information.

It is going to get you smiling before trying to get Loader working but if you insist I will write you the instructions quick while you try composer. =)


Reply to this email directly or view it on GitHub:
#84 (comment)

from validation.

nickl- avatar nickl- commented on May 8, 2024

To use Respect/Loader as PSR-0 class loader

<?php

$loader = require 'path/to/Loader.php';
spl_register_autoload($loader);

That should do the trick, let me know.

from validation.

nickl- avatar nickl- commented on May 8, 2024

You got Validation and Loader installed in pear that is not the same as what composer does. it will install the classes in your project folder.

With composer you only need Validation because it comes with an autoloader, as does pear btw. if you ask me there is a problem with your pear and this is why I am suggesting you try composer. The more the merrier don't be shy install both. =)

from validation.

ed100 avatar ed100 commented on May 8, 2024

put this is testpage:

$loader = require '/usr/local/share/pear/Respect/Loader.php';
spl_register_autoload($loader);

get:

Fatal error: Call to undefined function spl_register_autoload() in
/usr/websites/batterywholesale.com/www/battery-store/viewcat08-11-2012zaa.html
on line 3

Is the require using relative path or full path?

On 08/14/2012 09:37 PM, Nick Lombard wrote:

$loader = require 'path/to/Loader.php';
spl_register_autoload($loader);

from validation.

ed100 avatar ed100 commented on May 8, 2024

I fixed the latest problem, the php command is spl_autoload_register not
spl_register_autoload

The page comes up now with no problems. Tomorrow I will check out the
validations to see how they will work on my site.

I really thank you guys. Could never have done it without all your help.

Where and how can I put in a good word for you?

Time for us to both get some sleep.

On 08/14/2012 09:42 PM, Nick Lombard wrote:

You got Validation and Loader installed in pear that is not the same as what composer does. it will install the classes in your project folder.

With composer you only need Validation because it comes with an autoloader, as does pear btw. if you ask me there is a problem with your pear and this is why I am suggesting you try composer. The more the merrier don't be shy install both. =)


Reply to this email directly or view it on GitHub:
#84 (comment)

from validation.

augustohp avatar augustohp commented on May 8, 2024

@ed100: sorry, my bad there, the actual method is spl_autoload_register($loader).

You can use both, the absolute PATH is always going to work. The relative will work using include_path, as installing PEAR already put its path into the include_path, the relative solution also works. :)

from validation.

ed100 avatar ed100 commented on May 8, 2024

No problem, I used the full path -- I almost always do. As soon as I
got the error I knew that the function didn't spit out a function so I
went to php.net, copy/paste the function, got a no such thing so was a
very easy fix.

Thanks again for all your help. I will test it tomorrow to see how to
verify my form entries.

On 08/14/2012 09:55 PM, Augusto Pascutti wrote:

@ed100: sorry, my bad there, the actual method is spl_autoload_register($loader).

You can use both, the absolute PATH is always going to work. The relative will work using include_path, as installing PEAR already put its path into the include_path, the relative solution also works. :)


Reply to this email directly or view it on GitHub:
#84 (comment)

from validation.

augustohp avatar augustohp commented on May 8, 2024

@ed100 You are welcome, but let us thank you for you patience and perseverance also!

You can always find us at #php-respect on irc.freenode.net (speaking for all of us). I always try to be on GTalk as [email protected]

PS: just to note, did you find and removed the duplicate pdo_mysql extension and that solved the PEAR problem? If so, I will try to comment this on the issues I can find about it. :)

from validation.

nickl- avatar nickl- commented on May 8, 2024

@ed100 Awesome!!! Well done!

I knew you'd get it right =)

@augustohp as it turns out absolute paths give spl a unique key to index with and is beneficial, using
stream_resolve_include_path to find the absolute path which doesn't require a stat either. Makes a huge difference performance increases of around 60% compared to others like file_exists check it out and let me know what you find.
Also try with APC, you will see...

from validation.

ed100 avatar ed100 commented on May 8, 2024

no, I still could not install Loader after I fixed the pdo problem
That problem was caused by putting the .so for pdo into php.ini and
httpd.conf both. That happened because I was testing it first in
php.ini, worked so put it into httpd.conf and forgot to remove it from
php.ini

My dns problem was caused by my isp, mvtel.net. A couple of weeks ago
their webserver crashed. They evidently took down one of their dns
server (the one I was using) and made it into their webserver. I could
ping - no problem just not doing dns. I changed the nameserver in
/etc/resolv.conf and fixed the problem. After that change I still could
not find any packages at /Respect using pear remote-list -c Respect
(still does not give me packages wish I knew why).

Channel Respect Available packages:

Package Version
Config -n/a-
Data -n/a-
Doc -n/a-
Foundation -n/a-
Loader -n/a-
Relational -n/a-
Rest -n/a-
Template -n/a-
Validation -n/a-

so I did pear download Respect/Loader
That pointed me toward:

pear download Respect/Loader-0.2.0

that got a download of Loader-0.2.0.tgz
did:
pear install Loader-0.2.0.tgz

That did it :)

Thanks again and again, you guys are very helpful

On 08/14/2012 10:08 PM, Augusto Pascutti wrote:

@ed100 You are welcome, but let us thank you for you patience and perseverance also!

You can always find us at #php-respect on irc.freenode.net (speaking for all of us). I always try to be on GTalk as [email protected]

PS: just to note, did you find and removed the duplicate pdo_mysql extension and that solved the PEAR problem? If so, I will try to comment this on the issues I can find about it. :)


Reply to this email directly or view it on GitHub:
#84 (comment)

from validation.

ed100 avatar ed100 commented on May 8, 2024

I tried some validations and worked fine.

then I tried to do error messages:

try {
$usernameValidator->assert('really messed up screen#name');
} catch(\InvalidArgumentException $e) {
var_dump($e->findMessages('alnum', 'length', 'noWhitespace'));
}

That give an error:

Catchable fatal error: Argument 1 passed to
Respect\Validation\Exceptions\AbstractNestedException::findMessages()
must be of the type array, string given, called in
/usr/websites/www/validationpage.html on line 14 and defined in
/usr/local/share/pear/Respect/Validation/Exceptions/AbstractNestedException.php
on line 22

also tried on a different try than above:

$errors = $e->findMessages(
'alnum' => '{{name}} must contain only letters and digits',
'length' => '{{name}} must not have more than 15 chars',
'noWhitespace' => '{{name}} cannot contain spaces'
);

and got error:
Parse error: syntax error, unexpected '=>' (T_DOUBLE_ARROW) in
/usr/websites/www/validationpage.html on line 11

On 08/14/2012 10:08 PM, Augusto Pascutti wrote:

@ed100 You are welcome, but let us thank you for you patience and perseverance also!

You can always find us at #php-respect on irc.freenode.net (speaking for all of us). I always try to be on GTalk as [email protected]

PS: just to note, did you find and removed the duplicate pdo_mysql extension and that solved the PEAR problem? If so, I will try to comment this on the issues I can find about it. :)


Reply to this email directly or view it on GitHub:
#84 (comment)

from validation.

nickl- avatar nickl- commented on May 8, 2024

Apologies for the late response I saw your "Success" message and assumed resolved.

Transferring this to a new issue...

from validation.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.