New unMENU package: PHP


Recommended Posts

as per this thread by BubbaQ, the need arised for a php package manager .conf... tested and working

 

Enjoy,

Matt

UPDATED: Jan 22, 2009 @ 3pm EST

 

fixed php-unmenu-package.conf as per jimwhite's and Joe L. suggestions

 

included jimwhite's libxml2-unmenu-package.conf (php is dependent on package)

 

new php-unmenu-package.conf contents

PACKAGE_NAME PHP
PACKAGE_DESCR PHP is an HTML-embedded scripting language.  It shares syntax
PACKAGE_DESCR characteristics with C, Java, and Perl.  The primary objective behind
PACKAGE_DESCR this language is to make a fast and easy-to-use scripting language
PACKAGE_DESCR for dynamic web sites.
PACKAGE_URL http://mirrors.easynews.com/linux/slackware/slackware-current/slackware/n/php-5.2.8-i486-1.tgz
PACKAGE_FILE php-5.2.8-i486-1.tgz
PACKAGE_MD5 905b7200f26357f6a0a59a9fafabcfdc
PACKAGE_INSTALLED /etc/httpd/php.ini
PACKAGE_DEPENDENCIES libxml2.so.2.6.32
PACKAGE_INSTALLATION installpkg php-5.2.8-i486-1.tgz
PACKAGE_INSTALLATION sed -i "s/^\(extension=curl.so\)/;\1/" /etc/httpd/php.ini
PACKAGE_INSTALLATION sed -i "s/^\(extension=gd.so\)/;\1/" /etc/httpd/php.ini
PACKAGE_INSTALLATION sed -i "s/^\(extension=mhash.so\)/;\1/" /etc/httpd/php.ini
PACKAGE_INSTALLATION sed -i "s/^\(extension=mysql.so\)/;\1/" /etc/httpd/php.ini
PACKAGE_INSTALLATION sed -i "s/^\(extension=mysqli.so\)/;\1/" /etc/httpd/php.ini
PACKAGE_INSTALLATION sed -i "s/^\(extension=pdo_mysql.so\)/;\1/" /etc/httpd/php.ini
PACKAGE_INSTALLATION sed -i "s/^\(extension=pspell.so\)/;\1/" /etc/httpd/php.ini
PACKAGE_INSTALLATION sed -i "s/^\(extension=snmp.so\)/;\1/" /etc/httpd/php.ini
PACKAGE_INSTALLATION sed -i "s/^\(extension=xsl.so\)/;\1/" /etc/httpd/php.ini
PACKAGE_VERSION_TEST php -v | sed 1q | awk '{ print $2 }'
PACKAGE_VERSION_STRING 5.2.8
PACKAGE_MEMORY_USAGE Large (~8M)

 

Link to comment

If you could, please edit the php.ini file and comment out the following extensions:

 

curl.so

gd.so

mhash.so

mysql.so

mysqli.so

pdo_mysql.so

pspell.so

snmp.so

xsl.so

 

The only one potentially useful to have added is curl, since I think It is used for to the PHP function "file_get_contents" when getting a remote URL.

 

Link to comment

I see we were posting at the same time...

 

I think you are running on a hard disk... in a basic flash system, the /etc/httpd folder is in ram, so the .ini file cannot be mod'd persistantly... also, as noted, on a flash system, the smarthistory files all get dumped in the flash's /custom/etc/rc.d folder...

 

 

Link to comment

updated OP with new packages and a php.ini file for use.

 

Cheers,

Matt

Matt,

The current /boot/custom/etc/rc.d/rc.local_startup that most people have will attempt to invoke the php.ini file you apparently are storing in /boot/custom/etc/rc.d.

 

