Thursday, August 22, 2019

Using PHP and PerlBrew

I have phpbrew installed on my mac. I use it to manage my php installation.

The first command I used was

phpbrew known

to view the known PHP versions.

I had not installed any versions, so

phpbrew list

did not show me any.

So, I checked the version - 1.23. GitHub showed a newer version of 1.26. I decided to reinstall phpbrew.

https://github.com/phpbrew/phpbrew

  • used curl to install phpbrew.phar
  • moved to my path
  • made it executable
phpbrew system revealed that my PHP on my Mac under Mojave is outdated, so I installed 7.3 as my system PHP.

After installing, I updated my PATH with 

export PATH=/usr/local/php5/bin:$PATH

I will also add that to my .bashrc

I was trying to install a different PHP version and received errors about missing bzip2 and some other things. I wound up reinstalling Homebrew, because it could not update itself.

Homebrew prefix "/usr/local/Cellar/libxml2/2.9.3" does not exist.

Error: No available formula with the name "bzip2"

Homebrew formula "bzip2" not found.

Homebrew prefix "/usr/local/Cellar/oniguruma/5.9.6" does not exist.

Homebrew prefix "/usr/local/Cellar/mhash/0.9.9.9" does not exist.

Homebrew prefix "/usr/local/Cellar/curl/7.46.0" does not exist.

checking for ZLIB support... no

checking whether to enable bc style precision math functions... yes

checking for BZip2 support... yes

checking for BZip2 in default path... not found

configure: error: Please reinstall the BZip2 distribution

I tried to install some libraries

brew install zlib bzip2 libiconv curl

This is when I tried to update brew and had to reinstall. After brew install, I was able to install the above.

Next, I intalled

phpbrew install 7.4.5 +mysql +default

I still get the error

Homebrew prefix "/usr/local/Cellar/libxml2/2.9.10_1" does not exist.
Homebrew prefix "/usr/local/Cellar/oniguruma/6.9.5" does not exist.
Homebrew prefix "/usr/local/Cellar/mhash/0.9.9.9" does not exist.
Homebrew prefix "/usr/local/Cellar/openssl@1.1/1.1.1g" does not exist.

It looks like I need more stuff for Mac OS:

brew install autoconfig pkg-config

Then

brew upgrade

Could not find autoconfig formula.

Still can't install PHP. It did find the openssl folder.

brew install libxml2 onigurma mhash

Installed missing packages with brew.

Still can't install PHP versions.

Inspect

tail /Users/timdowney/.phpbrew/build/php-7.4.5/build.log

Missing link to pkg-config, tried

brew link pkg-config

Missing libzip

brew install libzip

Tried to install 7.4.5 again.

Congratulations! Now you have PHP with 7.4.5 as php-7.4.5

* We found that you enabled 'mysql' variant, you might need to setup your
  'pdo_mysql.default_socket' or 'mysqli.default_socket' in your php.ini file.

* To configure your installed PHP further, you can edit the config file at
    /Users/timdowney/.phpbrew/php/php-7.4.5/etc/php.ini

To use the newly built PHP, try the line(s) below:

    $ phpbrew use php-7.4.5

Or you can use switch command to switch your default php to php-7.4.5:

    $ phpbrew switch php-7.4.5












Friday, July 12, 2019

Creating Maven from non-Maven project in NetBeans.

I have a project in NetBeans that is difficult to commit to a version control system (VCS), since the libraries are not saved to the VCS. For several reasons, it is a bad idea to try to save the libraries to the VCS: they are binaries, many duplicates of the files could be saved to the VCS.

An alternative is to use Maven. The POM file in Maven references all the necessary libraries. When the project is downloaded from the VCS, opened, and run, the POM will guarantee that all necessary libraries are downloaded from the cloud.

I have created a new Maven project and am copying the files from the original project into the new Maven project. I will list the libraries that are missing as I copy.

Libraries:

  • org.apache,commons.beanutils - 1.9.3 [jar] local
  • org.apache.log4j - 1.2.15 [jar]
  • org.hibernate.validator.engine - 6.0.10.Final [jar]
  • org.hibernate - 5.2.17
  • org.springframework.beans - 5.0.8 RELEASE [jar] local
  • org.springframework.web - 5.0.8 RELEASE [jar] local
  • org.springframework.context - 5.0.8 RELEASE [jar] local
  • org.springframework.transaction - 5.0.8 RELEASE [jar] local
  • org.springframework.web.servlet - 5.0.8 RELEASE [jar] local 
  • org.springframework.jdbc - 5.0.8 RELEASE [jar] local 
  • org.springframework.orm - 4.2.5 RELEASE [jar] local 
Missing Libraries:
  • com.paypal.sdk.core .exceptions . profiles .services
  • com.fedex.ws.rate
  • org.apache.fop
  • org.apache.xmlgraphics
  • org.w3c.tidy
  • org.apache.avalon
In order to make the project portable, I must place the missing libraries into a remote Maven repo.
  • fop.jar
  • avalon-framework-4.2.0.jar
  • jtidy-r938.jar 
  • mailapi.jar
  • paypal_base.jar
  • paypal_juint.jar
  • RateService.jar
  • xmlgraphics-commons-1.4.jar
For now, I will place these into a folder on the website, until I figure out how to create a Maven repo.

Harder than I thought. To install into the local .m2/repository, run the maven install command  for each library:

    mvn install:install-file -Dfile=/Users/me/Downloads/jar-missing/jtidy-r938.jar
        -DgroupId=org.w3c.tidy -DartifactId=jtidy -Dversion=r938 -Dpackaging=jar

I edited the pom file for each library:

       
            org.w3c.tidy
            jtidy
            r938
            jar
       


I still needed more dependencies. These are used in log4j 1.2.15, but not in log4j 1.2.16. I upgraded to 1.2.16.

javax.jms:jms:jar:1.1
com.sun.jdmk:jmxtools:jar:1.2.1
com.sun.jmx:jmxri:jar:1.2.1

Two new dependencies were needed:

        <!-- https://mvnrepository.com/artifact/com.sun.xml/jaxws-rt -->
        <dependency>
            <groupid>com.sun.xml</groupid>
            <artifactid>jaxws-rt</artifactid>
            <version>2.0EA3</version>
        </dependency>
        <dependency>
            <groupid>javax.jws</groupid>
            <artifactid>jsr181-api</artifactid>
            <version>1.0-MR1</version>
        </dependency><br />

... and mysql:


        <!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
        <dependency>
            <groupid>mysql</groupid>
            <artifactid>mysql-connector-java</artifactid>
            <version>8.0.16</version>
        </dependency>


I still needed jstl and standard for taglibs.

I will explore creating a remote repo.





Followers