It might be really bad, depending on the contents. (and since the "comment" character in the php.ini is NOT a comment in shell, it will try to invoke every word as commands... Ouch...

 

Nothing except "SNN--startup-scripts" can go in the /boot/custom/etc/rc.d folder.     We can't even put "KNN------" (shutdown) scripts there as the current loop does not know how to properly deal with them. It would try to invoke them as well on startup.

 

Sorry...but I think that if somebody installs your new package file as you have it now, good chance it will break the other local_startup tasks that follow.

 

You are far better off using a series of "sed" commands to comment out the un-needed "php" library references in /etc/httpd/php.ini

 

Put those lines after the installpkg command

 

Like this:

PACKAGE_INSTALLATION installpkg php-5.2.8-i486-1.tgz

PACKAGE_INSTALLATION sed -i  "s/^\(extension=curl.so\)/;\1/"  /etc/httpd/php.ini

PACKAGE_INSTALLATION sed -i  "s/^\(extension=gd.so\)/;\1/"  /etc/httpd/php.ini

PACKAGE_INSTALLATION sed -i  "s/^\(extension=mhash.so\)/;\1/"  /etc/httpd/php.ini

PACKAGE_INSTALLATION sed -i  "s/^\(extension=mysql.so\)/;\1/"  /etc/httpd/php.ini

PACKAGE_INSTALLATION sed -i  "s/^\(extension=mysqli.so\)/;\1/"  /etc/httpd/php.ini

PACKAGE_INSTALLATION sed -i  "s/^\(extension=pdo_mysql.so\)/;\1/"  /etc/httpd/php.ini

PACKAGE_INSTALLATION sed -i  "s/^\(extension=pspell.so\)/;\1/"  /etc/httpd/php.ini

PACKAGE_INSTALLATION sed -i  "s/^\(extension=snmp.so\)/;\1/"  /etc/httpd/php.ini

PACKAGE_INSTALLATION sed -i  "s/^\(extension=xsl.so\)/;\1/"  /etc/httpd/php.ini

 

A better test of the version is to get it from php itself.  Otherwise, if a newer version is later installed and the old "doc" files exists, it will not get confused.

Also, many people will delete the documentation files since they are not really readable on the unRAID server.

PACKAGE_VERSION_TEST php -v | sed 1q | awk '{ print $2 }'

PACKAGE_VERSION_STRING 5.2.8

 

Nothing can go in /boot/custom/etc/rc.d except for the start-up scripts, at least until we get a much better rc.local_startup script in place.

 

Joe L.

Link to comment

updated OP with new packages and a php.ini file for use.

 

Cheers,

Matt

Matt,

The current /boot/custom/etc/rc.d/rc.local_startup that most people have will attempt to invoke the php.ini file you apparently are storing in /boot/custom/etc/rc.d.

 

It might be really bad, depending on the contents. (and since the "comment" character in the php.ini is NOT a comment in shell, it will try to invoke every word as commands... Ouch...

 

Nothing except "SNN--startup-scripts" can go in the /boot/custom/etc/rc.d folder.     We can't even put "KNN------" (shutdown) scripts there as the current loop does not know how to properly deal with them. It would try to invoke them as well on startup.

 

Sorry...but I think that if somebody installs your new package file as you have it now, good chance it will break the other local_startup tasks that follow.

 

You are far better off using a series of "sed" commands to comment out the un-needed "php" library references in /etc/httpd/php.ini

 

Put those lines after the installpkg command

 

Like this:

PACKAGE_INSTALLATION installpkg php-5.2.8-i486-1.tgz

PACKAGE_INSTALLATION sed -i "s/^\(extension=curl.so\)/;\1/" /etc/httpd/php.ini

PACKAGE_INSTALLATION sed -i "s/^\(extension=gd.so\)/;\1/" /etc/httpd/php.ini

PACKAGE_INSTALLATION sed -i "s/^\(extension=mhash.so\)/;\1/" /etc/httpd/php.ini

PACKAGE_INSTALLATION sed -i "s/^\(extension=mysql.so\)/;\1/" /etc/httpd/php.ini

PACKAGE_INSTALLATION sed -i "s/^\(extension=mysqli.so\)/;\1/" /etc/httpd/php.ini

PACKAGE_INSTALLATION sed -i "s/^\(extension=pdo_mysql.so\)/;\1/" /etc/httpd/php.ini

PACKAGE_INSTALLATION sed -i "s/^\(extension=pspell.so\)/;\1/" /etc/httpd/php.ini

PACKAGE_INSTALLATION sed -i "s/^\(extension=snmp.so\)/;\1/" /etc/httpd/php.ini

PACKAGE_INSTALLATION sed -i "s/^\(extension=xsl.so\)/;\1/" /etc/httpd/php.ini

 

A better test of the version is to get it from php itself.  Otherwise, if a newer version is later installed and the old "doc" files exists, it will not get confused.

Also, many people will delete the documentation files since they are not really readable on the unRAID server.

PACKAGE_VERSION_TEST php -v | sed 1q | awk '{ print $2 }'

PACKAGE_VERSION_STRING 5.2.8

 

Nothing can go in /boot/custom/etc/rc.d except for the start-up scripts, at least until we get a much better rc.local_startup script in place.

 

Joe L.

 

I wasn't thinking, I wanted to get it updated while I had some time....

 

I just followed this:

/custom/etc/rc.d

 

New version of smarthistory will be posted shortly that includes a config directive for the data directory to use.

assuming he was refering to the root of the flash drive followed by /custom/etc/rc.d....

 

I will take it down pending a better version. thanks

 

Matt

Link to comment

PACKAGE_INSTALLATION sed -i  "s/^\(extension=curl.so\)/;\1/"  /etc/httpd/php.ini

PACKAGE_INSTALLATION sed -i  "s/^\(extension=gd.so\)/;\1/"  /etc/httpd/php.ini

PACKAGE_INSTALLATION sed -i  "s/^\(extension=mhash.so\)/;\1/"  /etc/httpd/php.ini

PACKAGE_INSTALLATION sed -i  "s/^\(extension=mysql.so\)/;\1/"  /etc/httpd/php.ini

PACKAGE_INSTALLATION sed -i  "s/^\(extension=mysqli.so\)/;\1/"  /etc/httpd/php.ini

PACKAGE_INSTALLATION sed -i  "s/^\(extension=pdo_mysql.so\)/;\1/"  /etc/httpd/php.ini

PACKAGE_INSTALLATION sed -i  "s/^\(extension=pspell.so\)/;\1/"  /etc/httpd/php.ini

PACKAGE_INSTALLATION sed -i  "s/^\(extension=snmp.so\)/;\1/"  /etc/httpd/php.ini

PACKAGE_INSTALLATION sed -i  "s/^\(extension=xsl.so\)/;\1/"  /etc/httpd/php.ini

 

PACKAGE_VERSION_TEST php -v | sed 1q | awk '{ print $2 }'

PACKAGE_VERSION_STRING 5.2.8

 

ok, so you forced me to learn the sed command (thank you btw)

 

I just wanted to make sure I understand it right.... here we go..

sed -i  "s/^\(extension=gd.so\)/;\1/"  /etc/httpd/php.ini

so in english it would go something like this:

stream edit the file /etc/httpd/php.ini in place [-i] without backing up [no suffix with the -i option] by replacing [s/regexp/replacement/] the line containing "extension=gd.so" [^\(extension=gd.so\)] with ";" followed by the first element of the regexp [;\1] .....

 

and this one

php -v | sed 1q | awk '{ print $2 }'

IS:

get the php version information

 and pipe [|] that through the stream editor whereby it takes the first line [sed 1] and then quits [q] and pipes [|] that to awk where awk grabs the second element [$2] on the line and outputs it [print].

 

this could come in handy in the future and I want to make sure I know it... thanks,

 

Matt

 

EDIT: the new php-unmenu-package.conf and dependent package are now in the OP again (updated version)

Link to comment

PACKAGE_INSTALLATION sed -i  "s/^\(extension=curl.so\)/;\1/"  /etc/httpd/php.ini

PACKAGE_INSTALLATION sed -i  "s/^\(extension=gd.so\)/;\1/"  /etc/httpd/php.ini

PACKAGE_INSTALLATION sed -i  "s/^\(extension=mhash.so\)/;\1/"  /etc/httpd/php.ini

PACKAGE_INSTALLATION sed -i  "s/^\(extension=mysql.so\)/;\1/"  /etc/httpd/php.ini

PACKAGE_INSTALLATION sed -i  "s/^\(extension=mysqli.so\)/;\1/"  /etc/httpd/php.ini

PACKAGE_INSTALLATION sed -i  "s/^\(extension=pdo_mysql.so\)/;\1/"  /etc/httpd/php.ini

PACKAGE_INSTALLATION sed -i  "s/^\(extension=pspell.so\)/;\1/"  /etc/httpd/php.ini

PACKAGE_INSTALLATION sed -i  "s/^\(extension=snmp.so\)/;\1/"  /etc/httpd/php.ini

PACKAGE_INSTALLATION sed -i  "s/^\(extension=xsl.so\)/;\1/"  /etc/httpd/php.ini

 

PACKAGE_VERSION_TEST php -v | sed 1q | awk '{ print $2 }'

PACKAGE_VERSION_STRING 5.2.8

 

ok, so you forced me to learn the sed command (thank you btw)

 

I just wanted to make sure I understand it right.... here we go..

sed -i  "s/^\(extension=gd.so\)/;\1/"  /etc/httpd/php.ini

so in english it would go something like this:

stream edit the file /etc/httpd/php.ini in place [-i] without backing up [no suffix with the -i option] by replacing [s/regexp/replacement/] the line containing "extension=gd.so" [^\(extension=gd.so\)] with ";" followed by the first element of the regexp [;\1] .....

 

and this one

php -v | sed 1q | awk '{ print $2 }'

IS:

get the pvp version information

 and pipe [|] that through the stream editor whereby it takes the first line [sed 1] and then quits [q] and pipes [|] that to awk where awk grabs the second element [$2] on the line and outputs it [print].

 

this could come in handy in the future and I want to make sure I know it... thanks,

 

Matt

 

he stream editor is *very* powerful... it even has labels, goto's, and conditional logic, but I used none of that in my simple scripts.

 

Yes, the "sed 1q" will match on line 1 and then quit.  It is functionally equivalent to the "head -n 1" command.  (but "head" was not available on a lot of unix boxes, so I used "sed" instead.)

 

sed -i  (edit file in place)

"s/old/new/"  (substitute the text matching the old with the text given as new)

"^" = start of line

\( \) = capture a group of matching text to be used as part of the "new"

 

s/^(existing text\)/ = match "existing text" but only if it occurs at the start of a line.  Save the matched text as \1.  If there was a subsequent \( \) pair, it could be used as \2 in the new.

 

s/^\(existing text\)/;\1/  = for the existing text matched at the start of a line, substitute a semi-colon followed by the matching text.  In other words, put a semi-colon at the start of the line it matches.

 

Here is a really neat example of a label and goto in "sed"  Copy and paste it in your telnet window.  It adds commas to the number passed through it to aid in readability.  It looks for a "space" followed by 4 or more characters of 0-9, saving as matched text the initial set of numbers and the last three.  The number must be sent with a leading and trailing space for this trick to work.

Then, it replaces the number with the leading set of digits, a comma, and the last three. It then copies the result back to the "pattern" space with the "g" command.  It is slightly confusing in that instead of using a forward slash to separate the s/old/new it uses an equal sign.  So... s=old=new=. If the pattern matched, and the substitute was successful, it loops to again find the leading set of numbers followed by 3 numbers.  It again does the substitute, and loops until it is done and it no longer has 4 or more digits in a row in which to insert a comma.

 

echo " 123456789012345 " | sed -r ':L;s=\b([0-9]+)([0-9]{3})\b=\1,\2=g;t L'

 

Have fun.  Sed is sometimes pretty tough to decipher, but most times it is actually pretty easy.  It uses "regular expressions," an entirely complex topic of their own.  You can google "Linux regular expressions" for a few more examples.

 

Joe L.

Link to comment

For others looking to learn, i have foudn the following guide online for sed... it's well written with plenty of examples to follow along with.

 

http://www.grymoire.com/Unix/Sed.html

 

Cheers,

Matt

Wow,  you can teach an old dog some new tricks...  Good link.

 

Joe L.

 

The base link: http://www.grymoire.com/Unix/ has a few interesting articles including some on AWK, regular expressions, shells and shell scripts. Much can be learned there...

 

Cheers,

Matt

Link to comment
  • 8 months later...

In case you wanted to keep these up to date, the links in the 2 packages are broken now.  I believe Joe has an adjusted link for the PHP conf in his newest package file, and I think he later posted a libxml conf, although it seems to have a link to a slightly older libxml2 package.  I don't know if the slightly older version is significant.  For now, I'll use his links to update the Add Ons page for SMART History, which needs both packages installed.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.